]> jfr.im git - irc/quakenet/newserv.git/blob - chanserv/chanservschedule.c
Merge pull request #1 from meeb/meeb
[irc/quakenet/newserv.git] / chanserv / chanservschedule.c
1 #include "chanserv.h"
2 #include "../lib/irc_string.h"
3 #include "../core/schedule.h"
4 #include "../glines/glines.h"
5
6 void chanservdgline(void* arg) {
7 reguser *rup=(reguser*)arg;
8 nick *np, *nl;
9 authname *anp;
10 int i;
11 unsigned int ucount;
12
13 if (!rup || (!UIsDelayedGline(rup) && !UIsGline(rup)))
14 return;
15
16 if (!(anp=findauthname(rup->ID)))
17 return;
18
19 for (nl=anp->nicks;nl;nl=nl->nextbyauthname) {
20 for (i=0, ucount=0; i<NICKHASHSIZE; i++)
21 for (np=nicktable[i];np;np=np->next)
22 if (np->ipnode==nl->ipnode && !ircd_strcmp(np->ident, nl->ident))
23 ucount++;
24
25 if (ucount >= MAXGLINEUSERS) {
26 chanservwallmessage("Delayed GLINE \"*!%s@%s\" (account %s) would hit %d users, aborting.",
27 nl->ident, IPtostr(nl->ipaddress), rup->username, ucount);
28 } else {
29 char *reason = "Network abuse";
30 if(rup->suspendreason)
31 reason = rup->suspendreason->content;
32
33 glinebynick(nl, 3600, reason, 0, "chanserv");
34 chanservwallmessage("Delayed GLINE \"*!%s@%s\" (authed as %s) expires in 60 minute/s (hit %d user%s) (reason: %s)",
35 nl->ident, IPtostr(nl->ipaddress), rup->username, ucount, ucount==1?"":"s", reason);
36 }
37 }
38 }