]> jfr.im git - solanum.git/blob - extensions/createauthonly.c
Merge pull request #302 from edk0/sasl-usercloak
[solanum.git] / extensions / createauthonly.c
1 /*
2 * This module restricts channel creation to authenticated users
3 * and IRC operators only. This module could be useful for
4 * running private chat systems, or if a network gets droneflood
5 * problems. It will 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
19 static const char restrict_desc[] = "Restricts channel creation to authenticated users and IRC operators only";
20
21 static void h_can_create_channel_authenticated(hook_data_client_approval *);
22
23 mapi_hfn_list_av1 restrict_hfnlist[] = {
24 { "can_create_channel", (hookfn) h_can_create_channel_authenticated },
25 { NULL, NULL }
26 };
27
28 DECLARE_MODULE_AV2(createauthonly, NULL, NULL, NULL, NULL, restrict_hfnlist, NULL, NULL, restrict_desc);
29
30 static void
31 h_can_create_channel_authenticated(hook_data_client_approval *data)
32 {
33 struct Client *source_p = data->client;
34
35 if (*source_p->user->suser == '\0' && !IsOper(source_p))
36 data->approved = ERR_NEEDREGGEDNICK;
37 }