solanum-vs-hackint-and-char.../extensions/createauthonly.c

40 lines
1.1 KiB
C
Raw Permalink Normal View History

/*
* This module restricts channel creation to authenticated users
* 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.
* -- nenolod
*/
#include "stdinc.h"
#include "modules.h"
#include "client.h"
#include "hook.h"
#include "ircd.h"
#include "send.h"
#include "s_conf.h"
#include "snomask.h"
#include "numeric.h"
#include "s_newconf.h"
static const char restrict_desc[] = "Restricts channel creation to authenticated users and IRC operators only";
2021-08-20 03:09:40 +00:00
static void h_can_create_channel_authenticated(void *);
mapi_hfn_list_av1 restrict_hfnlist[] = {
2021-08-20 03:09:40 +00:00
{ "can_create_channel", h_can_create_channel_authenticated },
{ NULL, NULL }
};
DECLARE_MODULE_AV2(createauthonly, NULL, NULL, NULL, NULL, restrict_hfnlist, NULL, NULL, restrict_desc);
static void
2021-08-20 03:09:40 +00:00
h_can_create_channel_authenticated(void *data_)
{
2021-08-20 03:09:40 +00:00
hook_data_client_approval *data = data_;
struct Client *source_p = data->client;
if (*source_p->user->suser == '\0' && !IsOperGeneral(source_p))
data->approved = ERR_NEEDREGGEDNICK;
}