Revision: 1922
          
http://undernet-ircu.svn.sourceforge.net/undernet-ircu/?rev=1922&view=rev
Author:   entrope
Date:     2010-01-02 04:00:13 +0000 (Sat, 02 Jan 2010)

Log Message:
-----------
Provide /stats F to report even defaulted feature values.
(Apply patch #2693259, inspired by a Quakenet patch by paulr.)

Modified Paths:
--------------
    ircu2/branches/u2_10_12_branch/ChangeLog
    ircu2/branches/u2_10_12_branch/ircd/ircd_features.c
    ircu2/branches/u2_10_12_branch/ircd/s_stats.c

Modified: ircu2/branches/u2_10_12_branch/ChangeLog
===================================================================
--- ircu2/branches/u2_10_12_branch/ChangeLog    2009-08-01 01:06:19 UTC (rev 
1921)
+++ ircu2/branches/u2_10_12_branch/ChangeLog    2010-01-02 04:00:13 UTC (rev 
1922)
@@ -1,3 +1,11 @@
+2010-01-01  Michael Poole <[email protected]>
+
+       * ircd/ircd_features.c (feature_report): If sd->sd_funcdata is
+       non-zero, report even unchanged features (using prefix 'f').
+
+       * ircd/s_stats.c (statsinfo): Make "/stats f" case-sensitive, and
+       use the upper case variant to report all features.
+
 2009-07-30  Michael Poole <[email protected]>
 
        * ircd/s_user.c (register_user): Move the default-usermodes call

Modified: ircu2/branches/u2_10_12_branch/ircd/ircd_features.c
===================================================================
--- ircu2/branches/u2_10_12_branch/ircd/ircd_features.c 2009-08-01 01:06:19 UTC 
(rev 1921)
+++ ircu2/branches/u2_10_12_branch/ircd/ircd_features.c 2010-01-02 04:00:13 UTC 
(rev 1922)
@@ -41,6 +41,7 @@
 #include "s_bsd.h"
 #include "s_debug.h"
 #include "s_misc.h"
+#include "s_stats.h"
 #include "send.h"
 #include "struct.h"
 #include "sys.h"    /* FALSE bleah */
@@ -819,6 +820,8 @@
 void
 feature_report(struct Client* to, const struct StatDesc* sd, char* param)
 {
+  char changed;
+  int report;
   int i;
 
   for (i = 0; features[i].type; i++) {
@@ -827,33 +830,36 @@
        (features[i].flags & FEAT_OPER && !IsAnOper(to)))
       continue; /* skip this one */
 
+    changed = (features[i].flags & FEAT_MARK) ? 'F' : 'f';
+    report = (features[i].flags & FEAT_MARK) || sd->sd_funcdata;
+
     switch (features[i].flags & FEAT_MASK) {
     case FEAT_NONE:
       if (features[i].report) /* let the callback handle this */
-       (*features[i].report)(to, features[i].flags & FEAT_MARK ? 1 : 0);
+       (*features[i].report)(to, report);
       break;
 
 
     case FEAT_INT: /* Report an F-line with integer values */
-      if (features[i].flags & FEAT_MARK) /* it's been changed */
-       send_reply(to, SND_EXPLICIT | RPL_STATSFLINE, "F %s %d",
-                  features[i].type, features[i].v_int);
+      if (report) /* it's been changed */
+       send_reply(to, SND_EXPLICIT | RPL_STATSFLINE, "%c %s %d",
+                  changed, features[i].type, features[i].v_int);
       break;
 
     case FEAT_BOOL: /* Report an F-line with boolean values */
-      if (features[i].flags & FEAT_MARK) /* it's been changed */
-       send_reply(to, SND_EXPLICIT | RPL_STATSFLINE, "F %s %s",
-                  features[i].type, features[i].v_int ? "TRUE" : "FALSE");
+      if (report) /* it's been changed */
+       send_reply(to, SND_EXPLICIT | RPL_STATSFLINE, "%c %s %s",
+                  changed, features[i].type, features[i].v_int ? "TRUE" : 
"FALSE");
       break;
 
     case FEAT_STR: /* Report an F-line with string values */
-      if (features[i].flags & FEAT_MARK) { /* it's been changed */
+      if (report) { /* it's been changed */
        if (features[i].v_str)
-         send_reply(to, SND_EXPLICIT | RPL_STATSFLINE, "F %s %s",
-                    features[i].type, features[i].v_str);
+         send_reply(to, SND_EXPLICIT | RPL_STATSFLINE, "%c %s %s",
+                    changed, features[i].type, features[i].v_str);
        else /* Actually, F:<type> would reset it; you want F:<type>: */
-         send_reply(to, SND_EXPLICIT | RPL_STATSFLINE, "F %s",
-                    features[i].type);
+         send_reply(to, SND_EXPLICIT | RPL_STATSFLINE, "%c %s",
+                    changed, features[i].type);
       }
       break;
     }

Modified: ircu2/branches/u2_10_12_branch/ircd/s_stats.c
===================================================================
--- ircu2/branches/u2_10_12_branch/ircd/s_stats.c       2009-08-01 01:06:19 UTC 
(rev 1921)
+++ ircu2/branches/u2_10_12_branch/ircd/s_stats.c       2010-01-02 04:00:13 UTC 
(rev 1922)
@@ -544,9 +544,12 @@
   { 'e', "engine", STAT_FLAG_OPERFEAT, FEAT_HIS_STATS_e,
     stats_engine, 0,
     "Report server event loop engine." },
-  { 'f', "features", STAT_FLAG_OPERFEAT, FEAT_HIS_STATS_f,
+  { 'f', "features", (STAT_FLAG_OPERFEAT | STAT_FLAG_CASESENS), 
FEAT_HIS_STATS_f,
     feature_report, 0,
     "Feature settings." },
+  { 'F', "featuresall", (STAT_FLAG_OPERFEAT | STAT_FLAG_CASESENS), 
FEAT_HIS_STATS_f,
+    feature_report, 1,
+    "All feature settings, including defaulted values." },
   { 'g', "glines", STAT_FLAG_OPERFEAT, FEAT_HIS_STATS_g,
     gline_stats, 0,
     "Global bans (G-lines)." },


This was sent by the SourceForge.net collaborative development platform, the 
world's largest Open Source development site.
_______________________________________________
Patches mailing list
[email protected]
http://undernet.sbg.org/mailman/listinfo/patches

Reply via email to