]> jfr.im git - solanum.git/blame - extensions/createoperonly.c
add help for `chm_regmsg`
[solanum.git] / extensions / createoperonly.c
CommitLineData
45ed9777
AC
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
45ed9777
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"
45ed9777 19
c81afd15 20static const char restrict_desc[] = "Restricts channel creation to IRC operators";
45ed9777 21
82436efb 22static void h_can_create_channel_authenticated(void *);
eeabf33a 23
45ed9777 24mapi_hfn_list_av1 restrict_hfnlist[] = {
82436efb 25 { "can_create_channel", h_can_create_channel_authenticated },
45ed9777
AC
26 { NULL, NULL }
27};
28
c81afd15 29DECLARE_MODULE_AV2(createoperonly, NULL, NULL, NULL, NULL, restrict_hfnlist, NULL, NULL, restrict_desc);
45ed9777
AC
30
31static void
82436efb 32h_can_create_channel_authenticated(void *data_)
45ed9777 33{
82436efb 34 hook_data_client_approval *data = data_;
45ed9777
AC
35 struct Client *source_p = data->client;
36
d4f7eb4c 37 if (!IsOperGeneral(source_p))
45ed9777
AC
38 {
39 sendto_one_notice(source_p, ":*** Channel creation is restricted to network staff only.");
40 data->approved = ERR_NEEDREGGEDNICK;
41 }
42}