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