]> jfr.im git - irc/rqf/shadowircd.git/blame - extensions/chm_adminonly.c
Add SHA256/SHA512 support to crypt.c and fix up the MD5 component (it seemed to have...
[irc/rqf/shadowircd.git] / extensions / chm_adminonly.c
CommitLineData
3df643b1
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 adminonly_hfnlist[] = {
16 { "can_join", (hookfn) h_can_join },
17 { NULL, NULL }
18};
19
6795400d
JT
20static unsigned int mymode;
21
3df643b1
VY
22static int
23_modinit(void)
24{
6795400d
JT
25 mymode = cflag_add('A', chm_staff);
26 if (mymode == 0)
27 return -1;
3df643b1
VY
28
29 return 0;
30}
31
32static void
33_moddeinit(void)
34{
6795400d 35 cflag_orphan('A');
3df643b1
VY
36}
37
38DECLARE_MODULE_AV1(chm_adminonly, _modinit, _moddeinit, NULL, NULL, adminonly_hfnlist, "$Revision$");
39
40static void
41h_can_join(hook_data_channel *data)
42{
43 struct Client *source_p = data->client;
44 struct Channel *chptr = data->chptr;
45
6795400d 46 if((chptr->mode.mode & mymode) && !IsAdmin(source_p)) {
3df643b1
VY
47 sendto_one_numeric(source_p, 519, "%s :Cannot join channel (+A) - you are not an IRC server administrator", chptr->chname);
48 data->approved = ERR_CUSTOM;
49 }
50}
51