]> jfr.im git - irc/quakenet/newserv.git/commitdiff
Fix delayed glines when unsuspended, also fix logic so it doesn't kill suspended...
authorChris Porter <redacted>
Fri, 21 Mar 2008 23:28:55 +0000 (23:28 +0000)
committerChris Porter <redacted>
Fri, 21 Mar 2008 23:28:55 +0000 (23:28 +0000)
chanserv/authcmds/login.c
chanserv/chanservschedule.c
chanserv/chanservuser.c

index c40c94543216afdc8ebdefecbc83145cfe5b7366..a6664de82ee86de4cae8a50362e7573ea85d12f8 100644 (file)
@@ -117,15 +117,7 @@ int csa_auth(void *source, int cargc, char **cargv, CRAlgorithm alg) {
   
   csdb_updateuser(rup);
   
-  if (UIsDelayedGline(rup)) {
-    /* delayed-gline - schedule the user's squelching */
-    deleteschedule(NULL, &chanservdgline, (void*)rup); /* icky, but necessary unless we stick more stuff in reguser structure */
-    scheduleoneshot(time(NULL)+rand()%900, &chanservdgline, (void*)rup);
-  } else if (UIsGline(rup)) {
-    /* instant-gline - lets be lazy and set a schedule expiring now :) */
-    deleteschedule(NULL, &chanservdgline, (void*)rup); /* icky, but necessary unless we stick more stuff in reguser structure */
-    scheduleoneshot(time(NULL), &chanservdgline, (void*)rup);
-  } else if (UIsSuspended(rup)) {
+  if (UIsSuspended(rup)) {
     /* plain suspend */
     chanservstdmessage(sender, QM_AUTHSUSPENDED);
     if(rup->suspendreason)
index e34911e65f6d9af58e88ddf1c917dedea4585ee6..fc44308e2387f6c1948b561aa666c2835ca9799e 100644 (file)
@@ -9,7 +9,7 @@ void chanservdgline(void* arg) {
   int i;
   unsigned int ucount;
   
-  if (!rup)
+  if (!rup || (!UIsDelayedGline(rup) && !UIsGline(rup)))
     return;
   
   if (!(anp=findauthname(rup->ID)))
@@ -18,17 +18,21 @@ void chanservdgline(void* arg) {
   for (nl=anp->nicks;nl;nl=nl->nextbyauthname) {
     for (i=0, ucount=0; i<NICKHASHSIZE; i++)
       for (np=nicktable[i];np;np=np->next)
-        if (!ircd_strcmp(np->ident, nl->ident) && np->ipnode==nl->ipnode)
+        if (np->ipnode==nl->ipnode && !ircd_strcmp(np->ident, nl->ident))
           ucount++;
     
     if (ucount >= MAXGLINEUSERS) {
       chanservwallmessage("Delayed GLINE \"*!%s@%s\" (account %s) would hit %d users, aborting.", 
         nl->ident, IPtostr(nl->p_ipaddr), rup->username, ucount);
     } else {
+      char *reason = "Network abuse";
+      if(rup->suspendreason)
+        reason = rup->suspendreason->content;
+
       irc_send("%s GL * +*!%s@%s 3600 :%s\r\n", mynumeric->content, nl->ident, 
-        IPtostr(nl->p_ipaddr), rup->suspendreason->content);
+        IPtostr(nl->p_ipaddr), reason);
       chanservwallmessage("Delayed GLINE \"*!%s@%s\" (authed as %s) expires in 60 minute/s (hit %d user%s) (reason: %s)", 
-        nl->ident, IPtostr(nl->p_ipaddr), rup->username, ucount, ucount==1?"":"s", rup->suspendreason->content);
+        nl->ident, IPtostr(nl->p_ipaddr), rup->username, ucount, ucount==1?"":"s", reason);
     }
   }
 }
index 8f0cfed7ba9b3689e649617af12f1cf2172f041d..5c92824a61aab3412012e775d1927a728fce4a96 100644 (file)
@@ -546,10 +546,21 @@ void cs_checknick(nick *np) {
   if (IsAccount(np) && np->auth) {
     if (np->auth->exts[chanservaext]) {
       rup=getreguserfromnick(np);
+
       /* safe? */
-      if(rup && UHasSuspension(rup)) {
-        chanservkillstdmessage(np, QM_SUSPENDKILL);
-        return;
+      if(rup) {
+        if (UIsDelayedGline(rup)) {
+          /* delayed-gline - schedule the user's squelching */
+          deleteschedule(NULL, &chanservdgline, (void*)rup); /* icky, but necessary unless we stick more stuff in reguser structure */
+          scheduleoneshot(time(NULL)+rand()%900, &chanservdgline, (void*)rup);
+        } else if (UIsGline(rup)) {
+          /* instant-gline - lets be lazy and set a schedule expiring now :) */
+          deleteschedule(NULL, &chanservdgline, (void*)rup); /* icky, but necessary unless we stick more stuff in reguser structure */
+          scheduleoneshot(time(NULL), &chanservdgline, (void*)rup);
+        } else if(UHasSuspension(rup)) {
+          chanservkillstdmessage(np, QM_SUSPENDKILL);
+          return;
+        }
       }
       cs_doallautomodes(np);
     } else {