]> jfr.im git - solanum.git/blob - extensions/chm_sslonly_compat.c
Merge pull request #302 from edk0/sasl-usercloak
[solanum.git] / extensions / chm_sslonly_compat.c
1 /*
2 * Treat cmode +-S as +-b $~z.
3 */
4
5 #include "stdinc.h"
6 #include "modules.h"
7 #include "client.h"
8 #include "hook.h"
9 #include "ircd.h"
10 #include "chmode.h"
11
12 static const char chm_sslonly_compat_desc[] =
13 "Adds an emulated channel mode +S which is converted into mode +b $~z";
14
15 static int _modinit(void);
16 static void _moddeinit(void);
17 static void chm_sslonly(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
21 DECLARE_MODULE_AV2(chm_sslonly_compat, _modinit, _moddeinit, NULL, NULL, NULL, NULL, NULL, chm_sslonly_compat_desc);
22
23 static int
24 _modinit(void)
25 {
26 chmode_table['S'].set_func = chm_sslonly;
27 chmode_table['S'].mode_type = 0;
28
29 return 0;
30 }
31
32 static void
33 _moddeinit(void)
34 {
35 chmode_table['S'].set_func = chm_nosuch;
36 chmode_table['S'].mode_type = 0;
37 }
38
39 static void
40 chm_sslonly(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[] = { "$~z" };
46
47 if (MyClient(source_p))
48 chm_ban(source_p, chptr, alevel, 1, &newparn, newparv,
49 errors, dir, 'b', CHFL_BAN);
50 else
51 chm_nosuch(source_p, chptr, alevel, parc, parn, parv,
52 errors, dir, c, mode_type);
53 }