]> jfr.im git - solanum.git/blame - extensions/chm_operonly_compat.c
chm_operonly_compat, this adds +O channel mode, which means oper only channel
[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"
10
11/* XXX prototypes */
12void chm_ban(struct Client *source_p, struct Channel *chptr,
13 int alevel, int parc, int *parn,
14 const char **parv, int *errors, int dir, char c, long mode_type);
15void chm_nosuch(struct Client *source_p, struct Channel *chptr,
16 int alevel, int parc, int *parn,
17 const char **parv, int *errors, int dir, char c, long mode_type);
18void chm_simple(struct Client *source_p, struct Channel *chptr,
19 int alevel, int parc, int *parn,
20 const char **parv, int *errors, int dir, char c, long mode_type);
21/* end yucky prototypes */
22
23static int _modinit(void);
24static void _moddeinit(void);
25static void chm_operonly(struct Client *source_p, struct Channel *chptr,
26 int alevel, int parc, int *parn,
27 const char **parv, int *errors, int dir, char c, long mode_type);
28
29DECLARE_MODULE_AV1(chm_operonly_compat, _modinit, _moddeinit, NULL, NULL, NULL, "$Revision$");
30
31static int
32_modinit(void)
33{
34 chmode_table['O'].set_func = chm_operonly;
35 chmode_table['O'].mode_type = 0;
36
37 return 0;
38}
39
40static void
41_moddeinit(void)
42{
43 chmode_table['O'].set_func = chm_nosuch;
44 chmode_table['O'].mode_type = 0;
45}
46
47static void
48chm_operonly(struct Client *source_p, struct Channel *chptr,
49 int alevel, int parc, int *parn,
50 const char **parv, int *errors, int dir, char c, long mode_type)
51{
52 int newparn = 0;
53 const char *newparv[] = { "$o" };
54
55 if (MyClient(source_p)) {
56 chm_simple(source_p, chptr, alevel, parc, parn, parv,
57 errors, dir, 'i', MODE_INVITEONLY);
58 chm_ban(source_p, chptr, alevel, 1, &newparn, newparv,
59 errors, dir, 'I', CHFL_INVEX);
60 } else
61 chm_nosuch(source_p, chptr, alevel, parc, parn, parv,
62 errors, dir, c, mode_type);
63}