]> jfr.im git - irc/quakenet/newserv.git/blame - chanserv/chanservschedule.c
DBAPI2: add support for stored procedures
[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"
4
5void chanservdgline(void* arg) {
23b85e10 6 reguser *rup=(reguser*)arg;
7 nick *np, *nl;
8 authname *anp;
c86edd1d
Q
9 int i;
10 unsigned int ucount;
11
c0587316 12 if (!rup || (!UIsDelayedGline(rup) && !UIsGline(rup)))
c86edd1d
Q
13 return;
14
23b85e10 15 if (!(anp=findauthname(rup->ID)))
16 return;
17
18 for (nl=anp->nicks;nl;nl=nl->nextbyauthname) {
c86edd1d
Q
19 for (i=0, ucount=0; i<NICKHASHSIZE; i++)
20 for (np=nicktable[i];np;np=np->next)
c0587316 21 if (np->ipnode==nl->ipnode && !ircd_strcmp(np->ident, nl->ident))
c86edd1d
Q
22 ucount++;
23
23b85e10 24 if (ucount >= MAXGLINEUSERS) {
c86edd1d 25 chanservwallmessage("Delayed GLINE \"*!%s@%s\" (account %s) would hit %d users, aborting.",
23b85e10 26 nl->ident, IPtostr(nl->p_ipaddr), rup->username, ucount);
27 } else {
c0587316
CP
28 char *reason = "Network abuse";
29 if(rup->suspendreason)
30 reason = rup->suspendreason->content;
31
23b85e10 32 irc_send("%s GL * +*!%s@%s 3600 :%s\r\n", mynumeric->content, nl->ident,
c0587316 33 IPtostr(nl->p_ipaddr), reason);
c86edd1d 34 chanservwallmessage("Delayed GLINE \"*!%s@%s\" (authed as %s) expires in 60 minute/s (hit %d user%s) (reason: %s)",
c0587316 35 nl->ident, IPtostr(nl->p_ipaddr), rup->username, ucount, ucount==1?"":"s", reason);
c86edd1d
Q
36 }
37 }
38}