]>
Commit | Line | Data |
---|---|---|
ec40aa0d VY |
1 | /* |
2 | * Treat cmode +-O as +-iI $o. | |
3 | */ | |
4 | ||
5 | #include "stdinc.h" | |
6 | #include "modules.h" | |
7 | #include "client.h" | |
8 | #include "hook.h" | |
9 | #include "ircd.h" | |
c84557ac | 10 | #include "chmode.h" |
ec40aa0d | 11 | |
eeabf33a EM |
12 | static const char chm_operonly_compat[] = |
13 | "Adds an emulated channel mode +O which is converted into mode +i and +I $o"; | |
14 | ||
ec40aa0d VY |
15 | static int _modinit(void); |
16 | static void _moddeinit(void); | |
17 | static void chm_operonly(struct Client *source_p, struct Channel *chptr, | |
04952c32 | 18 | int alevel, const char *arg, int *errors, int dir, char c, long mode_type); |
ec40aa0d | 19 | |
581dad19 | 20 | DECLARE_MODULE_AV2(chm_operonly_compat, _modinit, _moddeinit, NULL, NULL, NULL, NULL, NULL, chm_operonly_compat); |
ec40aa0d VY |
21 | |
22 | static int | |
23 | _modinit(void) | |
24 | { | |
04952c32 | 25 | chmode_table['O'] = (struct ChannelMode){chm_operonly, 0, 0}; |
ec40aa0d VY |
26 | return 0; |
27 | } | |
28 | ||
29 | static void | |
30 | _moddeinit(void) | |
31 | { | |
04952c32 | 32 | chmode_table['O'] = (struct ChannelMode){chm_nosuch, 0, 0}; |
ec40aa0d VY |
33 | } |
34 | ||
35 | static void | |
36 | chm_operonly(struct Client *source_p, struct Channel *chptr, | |
04952c32 | 37 | int alevel, const char *arg, int *errors, int dir, char c, long mode_type) |
ec40aa0d | 38 | { |
ec40aa0d | 39 | if (MyClient(source_p)) { |
04952c32 | 40 | chm_simple(source_p, chptr, alevel, NULL, |
ec40aa0d | 41 | errors, dir, 'i', MODE_INVITEONLY); |
04952c32 | 42 | chm_ban(source_p, chptr, alevel, "$o", |
ec40aa0d VY |
43 | errors, dir, 'I', CHFL_INVEX); |
44 | } else | |
04952c32 | 45 | chm_nosuch(source_p, chptr, alevel, NULL, |
ec40aa0d VY |
46 | errors, dir, c, mode_type); |
47 | } |