]> jfr.im git - irc/quakenet/newserv.git/commitdiff
Added summary information to chanlev.
authorsplidge <redacted>
Mon, 10 Mar 2008 11:54:51 +0000 (11:54 +0000)
committersplidge <redacted>
Mon, 10 Mar 2008 11:54:51 +0000 (11:54 +0000)
Fixed core bug in suspendlist (it didn't like null suspend reasons)

chanserv/chancmds/chanlev.c
chanserv/chanserv.c
chanserv/chanserv.h
chanserv/database/chanservdb_messages.c
chanserv/usercmds/suspenduserlist.c

index 8acfeaa72558e40d51c3ad8c96a2dd2897bd35c7..fd7b303af2a22576ddcf13ec6bcfe803692bed6e 100644 (file)
@@ -133,6 +133,8 @@ int csc_dochanlev(void *source, int cargc, char **cargv) {
   
   if (cargc==1) {
     /* One arg: list chanlev */
+    int ncnt=0,mcnt=0,ocnt=0,vcnt=0,kcnt=0,bcnt=0;
+    
     if (cs_privcheck(QPRIV_VIEWFULLCHANLEV, sender)) {
       reguser *founder=NULL, *addedby=NULL;
       addedby=findreguserbyID(rcp->addedby);
@@ -177,6 +179,16 @@ int csc_dochanlev(void *source, int cargc, char **cargv) {
         flags=rcuplist->flags & (flagmask | QCUFLAGS_PERSONAL);
       }
       
+      /* Do the count here; note that +n's aren't counted as +m (and so on).  We're not
+       * using the IsX() macros because the displayed count needs to match up with 
+       * the displayed flags... */
+      if (flags & QCUFLAG_OWNER) ncnt++; else
+      if (flags & QCUFLAG_MASTER) mcnt++; else
+      if (flags & QCUFLAG_OP) ocnt++; else
+      if (flags & QCUFLAG_VOICE) vcnt++; else
+      if (flags & QCUFLAG_KNOWN) kcnt++;
+      if (flags & QCUFLAG_BANNED) bcnt++;
+      
       if (!donehead) {
        chanservstdmessage(sender, QM_CHANLEVHEADER, cip->name->content);
        if (showtimes) 
@@ -207,6 +219,7 @@ int csc_dochanlev(void *source, int cargc, char **cargv) {
     
     if (donehead) {
       chanservstdmessage(sender, QM_ENDOFLIST);
+      chanservstdmessage(sender, QM_CHANLEVSUMMARY, j, ncnt, mcnt, ocnt, vcnt, kcnt, bcnt);
     } else {
       chanservstdmessage(sender, QM_NOUSERSONCHANLEV, cip->name->content);
     }
index bf5cee9d7ed5e19545d5c4cef9de96daad500add..fea8dfd0f6e87905d76454ffa053dacf7bf6732a 100644 (file)
@@ -111,7 +111,8 @@ void _init() {
     chanservaddcommand("quit", QCMD_DEV, 1, cs_doquit, "Makes the bot QUIT and \"reconnect\".","");
     chanservaddcommand("rename", QCMD_DEV, 1, cs_dorename, "Changes the bot's name.","");
     chanservaddcommand("rehash", QCMD_DEV, 0, cs_dorehash, "Reloads all text from database.","");
-    chanservaddcommand("help", 0, 1, cs_dohelp, "Displays help on a specific command.","Usage: HELP <command>\nShows help for a command, where:\ncommand - the command to show help for.\nFor a list of available commands, see SHOWCOMMANDS.\n");
+    /* Make "HELP" take 2 arguments so things like "HELP chanflags #channel" work.  Any junk after the command will go into arg 2 and be ignored. */
+    chanservaddcommand("help", 0, 2, cs_dohelp, "Displays help on a specific command.","Usage: HELP <command>\nShows help for a command, where:\ncommand - the command to show help for.\nFor a list of available commands, see SHOWCOMMANDS.\n");
     chanservaddcommand("version", 0, 1, cs_doversion, "Show Version.","Usage: VERSION\nShows the version number of the running bot.");
 
     chanservaddctcpcommand("ping",cs_doctcpping);
index 0bfb628bccfcf4c1269c9830cc85199ff9218b61..c8bb4b0da3894beb91dec2e405a39c98f0166a32 100644 (file)
 #define QM_RESETOK                 166
 #define QM_BADRESETCODE            167
 #define QM_CHALLENGEDDEPRECATED    168
+#define QM_CHANLEVSUMMARY          169
 
 /* List of privileged operations */
 
index e8ed9f4b374bb5356902670ad3ed5e01b356b0c7..10f4c421f28705284786fc4810d1e6efd53d6d59 100644 (file)
@@ -177,6 +177,7 @@ char *defaultmessages[MAXMESSAGES] = {
   /* 166*/ "Your old account settings have been restored, please check your email.",
   /* 167*/ "Bad reset code.",
   /* 168*/ "WARNING: the selected algorithm is legacy functionality and is likely to be removed in the near future.",
+  /* 169*/ "Total: %d (owner: %d, master: %d, op: %d, voice: %d, known: %d, ban: %d)."
 };
 
 void initmessages() {
index 4d1878ccaf6aed32ac3400a8ec3ac8627b79b5ae..3cc160444222d196b3771e1f2d3a873798edbfe7 100644 (file)
@@ -75,7 +75,7 @@ int csu_dosuspenduserlist(void *source, int cargc, char **cargv) {
         strftime(buf2,15,"%d/%m/%y %H:%M",tmp);
 
         count++;
-        chanservsendmessage(sender, "%-15s %-13s %-15s %-15s %-15s %s", dbrup->username, suspendtype, UHasOperPriv(rup)?(bywhom?bywhom:"unknown"):"not shown", buf2, (dbrup->suspendexp)?((time(0) >= dbrup->suspendexp)?"next auth":buf):"never", dbrup->suspendreason->content);
+        chanservsendmessage(sender, "%-15s %-13s %-15s %-15s %-15s %s", dbrup->username, suspendtype, UHasOperPriv(rup)?(bywhom?bywhom:"unknown"):"not shown", buf2, (dbrup->suspendexp)?((time(0) >= dbrup->suspendexp)?"next auth":buf):"never", dbrup->suspendreason?dbrup->suspendreason->content:"(none)");
         if (count >= 2000) {
           chanservstdmessage(sender, QM_TOOMANYRESULTS, 2000, "users");
           return CMD_ERROR;