From 1dc79accfc474f80ac0261d260b4b4eebd98356e Mon Sep 17 00:00:00 2001 From: codemastr Date: Fri, 2 Mar 2001 00:55:57 +0000 Subject: [PATCH] added a bunch of /stats flags --- Changes | 1 + src/s_err.c | 4 +-- src/s_serv.c | 85 +++++++++++++++++++++++++++++++++++++++------------- 3 files changed, 68 insertions(+), 22 deletions(-) diff --git a/Changes b/Changes index ff028c875..4ca1b6005 100644 --- a/Changes +++ b/Changes @@ -281,3 +281,4 @@ - Fixed a deny version {} bug (oops) - Fixed a config_load win32 problem, found by Zogg, fixed by Stskeeps/codemastr - Overwrote s_conf.c with s_conf2.c, and removed s_conf2.c. Viva la Conf2! +- Added /stats I, Y, b, d, D, v diff --git a/src/s_err.c b/src/s_err.c index 4378e502f..5633bc8c5 100644 --- a/src/s_err.c +++ b/src/s_err.c @@ -248,10 +248,10 @@ static char *replies[] = { #endif /* 213 RPL_STATSCLINE */ ":%s 213 %s %c %s * %s %d %d %s", /* 214 RPL_STATSOLDNLINE */ ":%s 214 %s %c %s * %s %d %d %s", -/* 215 RPL_STATSILINE */ ":%s 215 %s %c %s * %s %d %d", +/* 215 RPL_STATSILINE */ ":%s 215 %s I %s * %s %d %s", /* 216 RPL_STATSKLINE */ ":%s 216 %s %s %s %s", /* 217 RPL_STATSQLINE */ ":%s 217 %s Q %s %s", -/* 218 RPL_STATSYLINE */ ":%s 218 %s %c %d %d %d %d %ld", +/* 218 RPL_STATSYLINE */ ":%s 218 %s Y %s %d %d %d %ld", /* 219 RPL_ENDOFSTATS */ ":%s 219 %s %c :End of /STATS report", /* 220 RPL_STATSBLINE */ ":%s 220 %s %c %s %s %s %d %d", /* 221 RPL_UMODEIS */ ":%s 221 %s %s", diff --git a/src/s_serv.c b/src/s_serv.c index f8ae97652..d781c7075 100644 --- a/src/s_serv.c +++ b/src/s_serv.c @@ -2298,24 +2298,6 @@ int m_watch(cptr, sptr, parc, parv) return 0; } - - - - -/* -** m_stats -** parv[0] = sender prefix -** parv[1] = statistics selector (defaults to Message frequency) -** parv[2] = server name (current server defaulted, if omitted) -** -*/ -/* -** Note: The info is reported in the order the server uses -** it--not reversed as in ircd.conf! -*/ - - - char *get_cptr_status(aClient *acptr) { static char buf[10]; @@ -2367,6 +2349,19 @@ char *get_client_name2(aClient *acptr, int showports) return pointer; } + +/* +** m_stats +** parv[0] = sender prefix +** parv[1] = statistics selector (defaults to Message frequency) +** parv[2] = server name (current server defaulted, if omitted) +** +*/ +/* +** Note: The info is reported in the order the server uses +** it--not reversed as in ircd.conf! +*/ + int m_stats(cptr, sptr, parc, parv) aClient *cptr, *sptr; int parc; @@ -2420,9 +2415,18 @@ int m_stats(cptr, sptr, parc, parv) switch (stat) { #ifdef STRIPBADWORDS - case 'b': - badwords_stats(); + case 'b': + { + ConfigItem_badword *words; + + for (words = conf_badword_channel; words; words = (ConfigItem_badword *) words->next) { + sendto_one(sptr, ":%s %i %s :c %s %s", me.name, RPL_TEXT, sptr->name, words->word, words->replace ? words->replace : ""); + } + for (words = conf_badword_message; words; words = (ConfigItem_badword *) words->next) { + sendto_one(sptr, ":%s %i %s :m %s %s", me.name, RPL_TEXT, sptr->name, words->word, words->replace ? words->replace : ""); + } break; + } #endif case 'L': case 'l': @@ -2549,7 +2553,14 @@ int m_stats(cptr, sptr, parc, parv) break; case 'I': case 'i': + { + ConfigItem_allow *allows; + for (allows = conf_allow; allows; allows = (ConfigItem_allow *) allows->next) { + sendto_one(sptr, rpl_str(RPL_STATSILINE), me.name, + parv[0], allows->ip, allows->hostname, allows->maxperip, allows->class->name); + } break; + } case 'E': { ConfigItem_except *excepts; @@ -2713,9 +2724,27 @@ int m_stats(cptr, sptr, parc, parv) report_dynconf(sptr); break; case 'D': + { + ConfigItem_deny_link *links; + + for (links = conf_deny_link; links; links = (ConfigItem_deny_link *) links->next) { + if (links->flag.type == CRULE_ALL) + sendto_one(sptr, rpl_str(RPL_STATSDLINE), me.name, sptr->name, + "D", links->mask, links->prettyrule); + } break; + } case 'd': + { + ConfigItem_deny_link *links; + + for (links = conf_deny_link; links; links = (ConfigItem_deny_link *) links->next) { + if (links->flag.type == CRULE_AUTO) + sendto_one(sptr, rpl_str(RPL_STATSDLINE), me.name, sptr->name, + "d", links->mask, links->prettyrule); + } break; + } case 'r': /* FIXME: cr_report(sptr); */ @@ -2758,7 +2787,15 @@ int m_stats(cptr, sptr, parc, parv) break; } case 'v': + { + ConfigItem_deny_version *versions; + + for (versions = conf_deny_version; versions; versions = (ConfigItem_deny_version *) versions->next) { + sendto_one(sptr, rpl_str(RPL_STATSVLINE), me.name, sptr->name, + versions->version, versions->flags, versions->mask); + } break; + } case 'V': break; case 'W': @@ -2779,7 +2816,15 @@ int m_stats(cptr, sptr, parc, parv) break; case 'Y': case 'y': + { + ConfigItem_class *classes; + for (classes = conf_class; classes; classes = (ConfigItem_class *) classes->next) { + sendto_one(sptr, rpl_str(RPL_STATSYLINE), + me.name, sptr->name, classes->name, classes->pingfreq, classes->connfreq, + classes->maxclients, classes->sendq); + } break; + } case 'Z': case 'z': if (IsAnOper(sptr))