]> jfr.im git - solanum.git/blob - doc/features/extban.txt
eb0922a9b9e8783f0b5fab9c45792042b134df98
[solanum.git] / doc / features / extban.txt
1 Extended bans
2 Jilles Tjoelker <jilles -at- stack.nl>
3 --------------------------------------
4
5 Extended bans (ban conditionals) allow different checks than the usual
6 nick!user@host or nick!user@ip match to determine whether someone should
7 be banned, quieted, exempted or invited.
8
9 Extended bans are of the form $[~]<type>[:<data>]. The <type> is one
10 character (case insensitive) and determines the type of match. Most types
11 allow or require an extra field <data>. If the tilde (~) is present, the
12 result of the comparison will be negated, unless the ban is invalid in which
13 case it will never match. Invalid bans are ones where <data> is missing but
14 required or where <data> is otherwise invalid as noted below.
15
16 Unless noted below, all types can be used with +b, +q, +e and +I.
17
18 If any extended ban types are loaded, they are listed in 005 (RPL_ISUPPORT)
19 as EXTBAN=$,<types>.
20
21 Local users cannot add extended bans of an unknown type or invalid bans. If a
22 remote user adds an extended ban of an unknown type, the mode change is
23 processed normally. Furthermore, extended bans of an unknown type can always be
24 listed or removed.
25
26 The ability to send to a channel is cached; this cache may not be updated
27 if a condition for an extended ban changes. To work around this, part and
28 rejoin the channel, or add or remove a +b, +q or +e entry.
29
30 The extban types that come with charybdis are:
31
32 extb_account.so
33 $a
34 matches all logged in users
35 $a:<mask>
36 matches users logged in with a username matching the mask (* and ? wildcards)
37
38 extb_channel.so
39 $c:<channel>
40 matches users who are on the given channel; this is only valid if the channel
41 exists and is not +s or +p. (The ops of the channel the ban is on cannot
42 necessarily see whether the user is in the target channel, so it should not
43 influence whether they can join either.)
44
45 extb_canjoin.so
46 $j:<channel>
47 matches users who are or are not banned from a specified channel
48
49 extb_oper.so
50 $o
51 matches opers (most useful with +I)
52
53 extb_realname.so
54 $r:<mask>
55 matches users with a realname (gecos) matching the mask (* and ? wildcards);
56 this can only be used with +b and +q
57
58 extb_server.so
59 $s:<mask>
60 matches users connected to a server matching the mask (* and ? wildcards);
61 this can only be used with +b and +q
62
63 extb_extgecos.so
64 $x:<mask>
65 bans all users with matching nick!user@host#gecos
66
67 extb_ssl.so
68 $z
69 matches all SSL users
70
71 Comparisons:
72
73 +b $~a is similar to +r but also prevents not logged in users talking or
74 changing their nick while on channel.
75
76 +iI $o is the same as +O in dreamforge-derived ircds.
77
78 Creating extban types:
79
80 extban_table, indexed by the extban character, contains function pointers
81 of the following type:
82 typedef int (*ExtbanFunc)(const char *data, struct Client *client_p,
83 struct Channel *chptr, long mode_type);
84
85 The arguments are as follows:
86 data: the text after the colon, NULL if there was no colon
87 client_p: the client to check; this is always a local client, which may be
88 on or off channel
89 chptr: the channel
90 mode_type: CHFL_BAN, CHFL_QUIET, CHFL_EXCEPTION or CHFL_INVEX
91
92 The return value:
93 EXTBAN_INVALID: the mask is invalid, it never matches even if negated and
94 cannot be added; if this is returned for one client_p it must be returned
95 for all
96 EXTBAN_NOMATCH: the client_p does not match the mask
97 EXTBAN_MATCH: the client_p matches the mask
98
99 The function is called whenever a (local) client needs to be checked against
100 a +bqeI entry of the given extban type, and whenever a local client tries to
101 add such an entry. (Clients are allowed to add bans matching themselves.)
102