]> jfr.im git - solanum.git/blob - extensions/createoperonly.c
chmode: Get elevated access for op-only queries
[solanum.git] / extensions / createoperonly.c
1 /*
2 * This module restricts channel creation to opered up users
3 * only. This module could be useful for running private chat
4 * systems, or if a network gets droneflood problems. It will
5 * return ERR_NEEDREGGEDNICK on failure.
6 * -- nenolod
7 */
8
9 #include "stdinc.h"
10 #include "modules.h"
11 #include "client.h"
12 #include "hook.h"
13 #include "ircd.h"
14 #include "send.h"
15 #include "s_conf.h"
16 #include "snomask.h"
17 #include "numeric.h"
18 #include "s_newconf.h"
19
20 static const char restrict_desc[] = "Restricts channel creation to IRC operators";
21
22 static void h_can_create_channel_authenticated(hook_data_client_approval *);
23
24 mapi_hfn_list_av1 restrict_hfnlist[] = {
25 { "can_create_channel", (hookfn) h_can_create_channel_authenticated },
26 { NULL, NULL }
27 };
28
29 DECLARE_MODULE_AV2(createoperonly, NULL, NULL, NULL, NULL, restrict_hfnlist, NULL, NULL, restrict_desc);
30
31 static void
32 h_can_create_channel_authenticated(hook_data_client_approval *data)
33 {
34 struct Client *source_p = data->client;
35
36 if (!IsOperGeneral(source_p))
37 {
38 sendto_one_notice(source_p, ":*** Channel creation is restricted to network staff only.");
39 data->approved = ERR_NEEDREGGEDNICK;
40 }
41 }