]>
Commit | Line | Data |
---|---|---|
813c5b73 CP |
1 | #include "../irc/irc.h" |
2 | ||
3 | #include "../trusts/trusts.h" | |
4 | #include "glines.h" | |
5 | ||
ac3af088 GB |
6 | void glinebynick(nick *np, int duration, const char *reason) { |
7 | glinebyhost(np->ident, IPtostr(np->p_ipaddr), duration, reason); | |
813c5b73 CP |
8 | } |
9 | ||
ac3af088 GB |
10 | void glinebyhost(const char *ident, const char *hostname, int duration, const char *reason) { |
11 | uint32_t ip; | |
12 | short mask; | |
13 | trusthost *th; | |
14 | ||
15 | if(trusts_parsecidr(hostname, &ip, &mask)) { | |
16 | th = th_getbyhost(ip); | |
17 | ||
18 | if(th) { | |
19 | trustgline(th->group, ident, duration, reason); | |
20 | return; | |
21 | } | |
22 | } | |
813c5b73 CP |
23 | |
24 | irc_send("%s GL * +%s@%s %d %jd :%s", mynumeric->content, ident, hostname, duration, (intmax_t)getnettime(), reason); | |
25 | } | |
26 | ||
ac3af088 GB |
27 | void unglinebyhost(const char *ident, const char *hostname, int duration, const char *reason) { |
28 | uint32_t ip; | |
29 | short mask; | |
30 | trusthost *th; | |
31 | ||
32 | if(trusts_parsecidr(hostname, &ip, &mask)) { | |
33 | th = th_getbyhost(ip); | |
34 | ||
35 | if(th) { | |
36 | trustungline(th->group, ident, duration, reason); | |
37 | return; | |
38 | } | |
39 | } | |
813c5b73 CP |
40 | |
41 | irc_send("%s GL * -%s@%s %d %jd :%s", mynumeric->content, ident, hostname, duration, (intmax_t)getnettime(), reason); | |
42 | } |