]> jfr.im git - solanum.git/blame - extensions/createauthonly.c
extensions/umode_hide_idle_time: mask times for hidden sources (#373)
[solanum.git] / extensions / createauthonly.c
CommitLineData
212380e3
AC
1/*
2 * This module restricts channel creation to authenticated users
b47db00e
JT
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.
212380e3 6 * -- nenolod
212380e3
AC
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"
d4f7eb4c 18#include "s_newconf.h"
212380e3 19
c81afd15 20static const char restrict_desc[] = "Restricts channel creation to authenticated users and IRC operators only";
212380e3 21
82436efb 22static void h_can_create_channel_authenticated(void *);
eeabf33a 23
212380e3 24mapi_hfn_list_av1 restrict_hfnlist[] = {
82436efb 25 { "can_create_channel", h_can_create_channel_authenticated },
212380e3
AC
26 { NULL, NULL }
27};
28
c81afd15 29DECLARE_MODULE_AV2(createauthonly, NULL, NULL, NULL, NULL, restrict_hfnlist, NULL, NULL, restrict_desc);
212380e3
AC
30
31static void
82436efb 32h_can_create_channel_authenticated(void *data_)
212380e3 33{
82436efb 34 hook_data_client_approval *data = data_;
212380e3
AC
35 struct Client *source_p = data->client;
36
d4f7eb4c 37 if (*source_p->user->suser == '\0' && !IsOperGeneral(source_p))
212380e3
AC
38 data->approved = ERR_NEEDREGGEDNICK;
39}