]> jfr.im git - irc/rqf/shadowircd.git/blame - extensions/chm_sslonly.c
New custom channel mode API allowing reloading such modules.
[irc/rqf/shadowircd.git] / extensions / chm_sslonly.c
CommitLineData
0865b537
VY
1#include "stdinc.h"
2#include "modules.h"
3#include "hook.h"
4#include "client.h"
5#include "ircd.h"
6#include "send.h"
7#include "s_conf.h"
8#include "s_user.h"
9#include "s_serv.h"
10#include "numeric.h"
11#include "chmode.h"
12
13static void h_can_join(hook_data_channel *);
14
15mapi_hfn_list_av1 sslonly_hfnlist[] = {
16 { "can_join", (hookfn) h_can_join },
17 { NULL, NULL }
18};
19
6795400d
JT
20static unsigned int mymode;
21
0865b537
VY
22static int
23_modinit(void)
24{
6795400d
JT
25 mymode = cflag_add('S', chm_simple);
26 if (mymode == 0)
27 return -1;
0865b537
VY
28
29 return 0;
30}
31
32
33static void
34_moddeinit(void)
35{
6795400d 36 cflag_orphan('S');
0865b537
VY
37}
38
39DECLARE_MODULE_AV1(chm_sslonly, _modinit, _moddeinit, NULL, NULL, sslonly_hfnlist, "$Revision$");
40
41static void
42h_can_join(hook_data_channel *data)
43{
44 struct Client *source_p = data->client;
45 struct Channel *chptr = data->chptr;
46
6795400d 47 if((chptr->mode.mode & mymode) && !IsSSLClient(source_p)) {
0865b537
VY
48 sendto_one_notice(source_p, ":Only users using SSL could join this channel!");
49 data->approved = ERR_CUSTOM;
50 }
51}
52