]> jfr.im git - irc/quakenet/newserv.git/commitdiff
CHANSERV: tidy up suspenduser by removing -email/-password functionality.
authorChris Porter <redacted>
Sun, 15 Feb 2009 20:56:10 +0000 (20:56 +0000)
committerChris Porter <redacted>
Sun, 15 Feb 2009 20:56:10 +0000 (20:56 +0000)
Tidy up messages in suspenduser/unsuspenduser.

chanserv/usercmds/suspenduser.c
chanserv/usercmds/unsuspenduser.c

index 0d2b32abffe017146b3e9f2543f1c264c92e056b..59611b07ed93763c64197659e34499a5a3cce2ae 100644 (file)
@@ -4,17 +4,14 @@
  * CMDNAME: suspenduser
  * CMDLEVEL: QCMD_OPER
  * CMDARGS: 1
- * CMDDESC: Suspend/Delay GLINE/Instantly GLINE a user.
+ * CMDDESC: Suspend/delay GLINE/instantly GLINE a user.
  * CMDFUNC: csu_dosuspenduser
  * CMDPROTO: int csu_dosuspenduser(void *source, int cargc, char **cargv);
  * CMDHELP: Usage: suspenduser <username> [<duration>] <reason>
  * CMDHELP:                    -nokill <username> [<duration>] <reason>
  * CMDHELP:                    -gline <username> [<duration>] <reason>
  * CMDHELP:                    -instantgline <username> [<duration>] <reason>
- * CMDHELP:                    -password <password> [<duration>] <reason>
- * CMDHELP:                    -email <email address> [<duration>] <reason>
- * CMDHELP: Suspends one or more users, either based on username, email
- * CMDHELP: address or password.
+ * CMDHELP: Suspends the user with the specified username.
  * CMDHELP: By default the user will be immediately disconnected unless
  * CMDHELP: nokill is specified.
  * CMDHELP: gline will gline the user at some random period of time after
@@ -49,8 +46,8 @@ int csu_dosuspenduser(void *source, int cargc, char **cargv) {
   char *flag;
   char *victim;
   char *dur_p;
-  char *reason;
-  int kill=1, gline=0, email=0, password=0, hitcount=0;
+  char *reason, *stype;
+  int kill=1, gline=0;
   time_t expires=0;
   int duration=0;
   char expiresbuf[TIMELEN]="";
@@ -105,12 +102,6 @@ int csu_dosuspenduser(void *source, int cargc, char **cargv) {
     else if (!ircd_strcmp(flag, "-instantgline")) {
       gline=2;
     }
-    else if (!ircd_strcmp(flag, "-email")) {
-      email=1;
-    }
-    else if (!ircd_strcmp(flag, "-password")) {
-      password=1;
-    }
     else {
       chanservstdmessage(sender, QM_INVALIDCHANLEVCHANGE);
       return CMD_ERROR;
@@ -150,111 +141,55 @@ int csu_dosuspenduser(void *source, int cargc, char **cargv) {
   if (expires)
     q9strftime(expiresbuf,sizeof(expiresbuf),expires);
   
-  if (email) {
-    int i;
-    
-    for (i=0;i<REGUSERHASHSIZE;i++) {
-      for (vrup=regusernicktable[i]; vrup; vrup=vrup->nextbyname) {
-        if (!strcasecmp(vrup->email->content, victim)) {
-          if (UHasSuspension(vrup))
-            continue;
-          
-          if (UHasStaffPriv(vrup))
-            continue;
-          
-          hitcount++;
-          vrup->flags|=QUFLAG_SUSPENDED;
-          vrup->suspendby=rup->ID;
-          vrup->suspendexp=expires;
-          vrup->suspendtime=time(NULL);
-          vrup->suspendreason=getsstring(reason, strlen(reason)+1);
-          
-          killtheusers(sender,vrup);
-          csdb_updateuser(vrup);
-        }
-      }
-    }
+  if (!(vrup=findreguser(sender, victim)))
+    return CMD_ERROR;
     
-    chanservwallmessage("%s (%s) bulk suspended <%s>, hit %d account/s (expires: %s), reason: %s", sender->nick, rup->username, victim, hitcount, expires?expiresbuf:"never", reason);
-    cs_log(sender, "SUSPENDUSER (bulk by email: %s, hit: %d) expires: %s, reason: %s", victim, hitcount, expires?expiresbuf:"never", reason);
+  if (!ircd_strcmp(vrup->username, rup->username)) {
+    chanservsendmessage(sender, "You can't suspend yourself, silly.");
+    return CMD_ERROR;
   }
-  else if (password) {
-    int i;
     
-    for (i=0;i<REGUSERHASHSIZE;i++) {
-      for (vrup=regusernicktable[i]; vrup; vrup=vrup->nextbyname) {
-        if (!strcmp(vrup->password, victim)) {
-          if (UHasSuspension(vrup))
-            continue;
-          
-          if (UHasStaffPriv(vrup))
-            continue;
-          
-          hitcount++;
-          vrup->flags|=QUFLAG_SUSPENDED;
-          vrup->suspendby=rup->ID;
-          vrup->suspendexp=expires;
-          vrup->suspendtime=time(NULL);
-          vrup->suspendreason=getsstring(reason, strlen(reason)+1);
-          
-          killtheusers(sender,vrup);
-          csdb_updateuser(vrup);
-        }
-      }
-    }
-    
-    chanservwallmessage("%s (%s) bulk suspended password \"%s\", hit %d account/s (expires: %s), reason: %s", sender->nick, rup->username, victim, hitcount, expires?expiresbuf:"never", reason);
-    cs_log(sender, "SUSPENDUSER (bulk by password: %s, hit: %d) expires: %s, reason: %s", victim, hitcount, expires?expiresbuf:"never", reason);
+  if (UHasSuspension(vrup)) {
+    chanservstdmessage(sender, QM_USERALREADYSUSPENDED);
+    return CMD_ERROR;
   }
-  else {
-    if (!(vrup=findreguser(sender, victim)))
-      return CMD_ERROR;
     
-    if (!ircd_strcmp(vrup->username, rup->username)) {
-      chanservsendmessage(sender, "You can't suspend yourself, silly.");
-      return CMD_ERROR;
-    }
-    
-    if (UHasSuspension(vrup)) {
-      chanservstdmessage(sender, QM_USERALREADYSUSPENDED);
-      return CMD_ERROR;
-    }
-    
-    if (UHasStaffPriv(vrup)) {
-      char buf[200];
-      snprintf(buf, sizeof(buf), "suspenduser on %s (reason: %s)", vrup->username, reason);
-      chanservstdmessage(sender, QM_NOACCESS, buf);
-      chanservwallmessage("%s (%s) FAILED to suspend %s (reason: %s)", sender->nick, rup->username, vrup->username, reason);
-      return CMD_ERROR;
-    }
-    
-    if (gline == 2)
-      vrup->flags|=QUFLAG_GLINE;
-    else if (gline == 1)
-      vrup->flags|=QUFLAG_DELAYEDGLINE;
-    else
-      vrup->flags|=QUFLAG_SUSPENDED;
-    vrup->suspendby=rup->ID;
-    vrup->suspendexp=expires;
-    vrup->suspendtime=time(NULL);
-    vrup->suspendreason=getsstring(reason, strlen(reason)+1);
+  if (UHasStaffPriv(vrup)) {
+    char buf[200];
+    snprintf(buf, sizeof(buf), "suspenduser on %s (reason: %s)", vrup->username, reason);
+    chanservstdmessage(sender, QM_NOACCESS, buf);
+    chanservwallmessage("%s (%s) FAILED to SUSPENDUSER %s (reason: %s)", sender->nick, rup->username, vrup->username, reason);
+    return CMD_ERROR;
+  }
     
-    chanservwallmessage("%s (%s) %s %s (expires: %s), reason: %s", sender->nick, rup->username, (gline)?((gline == 2)?"instantly glined":"delayed glined"):"suspended", vrup->username, expires?expiresbuf:"never", reason);
-    cs_log(sender, "SUSPENDUSER %s %s (expires: %s), reason: %s", (gline)?((gline == 2)?"instantly glined":"delayed glined"):"suspended", vrup->username, expires?expiresbuf:"never", reason);
+  if (gline == 2)
+    vrup->flags|=QUFLAG_GLINE;
+  else if (gline == 1)
+    vrup->flags|=QUFLAG_DELAYEDGLINE;
+  else
+    vrup->flags|=QUFLAG_SUSPENDED;
+  vrup->suspendby=rup->ID;
+  vrup->suspendexp=expires;
+  vrup->suspendtime=time(NULL);
+  vrup->suspendreason=getsstring(reason, strlen(reason)+1);
 
-    if (gline) {
-      dgwait=(gline==2)?0:rand()%900;
-      chanservsendmessage(sender, "Scheduling delayed GLINE for account %s in %d %s", 
-        vrup->username, (dgwait>60)?(dgwait/60):dgwait, (dgwait>60)?"minutes":"seconds");
-      deleteschedule(NULL, &chanservdgline, (void*)vrup);
-      scheduleoneshot(time(NULL)+dgwait, &chanservdgline, (void*)vrup);
-    }
-    else if (kill) {
-      hitcount += killtheusers(sender,vrup);
-    }
+  stype = (gline)?((gline == 2)?"instant gline":"delayed gline"):"normal";    
 
-    csdb_updateuser(vrup);
+  chanservwallmessage("%s (%s) used SUSPENDUSER (%s) on %s (expires: %s), reason: %s", sender->nick, rup->username, stype, vrup->username, expires?expiresbuf:"never", reason);
+  cs_log(sender, "SUSPENDUSER (%s) %s (expires: %s), reason: %s", stype, vrup->username, expires?expiresbuf:"never", reason);
+
+  if (gline) {
+    dgwait=(gline==2)?0:rand()%900;
+    chanservsendmessage(sender, "Scheduling delayed GLINE for account %s in %d %s", 
+      vrup->username, (dgwait>60)?(dgwait/60):dgwait, (dgwait>60)?"minutes":"seconds");
+    deleteschedule(NULL, &chanservdgline, (void*)vrup);
+    scheduleoneshot(time(NULL)+dgwait, &chanservdgline, (void*)vrup);
+  }
+  else if (kill) {
+    killtheusers(sender,vrup);
   }
+
+  csdb_updateuser(vrup);
   
   return CMD_OK;
 }
index f29b0ef67e72f86e89becac86bd7f7a74894bade..f0fa59406a35bc12b675f4a8692f126cc052de5f 100644 (file)
@@ -64,21 +64,22 @@ int csu_dounsuspenduser(void *source, int cargc, char **cargv) {
   if (UHasOperPriv(vrup) && !UHasAdminPriv(rup)) {
     snprintf(action, 99, "unsuspenduser on %s", vrup->username);
     chanservstdmessage(sender, QM_NOACCESS, action);
-    chanservwallmessage("%s (%s) FAILED to unsuspend %s", sender->nick, rup->username, vrup->username);
+    chanservwallmessage("%s (%s) FAILED to UNSUSPENDUSER %s", sender->nick, rup->username, vrup->username);
+    cs_log(sender, "UNSUSPENDUSER FAILED (not admin) %s", vrup->username);
     return CMD_ERROR;
   }
   
   if (UIsDelayedGline(vrup)) {
-    strcpy(action, "removed delayed gline on");
+    strcpy(action, "delayed gline");
   }
   else if (UIsGline(vrup)) {
-    strcpy(action, "removed instant gline on");
+    strcpy(action, "instant gline");
   }
   else if (UIsSuspended(vrup)) {
-    strcpy(action, "unsuspended");
+    strcpy(action, "normal");
   }
   else {
-    chanservsendmessage(sender, "Unknown suspend type encountered.");
+    chanservsendmessage(sender, "Unknown suspension type encountered.");
     return CMD_ERROR;
   }
 
@@ -86,8 +87,8 @@ int csu_dounsuspenduser(void *source, int cargc, char **cargv) {
   csuspendedby = suspendedby?suspendedby->username:"(unknown)";
   csuspendreason = vrup->suspendreason?vrup->suspendreason->content:"(no reason)";
 
-  chanservwallmessage("%s (%s) %s %s (suspended by: %s, suspension reason: %s), unsuspension reason: %s", sender->nick, rup->username, action, vrup->username, csuspendedby, csuspendreason, unsuspendreason);
-  cs_log(sender,"UNSUSPENDUSER %s %s (suspended by: %s, suspension reason: %s), unsuspension reason: %s", action, vrup->username, csuspendedby, csuspendreason, unsuspendreason);
+  chanservwallmessage("%s (%s) used UNSUSPENDUSER on %s (type: %s, suspended by: %s, suspension reason: %s), unsuspension reason: %s", sender->nick, rup->username, action, vrup->username, csuspendedby, csuspendreason, unsuspendreason);
+  cs_log(sender,"UNSUSPENDUSER %s (type: %s, suspended by: %s, suspension reason: %s), unsuspension reason: %s", action, vrup->username, csuspendedby, csuspendreason, unsuspendreason);
 
   vrup->flags&=(~(QUFLAG_GLINE|QUFLAG_DELAYEDGLINE|QUFLAG_SUSPENDED));
   vrup->suspendby=0;