From: rubin Date: Sat, 9 Dec 2006 07:10:46 +0000 (+0000) Subject: improve stats routing command X-Git-Tag: 1.9~425 X-Git-Url: https://jfr.im/git/irc/evilnet/x3.git/commitdiff_plain/5c6bff847f4904432e77dc856945f7d36669e444 improve stats routing command --- diff --git a/ChangeLog b/ChangeLog index 825bf1b..2788b6a 100644 --- a/ChangeLog +++ b/ChangeLog @@ -4,15 +4,20 @@ 2006-12-09 Alex Schumann * 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 * src/opserv.c: Moving some version reply housekeeping to proto-p10.c diff --git a/src/opserv.c b/src/opserv.c index 259e1af..ad1e0c2 100644 --- a/src/opserv.c +++ b/src/opserv.c @@ -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; } diff --git a/src/opserv.help b/src/opserv.help index 8f34ff0..47442a9 100644 --- a/src/opserv.help +++ b/src/opserv.help @@ -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" ( @@ -710,7 +710,7 @@ "ROUTING ADDPLAN" ("/msg $O ROUTING ADDPLAN ", "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 ", @@ -793,8 +793,9 @@ "$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", );