]> jfr.im git - solanum.git/blame - extensions/chm_operonly.c
explicitly show IP in SNO_BANNED snotes
[solanum.git] / extensions / chm_operonly.c
CommitLineData
acdf71d9
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
581dad19
EM
13static const char chm_operonly_desc[] =
14 "Adds channel mode +O which makes a channel operator-only";
acdf71d9 15
82436efb 16static void h_can_join(void *);
eeabf33a 17
acdf71d9 18mapi_hfn_list_av1 operonly_hfnlist[] = {
82436efb 19 { "can_join", h_can_join },
acdf71d9
VY
20 { NULL, NULL }
21};
22
19716b9f 23static unsigned int mymode;
acdf71d9 24
acdf71d9
VY
25static int
26_modinit(void)
27{
19716b9f
JT
28 mymode = cflag_add('O', chm_staff);
29 if (mymode == 0)
30 return -1;
acdf71d9
VY
31
32 return 0;
33}
34
35
acdf71d9
VY
36static void
37_moddeinit(void)
38{
19716b9f 39 cflag_orphan('O');
acdf71d9
VY
40}
41
581dad19 42DECLARE_MODULE_AV2(chm_operonly, _modinit, _moddeinit, NULL, NULL, operonly_hfnlist, NULL, NULL, chm_operonly_desc);
acdf71d9
VY
43
44static void
82436efb 45h_can_join(void *data_)
acdf71d9 46{
82436efb 47 hook_data_channel *data = data_;
acdf71d9
VY
48 struct Client *source_p = data->client;
49 struct Channel *chptr = data->chptr;
50
19716b9f 51 if((chptr->mode.mode & mymode) && !IsOper(source_p)) {
eb463ef3 52 sendto_one_numeric(source_p, 520, "%s :Cannot join channel (+O) - you are not an IRC operator", chptr->chname);
acdf71d9
VY
53 data->approved = ERR_CUSTOM;
54 }
55}
56