]>
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 VY |
11 | |
12 | static int _modinit(void); | |
13 | static void _moddeinit(void); | |
14 | static void chm_operonly(struct Client *source_p, struct Channel *chptr, | |
15 | int alevel, int parc, int *parn, | |
16 | const char **parv, int *errors, int dir, char c, long mode_type); | |
581dad19 EM |
17 | static const char chm_operonly_compat[] = |
18 | "Adds an emulated channel mode +O which is converted into mode +i and +I $o"; | |
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 | { | |
25 | chmode_table['O'].set_func = chm_operonly; | |
26 | chmode_table['O'].mode_type = 0; | |
27 | ||
28 | return 0; | |
29 | } | |
30 | ||
31 | static void | |
32 | _moddeinit(void) | |
33 | { | |
34 | chmode_table['O'].set_func = chm_nosuch; | |
35 | chmode_table['O'].mode_type = 0; | |
36 | } | |
37 | ||
38 | static void | |
39 | chm_operonly(struct Client *source_p, struct Channel *chptr, | |
40 | int alevel, int parc, int *parn, | |
41 | const char **parv, int *errors, int dir, char c, long mode_type) | |
42 | { | |
43 | int newparn = 0; | |
44 | const char *newparv[] = { "$o" }; | |
45 | ||
46 | if (MyClient(source_p)) { | |
47 | chm_simple(source_p, chptr, alevel, parc, parn, parv, | |
48 | errors, dir, 'i', MODE_INVITEONLY); | |
49 | chm_ban(source_p, chptr, alevel, 1, &newparn, newparv, | |
50 | errors, dir, 'I', CHFL_INVEX); | |
51 | } else | |
52 | chm_nosuch(source_p, chptr, alevel, parc, parn, parv, | |
53 | errors, dir, c, mode_type); | |
54 | } |