0
0
Fork 0
mirror of https://github.com/matrix-construct/construct synced 2024-11-05 21:38:54 +01:00
construct/extensions/createauthonly.cc
Jason Volk dd9124b687 Preliminary Client refactor.
Add client to ircd::client:: namespace.

Also move former struct User and struct Server into client.cc as
opaque structure demo.
2016-08-22 15:56:12 -07:00

29 lines
950 B
C++

/*
* 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
*/
using namespace ircd;
static const char restrict_desc[] = "Restricts channel creation to authenticated users and IRC operators only";
static void h_can_create_channel_authenticated(hook_data_client_approval *);
mapi_hfn_list_av1 restrict_hfnlist[] = {
{ "can_create_channel", (hookfn) h_can_create_channel_authenticated },
{ NULL, NULL }
};
DECLARE_MODULE_AV2(createauthonly, NULL, NULL, NULL, NULL, restrict_hfnlist, NULL, NULL, restrict_desc);
static void
h_can_create_channel_authenticated(hook_data_client_approval *data)
{
client::client *source_p = data->client;
if (suser(user(*source_p)).empty() && !IsOper(source_p))
data->approved = ERR_NEEDREGGEDNICK;
}