]> jfr.im git - solanum.git/blame - extensions/chm_quietunreg_compat.c
chmode: Get elevated access for op-only queries
[solanum.git] / extensions / chm_quietunreg_compat.c
CommitLineData
b50c1127
JT
1/*
2 * Treat cmode +-R as +-q $~a.
3 * -- jilles
4 */
5
6#include "stdinc.h"
7#include "modules.h"
8#include "client.h"
9#include "hook.h"
10#include "ircd.h"
c84557ac 11#include "chmode.h"
b50c1127 12
eeabf33a
EM
13static const char chm_quietunreg_compat_desc[] =
14 "Adds an emulated channel mode +R which is converted into mode +q $~a";
15
b50c1127
JT
16static int _modinit(void);
17static void _moddeinit(void);
18static void chm_quietunreg(struct Client *source_p, struct Channel *chptr,
04952c32 19 int alevel, const char *arg, int *errors, int dir, char c, long mode_type);
b50c1127 20
581dad19 21DECLARE_MODULE_AV2(chm_quietunreg_compat, _modinit, _moddeinit, NULL, NULL, NULL, NULL, NULL, chm_quietunreg_compat_desc);
b50c1127
JT
22
23static int
24_modinit(void)
25{
04952c32 26 chmode_table['R'] = (struct ChannelMode){ chm_quietunreg, 0, 0 };
b50c1127
JT
27 return 0;
28}
29
30static void
31_moddeinit(void)
32{
04952c32 33 chmode_table['R'] = (struct ChannelMode){ chm_nosuch, 0, 0 };
b50c1127
JT
34}
35
36static void
37chm_quietunreg(struct Client *source_p, struct Channel *chptr,
04952c32 38 int alevel, const char *arg, int *errors, int dir, char c, long mode_type)
b50c1127 39{
b50c1127 40 if (MyClient(source_p))
04952c32 41 chm_ban(source_p, chptr, alevel, "$~a",
b50c1127
JT
42 errors, dir, 'q', CHFL_QUIET);
43 else
04952c32 44 chm_nosuch(source_p, chptr, alevel, NULL,
b50c1127
JT
45 errors, dir, c, mode_type);
46}