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