2007-01-25 07:40:21 +01:00
|
|
|
/*
|
|
|
|
* This module restricts channel creation to authenticated users
|
2007-12-18 00:15:54 +01:00
|
|
|
* and IRC operators 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.
|
2007-01-25 07:40:21 +01:00
|
|
|
* -- nenolod
|
|
|
|
*/
|
|
|
|
|
2016-07-01 05:04:00 +02:00
|
|
|
#include <ircd/stdinc.h>
|
|
|
|
#include <ircd/modules.h>
|
|
|
|
#include <ircd/client.h>
|
|
|
|
#include <ircd/hook.h>
|
|
|
|
#include <ircd/ircd.h>
|
|
|
|
#include <ircd/send.h>
|
|
|
|
#include <ircd/s_conf.h>
|
|
|
|
#include <ircd/snomask.h>
|
|
|
|
#include <ircd/numeric.h>
|
2007-01-25 07:40:21 +01:00
|
|
|
|
2016-03-07 07:31:41 +01:00
|
|
|
static const char restrict_desc[] = "Restricts channel creation to authenticated users and IRC operators only";
|
2007-01-25 07:40:21 +01:00
|
|
|
|
2016-03-09 08:29:41 +01:00
|
|
|
static void h_can_create_channel_authenticated(hook_data_client_approval *);
|
|
|
|
|
2007-01-25 07:40:21 +01: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(createauthonly, NULL, NULL, NULL, NULL, restrict_hfnlist, NULL, NULL, restrict_desc);
|
2007-01-25 07:40:21 +01:00
|
|
|
|
|
|
|
static void
|
|
|
|
h_can_create_channel_authenticated(hook_data_client_approval *data)
|
|
|
|
{
|
|
|
|
struct Client *source_p = data->client;
|
|
|
|
|
2007-12-18 00:15:54 +01:00
|
|
|
if (*source_p->user->suser == '\0' && !IsOper(source_p))
|
2007-01-25 07:40:21 +01:00
|
|
|
data->approved = ERR_NEEDREGGEDNICK;
|
|
|
|
}
|