2016-01-06 09:03:06 +01:00
|
|
|
/*
|
|
|
|
* Channel creation notices
|
|
|
|
*/
|
|
|
|
|
2016-08-13 05:05:54 +02:00
|
|
|
using namespace ircd;
|
|
|
|
|
2016-03-09 08:29:41 +01:00
|
|
|
static const char sno_desc[] =
|
|
|
|
"Adds server notice mask +l that allows operators to receive channel creation notices";
|
|
|
|
|
2016-01-06 09:03:06 +01:00
|
|
|
static int _modinit(void);
|
|
|
|
static void h_scc_channel_join(void *);
|
|
|
|
|
|
|
|
mapi_hfn_list_av1 scc_hfnlist[] = {
|
|
|
|
{ "channel_join", (hookfn) h_scc_channel_join },
|
|
|
|
{ NULL, NULL }
|
|
|
|
};
|
|
|
|
|
2016-08-28 13:12:44 +02:00
|
|
|
sno::mode SNO_CHANNELCREATE { 'l' };
|
|
|
|
|
|
|
|
DECLARE_MODULE_AV2(sno_channelcreate, _modinit, nullptr, NULL, NULL, scc_hfnlist, NULL, NULL, sno_desc);
|
2016-01-06 09:03:06 +01:00
|
|
|
|
|
|
|
static int
|
|
|
|
_modinit(void)
|
|
|
|
{
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
h_scc_channel_join(void *vdata)
|
|
|
|
{
|
|
|
|
hook_data_channel_activity *data = (hook_data_channel_activity *)vdata;
|
2016-08-18 07:33:38 +02:00
|
|
|
const auto chptr(data->chptr);
|
2016-08-22 03:57:43 +02:00
|
|
|
client::client *source_p = data->client;
|
2016-01-06 09:03:06 +01:00
|
|
|
|
|
|
|
/* If they just joined a channel, and it only has one member, then they just created it. */
|
2016-08-20 02:32:26 +02:00
|
|
|
if(size(chptr->members) == 1 && is_chanop(get(chptr->members, *source_p, std::nothrow)))
|
2016-01-06 09:03:06 +01:00
|
|
|
{
|
2016-08-28 13:12:44 +02:00
|
|
|
sendto_realops_snomask(SNO_CHANNELCREATE, L_NETWIDE, "%s is creating new channel %s",
|
2016-08-18 07:33:38 +02:00
|
|
|
source_p->name, chptr->name.c_str());
|
2016-01-06 09:03:06 +01:00
|
|
|
}
|
|
|
|
}
|