]> jfr.im git - solanum.git/blob - extensions/createauthonly.c
Note that messages caught in +g/+G are discarded
[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 #include "s_newconf.h"
19
20 static const char restrict_desc[] = "Restricts channel creation to authenticated users and IRC operators only";
21
22 static void h_can_create_channel_authenticated(void *);
23
24 mapi_hfn_list_av1 restrict_hfnlist[] = {
25 { "can_create_channel", h_can_create_channel_authenticated },
26 { NULL, NULL }
27 };
28
29 DECLARE_MODULE_AV2(createauthonly, NULL, NULL, NULL, NULL, restrict_hfnlist, NULL, NULL, restrict_desc);
30
31 static void
32 h_can_create_channel_authenticated(void *data_)
33 {
34 hook_data_client_approval *data = data_;
35 struct Client *source_p = data->client;
36
37 if (*source_p->user->suser == '\0' && !IsOperGeneral(source_p))
38 data->approved = ERR_NEEDREGGEDNICK;
39 }