From e2de9ea6df9a1f929d40c2c920182099638853a8 Mon Sep 17 00:00:00 2001 From: Michael Poole Date: Wed, 30 Mar 2005 03:48:22 +0000 Subject: [PATCH] Reed Loden's patch to add /stats J, listing nick jupes. (Plus documentation.) git-svn-id: file:///home/klmitch/undernet-ircu/undernet-ircu-svn/ircu2/trunk@1343 c9e4aea6-c8fd-4c43-8297-357d70d61c8c --- ChangeLog | 29 +++++++++++++++++++++++++++++ doc/example.conf | 1 + doc/readme.features | 6 ++++++ include/hash.h | 3 +++ include/ircd_features.h | 1 + include/numeric.h | 3 ++- ircd/hash.c | 14 ++++++++++++++ ircd/ircd_features.c | 1 + ircd/s_err.c | 2 +- ircd/s_stats.c | 8 ++++++-- 10 files changed, 64 insertions(+), 4 deletions(-) diff --git a/ChangeLog b/ChangeLog index 8f660ef..08001cc 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,32 @@ +2005-03-29 Michael Poole + + * doc/example.conf: Add HIS_STATS_J entry. + + * doc/readme.features: Likewise. + +2005-03-25 Reed Loden + + * include/hash.h: Add needed prototypes for new + stats_nickjupes() function. + + * include/ircd_features.h: Add FEAT_HIS_STATS_J. + + * include/numeric.h: Add RPL_STATSJLINE (222) for new nick + jupes stats. Correct a typo in a comment. + + * ircd/hash.c: Add stats_nickjupes() function to report all + nick jupes to an oper. Because of the nature of hash tables, + there is no way to sort this list so the results look weird. + + * ircd/ircd_features.c: Add FEAT_HIS_STATS_J (default: TRUE). + + * ircd/s_err.c: Add RPL_STATSJLINE (222) for new nick jupes + stats. + + * ircd/s_stats.c: Add RPL_STATSJLINE (222) for new nick jupes + stats. Make 'j' case sensitive. Modify the comment for stats + uworld. + 2005-03-27 Michael Poole * ircd/m_burst.c (ms_burst): Do not send numeric oplevels in a -A diff --git a/doc/example.conf b/doc/example.conf index b9c5d78..31cf5f4 100644 --- a/doc/example.conf +++ b/doc/example.conf @@ -821,6 +821,7 @@ features # "HIS_STATS_h" = "TRUE"; # "HIS_STATS_i" = "TRUE"; # "HIS_STATS_j" = "TRUE"; +# "HIS_STATS_J" = "TRUE"; # "HIS_STATS_k" = "TRUE"; # "HIS_STATS_l" = "TRUE"; # "HIS_STATS_L" = "TRUE"; diff --git a/doc/readme.features b/doc/readme.features index 17bda8c..c0761d2 100644 --- a/doc/readme.features +++ b/doc/readme.features @@ -549,6 +549,12 @@ HIS_STATS_j As per UnderNet CFV-165, this removes /STATS j from users. +HIS_STATS_J + * Type: boolean + * Default: TRUE + +As per UnderNet CFV-165, this removes /STATS J from users. + HIS_STATS_M * Type: boolean * Default: TRUE diff --git a/include/hash.h b/include/hash.h index 62f4770..e702e63 100644 --- a/include/hash.h +++ b/include/hash.h @@ -26,6 +26,7 @@ struct Client; struct Channel; +struct StatDesc; /* * general defines @@ -87,6 +88,8 @@ extern int m_hash(struct Client *cptr, struct Client *sptr, int parc, char *parv extern int isNickJuped(const char *nick); extern int addNickJupes(const char *nicks); extern void clearNickJupes(void); +extern void stats_nickjupes(struct Client* to, const struct StatDesc* sd, + char* param); extern void list_next_channels(struct Client *cptr); #endif /* INCLUDED_hash_h */ diff --git a/include/ircd_features.h b/include/ircd_features.h index 92bfd73..1c24c30 100644 --- a/include/ircd_features.h +++ b/include/ircd_features.h @@ -113,6 +113,7 @@ enum Feature { FEAT_HIS_STATS_f, FEAT_HIS_STATS_i, FEAT_HIS_STATS_j, + FEAT_HIS_STATS_J, FEAT_HIS_STATS_M, FEAT_HIS_STATS_m, FEAT_HIS_STATS_o, diff --git a/include/numeric.h b/include/numeric.h index 828156d..5ca0458 100644 --- a/include/numeric.h +++ b/include/numeric.h @@ -92,7 +92,7 @@ extern const struct Numeric* get_error_numeric(int err); #define RPL_STATSNLINE 214 /* unused */ #define RPL_STATSILINE 215 #define RPL_STATSKLINE 216 -#define RPL_STATSPLINE 217 /* Undernet extenstion */ +#define RPL_STATSPLINE 217 /* Undernet extension */ /* RPL_STATSQLINE 217 Various */ #define RPL_STATSYLINE 218 #define RPL_ENDOFSTATS 219 /* See also RPL_STATSDLINE */ @@ -101,6 +101,7 @@ extern const struct Numeric* get_error_numeric(int err); /* RPL_STATSBLINE 220 Numerics List: Dalnet,unreal */ #define RPL_UMODEIS 221 /* RPL_SQLINE_NICK 222 Numerics List: Dalnet */ +#define RPL_STATSJLINE 222 /* Undernet extension */ /* RPL_STATSELINE 223 dalnet */ /* RPL_STATSGLINE 223 unreal */ /* RPL_STATSFLINE 224 Hybrid extension,Dalnet */ diff --git a/ircd/hash.c b/ircd/hash.c index de8e8b3..571a502 100644 --- a/ircd/hash.c +++ b/ircd/hash.c @@ -408,6 +408,20 @@ void clearNickJupes(void) jupeTable[i][0] = '\000'; } +/** Report all nick jupes to a user. + * @param[in] to Client requesting statistics. + * @param[in] sd Stats descriptor for request (ignored). + * @param[in] param Extra parameter from user (ignored). + */ +void +stats_nickjupes(struct Client* to, const struct StatDesc* sd, char* param) +{ + int i; + for (i = 0; i < JUPEHASHSIZE; i++) + if (jupeTable[i][0]) + send_reply(to, RPL_STATSJLINE, jupeTable[i]); +} + /** Send more channels to a client in mid-LIST. * @param[in] cptr Client to send the list to. */ diff --git a/ircd/ircd_features.c b/ircd/ircd_features.c index dff5125..ce9851f 100644 --- a/ircd/ircd_features.c +++ b/ircd/ircd_features.c @@ -352,6 +352,7 @@ static struct FeatureDesc { F_B(HIS_STATS_f, 0, 1, 0), F_B(HIS_STATS_i, 0, 1, 0), F_B(HIS_STATS_j, 0, 1, 0), + F_B(HIS_STATS_J, 0, 1, 0), F_B(HIS_STATS_M, 0, 1, 0), F_B(HIS_STATS_m, 0, 1, 0), F_B(HIS_STATS_o, 0, 1, 0), diff --git a/ircd/s_err.c b/ircd/s_err.c index 7c0c915..6a55cf5 100644 --- a/ircd/s_err.c +++ b/ircd/s_err.c @@ -476,7 +476,7 @@ static Numeric replyTable[] = { /* 221 */ { RPL_UMODEIS, "%s", "221" }, /* 222 */ - { 0 }, + { RPL_STATSJLINE, "J %s", "222" }, /* 223 */ { 0 }, /* 224 */ diff --git a/ircd/s_stats.c b/ircd/s_stats.c index 3d53694..190e8db 100644 --- a/ircd/s_stats.c +++ b/ircd/s_stats.c @@ -24,6 +24,7 @@ #include "class.h" #include "client.h" #include "gline.h" +#include "hash.h" #include "ircd.h" #include "ircd_chattr.h" #include "ircd_events.h" @@ -523,9 +524,12 @@ struct StatDesc statsinfo[] = { { 'i', "access", (STAT_FLAG_OPERFEAT | STAT_FLAG_VARPARAM), FEAT_HIS_STATS_i, stats_access, CONF_CLIENT, "Connection authorization lines." }, - { 'j', "histogram", STAT_FLAG_OPERFEAT, FEAT_HIS_STATS_j, + { 'j', "histogram", (STAT_FLAG_OPERFEAT | STAT_FLAG_CASESENS), FEAT_HIS_STATS_j, msgq_histogram, 0, "Message length histogram." }, + { 'J', "jupes", (STAT_FLAG_OPERFEAT | STAT_FLAG_CASESENS), FEAT_HIS_STATS_J, + stats_nickjupes, 0, + "Nickname jupes." }, { 'k', "klines", (STAT_FLAG_OPERFEAT | STAT_FLAG_VARPARAM), FEAT_HIS_STATS_k, stats_klines, 0, "Local bans (K-Lines)." }, @@ -565,7 +569,7 @@ struct StatDesc statsinfo[] = { "Local connection statistics (Total SND/RCV, etc)." }, { 'U', "uworld", (STAT_FLAG_OPERFEAT | STAT_FLAG_CASESENS), FEAT_HIS_STATS_U, stats_configured_links, CONF_UWORLD, - "Service server & nick jupes information." }, + "Service server information." }, { 'u', "uptime", (STAT_FLAG_OPERFEAT | STAT_FLAG_CASESENS), FEAT_HIS_STATS_u, stats_uptime, 0, "Current uptime & highest connection count." }, -- 2.20.1