]> jfr.im git - irc/quakenet/newserv.git/blobdiff - chanserv/chanservschedule.c
Update README.
[irc/quakenet/newserv.git] / chanserv / chanservschedule.c
index e34911e65f6d9af58e88ddf1c917dedea4585ee6..26d24c8de010a8426ce0b7f33917822df62fe8c2 100644 (file)
@@ -1,6 +1,7 @@
 #include "chanserv.h"
 #include "../lib/irc_string.h"
 #include "../core/schedule.h"
+#include "../glines/glines.h"
 
 void chanservdgline(void* arg) {
   reguser *rup=(reguser*)arg;
@@ -9,7 +10,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 +19,20 @@ 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);
+        nl->ident, IPtostr(nl->ipaddress), rup->username, ucount);
     } else {
-      irc_send("%s GL * +*!%s@%s 3600 :%s\r\n", mynumeric->content, nl->ident, 
-        IPtostr(nl->p_ipaddr), rup->suspendreason->content);
+      char *reason = "Network abuse";
+      if(rup->suspendreason)
+        reason = rup->suspendreason->content;
+
+      glinebynick(nl, 3600, reason, 0, "chanserv");
       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->ipaddress), rup->username, ucount, ucount==1?"":"s", reason);
     }
   }
 }