mirror of
https://github.com/matrix-construct/construct
synced 2024-11-30 10:42:47 +01:00
61b517ca3c
* To benefit from the precompiled-header (PCH) it MUST provide "the first C token." Advantages: Never worry about the include stack again. Remember, this means one less thing for random module developers, community people learning C++, and new developers to deal with. It should reduce the learning curve and barrier for participation. Disadvantages: Makes overall compilation a bit slower, especially without any additional work to improve it again. There are several opportunities, places where the PCH is probably being ignored, etc that can be addressed.
29 lines
949 B
C++
29 lines
949 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)
|
|
{
|
|
struct Client *source_p = data->client;
|
|
|
|
if (*source_p->user->suser == '\0' && !IsOper(source_p))
|
|
data->approved = ERR_NEEDREGGEDNICK;
|
|
}
|