]>
jfr.im git - irc/quakenet/newserv.git/blob - glines/glines_util.c
1 #include "../irc/irc.h"
2 #include "../trusts/trusts.h"
5 int glinebyip(const char *user
, struct irc_in_addr
*ip
, unsigned char bits
, int duration
, const char *reason
, int flags
, const char *creator
) {
9 glinebufinit(&gbuf
, 0);
10 glinebufcommentf(&gbuf
, "on IP mask %s@%s, set by %s", user
, CIDRtostr(*ip
, bits
), creator
);
11 glinebufaddbyip(&gbuf
, user
, ip
, bits
, flags
, creator
, reason
, getnettime() + duration
, getnettime(), getnettime() + duration
);
13 glinebufcounthits(&gbuf
, &hits
, NULL
);
15 if (flags
& GLINE_SIMULATE
)
18 glinebufcommit(&gbuf
, 1);
23 int glinebynick(nick
*np
, int duration
, const char *reason
, int flags
, const char *creator
) {
27 glinebufinit(&gbuf
, 0);
28 glinebufcommentf(&gbuf
, "on nick %s!%s@%s, set by %s", np
->nick
, np
->ident
, np
->host
->name
->content
, creator
);
29 glinebufaddbynick(&gbuf
, np
, flags
, creator
, reason
, getnettime() + duration
, getnettime(), getnettime() + duration
);
31 glinebufcounthits(&gbuf
, &hits
, NULL
);
33 if (flags
& GLINE_SIMULATE
)
36 glinebufcommit(&gbuf
, 1);
41 void glineunsetmask(const char *mask
) {
49 gline_deactivate(gl
, 0, 1);