]> jfr.im git - irc/quakenet/newserv.git/blob - glines/glines_util.c
Replace SNIRCD macros with SNIRCD_VERSION.
[irc/quakenet/newserv.git] / glines / glines_util.c
1 #include "../irc/irc.h"
2 #include "glines.h"
3
4 int glinebyip(const char *user, struct irc_in_addr *ip, unsigned char bits, int duration, const char *reason, int flags, const char *creator) {
5 glinebuf gbuf;
6 int hits;
7
8 glinebufinit(&gbuf, 1);
9 glinebufaddbyip(&gbuf, user, ip, bits, flags, creator, reason, getnettime() + duration, getnettime(), getnettime() + duration);
10
11 glinebufcounthits(&gbuf, &hits, NULL);
12
13 if (flags & GLINE_SIMULATE)
14 glinebufabandon(&gbuf);
15 else
16 glinebufflush(&gbuf, 1);
17
18 return hits;
19 }
20
21 int glinebynick(nick *np, int duration, const char *reason, int flags, const char *creator) {
22 glinebuf gbuf;
23 int hits;
24
25 glinebufinit(&gbuf, 1);
26 glinebufaddbynick(&gbuf, np, flags, creator, reason, getnettime() + duration, getnettime(), getnettime() + duration);
27
28 glinebufcounthits(&gbuf, &hits, NULL);
29
30 if (flags & GLINE_SIMULATE)
31 glinebufabandon(&gbuf);
32 else
33 glinebufflush(&gbuf, 1);
34
35 return hits;
36 }
37