]> jfr.im git - solanum.git/blob - extensions/chm_quietunreg_compat.c
Merge pull request #161 from awilfox/av2desc
[solanum.git] / extensions / chm_quietunreg_compat.c
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"
11 #include "chmode.h"
12
13 static int _modinit(void);
14 static void _moddeinit(void);
15 static void chm_quietunreg(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);
18 static const char chm_quietunreg_compat_desc[] =
19 "Adds an emulated channel mode +R which is converted into mode +q $~a";
20
21 DECLARE_MODULE_AV2(chm_quietunreg_compat, _modinit, _moddeinit, NULL, NULL, NULL, NULL, NULL, chm_quietunreg_compat_desc);
22
23 static int
24 _modinit(void)
25 {
26 chmode_table['R'].set_func = chm_quietunreg;
27 chmode_table['R'].mode_type = 0;
28
29 return 0;
30 }
31
32 static void
33 _moddeinit(void)
34 {
35 chmode_table['R'].set_func = chm_nosuch;
36 chmode_table['R'].mode_type = 0;
37 }
38
39 static void
40 chm_quietunreg(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[] = { "$~a" };
46
47 if (MyClient(source_p))
48 chm_ban(source_p, chptr, alevel, 1, &newparn, newparv,
49 errors, dir, 'q', CHFL_QUIET);
50 else
51 chm_nosuch(source_p, chptr, alevel, parc, parn, parv,
52 errors, dir, c, mode_type);
53 }