2007-05-24 06:28:36 +02:00
|
|
|
/*
|
|
|
|
* This module restricts channel creation to opered up users
|
|
|
|
* only. This module could be useful for running private chat
|
|
|
|
* systems, or if a network gets droneflood problems. It will
|
|
|
|
* return ERR_NEEDREGGEDNICK on failure.
|
|
|
|
* -- nenolod
|
|
|
|
*/
|
|
|
|
|
2016-08-13 05:05:54 +02:00
|
|
|
using namespace ircd;
|
|
|
|
|
2016-03-07 07:31:41 +01:00
|
|
|
static const char restrict_desc[] = "Restricts channel creation to IRC operators";
|
2007-05-24 06:28:36 +02:00
|
|
|
|
2016-03-09 08:29:41 +01:00
|
|
|
static void h_can_create_channel_authenticated(hook_data_client_approval *);
|
|
|
|
|
2007-05-24 06:28:36 +02:00
|
|
|
mapi_hfn_list_av1 restrict_hfnlist[] = {
|
|
|
|
{ "can_create_channel", (hookfn) h_can_create_channel_authenticated },
|
|
|
|
{ NULL, NULL }
|
|
|
|
};
|
|
|
|
|
2016-03-07 07:31:41 +01:00
|
|
|
DECLARE_MODULE_AV2(createoperonly, NULL, NULL, NULL, NULL, restrict_hfnlist, NULL, NULL, restrict_desc);
|
2007-05-24 06:28:36 +02:00
|
|
|
|
|
|
|
static void
|
|
|
|
h_can_create_channel_authenticated(hook_data_client_approval *data)
|
|
|
|
{
|
2016-08-22 03:57:43 +02:00
|
|
|
client::client *source_p = data->client;
|
2007-05-24 06:28:36 +02:00
|
|
|
|
2016-08-24 00:25:09 +02:00
|
|
|
if (!is(*source_p, umode::OPER))
|
2007-05-24 06:28:36 +02:00
|
|
|
{
|
|
|
|
sendto_one_notice(source_p, ":*** Channel creation is restricted to network staff only.");
|
|
|
|
data->approved = ERR_NEEDREGGEDNICK;
|
|
|
|
}
|
|
|
|
}
|