]> jfr.im git - irc/quakenet/newserv.git/commitdiff
Changed the chanlev response messages a bit.
authorsplidge <redacted>
Wed, 12 Mar 2008 10:33:56 +0000 (10:33 +0000)
committersplidge <redacted>
Wed, 12 Mar 2008 10:33:56 +0000 (10:33 +0000)
Added custom messages for "chanlev changed to:" "chanlev removed" and "nothing changed" and made chanlev send them as necessary.  Should avoid confusion caused by the old message scheme.

Also removed the little bugette where you could leak chanservusers by trying to add someone with no flags (or some illegal mixture like +ag)

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

index 8c746170780677414fe1923baaa02903e62947b4..4450de346f9a405373c6b7bdb2f69f391b8db401 100644 (file)
@@ -313,11 +313,14 @@ int csc_dochanlev(void *source, int cargc, char **cargv) {
        rcuplist->changetime=time(NULL);
 
       if(rcuplist->flags == oldflags) {
-        chanservstdmessage(sender, QM_DONE);
+        chanservstdmessage(sender, QM_CHANLEVNOCHANGE);
+        if (newuser) {
+          freeregchanuser(rcuplist);
+          rcuplist=NULL;
+        }
         return CMD_OK;
       }
 
-
       strcpy(flagbuf,printflags(oldflags,rcuflags));
       cs_log(sender,"CHANLEV %s #%s %s (%s -> %s)",cip->name->content,rcuplist->user->username,cargv[2],
             flagbuf,printflags(rcuplist->flags,rcuflags));
@@ -332,9 +335,12 @@ int csc_dochanlev(void *source, int cargc, char **cargv) {
        } else {
          csdb_updatechanuser(rcuplist);
        }
+       chanservstdmessage(sender, QM_CHANLEVCHANGED, cargv[1], cip->name->content, 
+                           printflags(rcuplist->flags & flagmask, rcuflags));
       } else {
        /* User has no flags: delete */
        if (!newuser) {
+         chanservstdmessage(sender, QM_CHANLEVREMOVED, cargv[1], cip->name->content);
          csdb_deletechanuser(rcuplist);
          delreguserfromchannel(rcp, target);
        }
@@ -345,18 +351,17 @@ int csc_dochanlev(void *source, int cargc, char **cargv) {
           return CMD_OK;
         }
       }
-
-      /* Say we've done it */
-      chanservstdmessage(sender, QM_DONE);
+      
+      /* Update the channel if needed */
       rcp->status |= QCSTAT_OPCHECK;
       cs_timerfunc(cip);
-    }
-    
-    if (rcuplist && (rcuplist->flags & flagmask)) {
-      chanservstdmessage(sender, QM_CHANUSERFLAGS, cargv[1], cip->name->content, 
-                        printflags(rcuplist->flags & flagmask, rcuflags));
     } else {
-      chanservstdmessage(sender, QM_CHANUSERUNKNOWN, cargv[1], cip->name->content);
+      if (rcuplist && (rcuplist->flags & flagmask)) {
+        chanservstdmessage(sender, QM_CHANUSERFLAGS, cargv[1], cip->name->content, 
+                           printflags(rcuplist->flags & flagmask, rcuflags));
+      } else {
+        chanservstdmessage(sender, QM_CHANUSERUNKNOWN, cargv[1], cip->name->content);
+      }
     }
   }
   
index c0c85f8279298819a8e5dca23ab86f07a3df17e0..6fb773f8a03923a91fc64ea93add40a1582a855d 100644 (file)
 #define QM_OTHERUSERAUTHED         179
 #define QM_STATSRESET              180
 #define QM_CHANLEVEMPTIEDCHANNEL   181
+#define QM_CHANLEVCHANGED          182
+#define QM_CHANLEVREMOVED          183
+#define QM_CHANLEVNOCHANGE         184
 
 /* List of privileged operations */
 
index a0f024d76f26e6b7b66d85e79d2030338acd796b..40b4954a8a92af9e81d7011405f0b39adb0c003d 100644 (file)
@@ -189,7 +189,10 @@ char *defaultmessages[MAXMESSAGES] = {
   /* 178*/ "Warning: %s (%s@%s) attempted to auth with your password but you already had %d users authed to your account.",
   /* 179*/ "Warning: %s (%s@%s) authed with your password.",
   /* 180*/ "Resettable statistics reset for %s.",
-  /* 181*/ "The channel has been deleted since the last known user was removed."
+  /* 181*/ "The channel has been deleted since the last known user was removed.",
+  /* 182*/ "Done.  Flags for %s on %s are now: %s.",
+  /* 183*/ "Done.  User %s is no longer known on %s.",
+  /* 184*/ "No change - check that you didn't specify an impossible flag combination."
 };
 
 void initmessages() {