]>
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 | 10 | void glinebyhost(const char *ident, const char *hostname, int duration, const char *reason) { |
91215aff GB |
11 | struct irc_in_addr ip; |
12 | unsigned char bits; | |
ac3af088 GB |
13 | trusthost *th; |
14 | ||
91215aff GB |
15 | if(ipmask_parse(hostname, &ip, &bits)) { |
16 | th = th_getbyhost(&ip); | |
ac3af088 | 17 | |
91215aff | 18 | if(th && th->group->mode) { |
ac3af088 GB |
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 | 27 | void unglinebyhost(const char *ident, const char *hostname, int duration, const char *reason) { |
91215aff GB |
28 | struct irc_in_addr ip; |
29 | unsigned char bits; | |
ac3af088 GB |
30 | trusthost *th; |
31 | ||
91215aff GB |
32 | if(ipmask_parse(hostname, &ip, &bits)) { |
33 | th = th_getbyhost(&ip); | |
ac3af088 | 34 | |
91215aff | 35 | if(th && th->group->mode) { |
ac3af088 GB |
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 | } |