]> jfr.im git - irc/evilnet/x3.git/commitdiff
improve stats routing command
authorrubin <redacted>
Sat, 9 Dec 2006 07:10:46 +0000 (07:10 +0000)
committerrubin <redacted>
Sat, 9 Dec 2006 07:10:46 +0000 (07:10 +0000)
ChangeLog
src/opserv.c
src/opserv.help

index 825bf1b20faeb44d0a47d83af3d228b190569ba8..2788b6ad4f4f7739af530c05b45e5fae19687556 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -4,15 +4,20 @@
 2006-12-09  Alex Schumann   <rubin@afternet.org>
 
        * src/opserv.c: bugfixes to autorouting timer code
+       improved stats routing to clean up & take an argument
 
        * src/opserv.h: bugfixes to autorouting timer code
 
+       * src/opserv.help: document new stats routing syntax
+
        * src/timeq.c: added some usefull (commented out) debugging code for
        figuring out timer problems.
 
        * src/timerq.h: added some usefull (commented out) debugging code for
        figuring out timer problems.
 
+       * src/proto-p10.c: cleanup/improve eob autorouting init
+
 2006-12-08  Alex Schumann   <rubin@afternet.org>
 
        * src/opserv.c: Moving some version reply housekeeping to proto-p10.c
index 259e1afe29364b586c54ec7a9d54380953f2bab1..ad1e0c203f0ab63867e5f8c97a5c1b97f0da4c06 100644 (file)
@@ -311,15 +311,17 @@ static const struct message_entry msgtab[] = {
     { "OSMSG_ALERT_IS",      "$b%-20s$b %-6s (by %s)" },
     { "OSMSG_ALERT_END",     "----------------End of Alerts-----------------" },
     /* routing messages */
-    { "OSMSG_ROUTINGPLAN_LIST",  "$bRouting Plans$b" },
+    { "OSMSG_ROUTINGPLAN",  "$bRouting Plan(s)$b" },
+    { "OSMSG_ROUTINGPLAN_LIST_HEAD", "$bRouting Plans$b" },
     { "OSMSG_ROUTINGPLAN_BAR",   "----------------------------------------------" },
-    { "OSMSG_ROUTINGPLAN_END",   "-------------End of Routing Plans-------------" },
+    { "OSMSG_ROUTINGPLAN_END",   "------------End of Routing Plan(s)------------" },
     { "OSMSG_ROUTINGPLAN_OPTION", "%s is set to %s" },
     { "OSMSG_ROUTINGPLAN_ACTIVE", "Auto routing is active, using plan '%s'." },
     { "OSMSG_ROUTING_ACTIVATION_ERROR", "There was an error activating the routing plan. Check for loops, and make sure the map includes my own uplink." },
     { "OSMSG_ROUTINGPLAN_OPTION_NOT_FOUND", "There is no routing plan option '%s'." },
     { "OSMSG_ROUTINGPLAN_OPTION_NOT_SET", "Option '%s' is not currently set." },
     { "OSMSG_ROUTINGPLAN_NAME",  "$b%s:$b" },
+    { "OSMSG_ROUTINGPLAN_LIST",  "$b%s$b" },
     { "OSMSG_ROUTINGPLAN_SERVER","      %s:%d <-- %s[%d/%s] (%s)" }, 
     { "OSMSG_ADDPLAN_SUCCESS", "Added new routing plan '%s'." },
     { "OSMSG_ADDPLAN_FAILED", "Could not add new plan '%s' (does it already exist?)." },
@@ -3701,21 +3703,34 @@ static MODCMD_FUNC(cmd_stats_routing_plans) {
     dict_iterator_t rpit;
     dict_iterator_t it;
     struct routingPlan *rp;
-    reply("OSMSG_ROUTINGPLAN_LIST");
-    reply("OSMSG_ROUTINGPLAN_BAR");
-    for(rpit = dict_first(opserv_routing_plans); rpit; rpit = iter_next(rpit)) {
-        const char* name = iter_key(rpit);
-        rp = iter_data(rpit);
-        reply("OSMSG_ROUTINGPLAN_NAME", name);
-        for(it = dict_first(rp->servers); it; it = iter_next(it)) {
-            const char* servername = iter_key(it);
-            struct routingPlanServer *rps = iter_data(it);
-            reply("OSMSG_ROUTINGPLAN_SERVER", servername, rps->port, rps->uplink, rps->karma, rps->offline? "offline" : "online", rps->secondaryuplink ? rps->secondaryuplink : "None");
-        }
+    if(argc > 1) {
+        reply("OSMSG_ROUTINGPLAN");
+        reply("OSMSG_ROUTINGPLAN_BAR");
+        for(rpit = dict_first(opserv_routing_plans); rpit; rpit = iter_next(rpit)) {
+            const char* name = iter_key(rpit);
+            rp = iter_data(rpit);
+            if(match_ircglob(name, argv[1])) {
+                reply("OSMSG_ROUTINGPLAN_NAME", name);
+                for(it = dict_first(rp->servers); it; it = iter_next(it)) {
+                    const char* servername = iter_key(it);
+                    struct routingPlanServer *rps = iter_data(it);
+                    reply("OSMSG_ROUTINGPLAN_SERVER", servername, rps->port, rps->uplink, rps->karma, rps->offline? "offline" : "online", rps->secondaryuplink ? rps->secondaryuplink : "None");
+                }
+            }
 
+        }
+        reply("OSMSG_ROUTINGPLAN_END");
+    }
+    else {
+        reply("OSMSG_ROUTINGPLAN_LIST_HEAD");
+        reply("OSMSG_ROUTINGPLAN_BAR");
+        for(rpit = dict_first(opserv_routing_plans); rpit; rpit = iter_next(rpit)) {
+            const char* name = iter_key(rpit);
+            reply("OSMSG_ROUTINGPLAN_LIST", name);
+        }
+        reply("OSMSG_ROUTINGPLAN_END");
+        route_show_options(cmd, user);
     }
-    reply("OSMSG_ROUTINGPLAN_END");
-    route_show_options(cmd, user);
     return 1;
 }
 
index 8f34ff0357fe7b3f61450fa8cb81dd2d45c0f08f..47442a9c04a97c1648903329c3e622902c1d4a0c 100644 (file)
@@ -92,7 +92,7 @@
             " $bROUTING MAP$b       Show what the active routing plan says the network should look like.",
             " $bREROUTE$b           Connect servers to the network, optionally squiting them first to change the routing.",
             " $b$b ",
-            " Start by creating a routing plan, and then adding servers to it, with their listning port, uplink, and a backup uplink. You can view it in $bSTATS ROUTING$b. Take care not to create loops, and that you make everything connected. Then set your new plan ACTIVE using $bROUTING SET$b. $O does the rest! See help topic $bROUTING EXAMPLE$b for a working example."
+            " Start by creating a routing plan, and then adding servers to it, with their listning port, uplink, and a backup uplink. You can view it in $bSTATS ROUTING planname$b. Take care not to create loops, and that you make everything connected. Then set your new plan ACTIVE using $bROUTING SET$b. $O does the rest! See help topic $bROUTING EXAMPLE$b for a working example."
             );
 
 "CHANNEL"  (
 "ROUTING ADDPLAN" ("/msg $O ROUTING ADDPLAN <name>",
         "Creates a new blank routing plan named name.",
         "You can then use $bROUTING ADDSERVER$b to build it.",
-        "Use $bSTATS ROUTING$b to view it, and $bROUTING SET ACTIVE$b to activate it.",
+        "Use $bSTATS ROUTING [name]$b to view it, and $bROUTING SET ACTIVE$b to activate it.",
         "$uSee Also:$u routing, stats routing, routing delplan, routing set, routing addserver"
         );
 "ROUTING DELPLAN" ("/msg $O ROUTING DELPLAN <name>",
         "$uSee also:$u routing, routing map, stats routing",
         );
 
-"STATS ROUTING" ("/msg $O STATS ROUTING",
+"STATS ROUTING" ("/msg $O STATS ROUTING [planmask]",
         "Provides information about The Auto Routing System's configuration. You can see the routing plans, and the current routing options.",
+        " If planmask is provided, you will see the full details for any plans matching the mask (* and ? wildcards)",
         "$uSee also:$u routing, routing set",
         );