Reed Loden's patch to add /stats J, listing nick jupes. (Plus documentation.)
authorMichael Poole <mdpoole@troilus.org>
Wed, 30 Mar 2005 03:48:22 +0000 (03:48 +0000)
committerMichael Poole <mdpoole@troilus.org>
Wed, 30 Mar 2005 03:48:22 +0000 (03:48 +0000)
git-svn-id: file:///home/klmitch/undernet-ircu/undernet-ircu-svn/ircu2/trunk@1343 c9e4aea6-c8fd-4c43-8297-357d70d61c8c

ChangeLog
doc/example.conf
doc/readme.features
include/hash.h
include/ircd_features.h
include/numeric.h
ircd/hash.c
ircd/ircd_features.c
ircd/s_err.c
ircd/s_stats.c

index 8f660ef25eed2100f9262501a1b0ce28844ab455..08001ccf914f2e3acb78e0bbfd0c5d847ae03cc5 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,32 @@
+2005-03-29  Michael Poole <mdpoole@troilus.org>
+
+       * doc/example.conf: Add HIS_STATS_J entry.
+
+       * doc/readme.features: Likewise.
+
+2005-03-25  Reed Loden <reed@reedloden.com>
+
+       * 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 <mdpoole@troilus.org>
 
        * ircd/m_burst.c (ms_burst): Do not send numeric oplevels in a -A
index b9c5d7883c7a7c093f13edd816ba4ff9c5cddc36..31cf5f4320b3386598fd41255a1a5e0846063142 100644 (file)
@@ -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";
index 17bda8cdcee07aedc0b710bc4936f6ef47bc9823..c0761d2434969d15349f0414606972f06ef1b0a2 100644 (file)
@@ -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
index 62f4770918c6527723e1a54feb373fdd1ee0a72b..e702e63bd29a7bb3c93dcb573aa24136c0deee21 100644 (file)
@@ -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 */
index 92bfd73b88a2b6ca76a9ef0b68513fed6d4ea0e5..1c24c30d297b55664ce5f38fd7733f712456ec9f 100644 (file)
@@ -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,
index 828156d00e0da782382aa0c94525e1ea7ba7d281..5ca0458441c1099fcc8f4baee47e2f510c57fd11 100644 (file)
@@ -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 */
index de8e8b362c7cf309846216e35e6410c0ff96152f..571a5023da922a46c581922a7f49f0a90081e14b 100644 (file)
@@ -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.
  */
index dff5125088c9ad38b8ba5c8c149aadaf0dce79aa..ce9851f60e678d03a03f14dcb27f8d2ca9cc9bcc 100644 (file)
@@ -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),
index 7c0c91532cc3563845e2664415053b043180b08e..6a55cf5a0c00ed69d4f57145b98ad3837be8000d 100644 (file)
@@ -476,7 +476,7 @@ static Numeric replyTable[] = {
 /* 221 */
   { RPL_UMODEIS, "%s", "221" },
 /* 222 */
-  { 0 },
+  { RPL_STATSJLINE, "J %s", "222" },
 /* 223 */
   { 0 },
 /* 224 */
index 3d536944429f12eb277def6bc48cc3939b8242e2..190e8dbbbf36ced95679ad09f01afcd82a1129cc 100644 (file)
@@ -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." },