2016-01-13 23:52:56 +01:00
|
|
|
/*
|
|
|
|
* Do not allow operators to be kicked from +M channels.
|
|
|
|
* -- kaniini
|
|
|
|
*/
|
|
|
|
|
2016-08-13 05:05:54 +02:00
|
|
|
using namespace ircd;
|
|
|
|
|
2016-03-07 06:48:27 +01:00
|
|
|
static const char chm_operpeace_desc[] =
|
|
|
|
"Adds channel mode +M which prohibits operators from being kicked";
|
2016-01-13 23:52:56 +01:00
|
|
|
|
2016-03-09 08:29:41 +01:00
|
|
|
static void hdl_can_kick(hook_data_channel_approval *);
|
|
|
|
|
2016-01-13 23:52:56 +01:00
|
|
|
mapi_hfn_list_av1 chm_operpeace_hfnlist[] = {
|
|
|
|
{ "can_kick", (hookfn) hdl_can_kick },
|
|
|
|
{ NULL, NULL }
|
|
|
|
};
|
|
|
|
|
2016-08-17 05:01:20 +02:00
|
|
|
static chan::mode::type mymode;
|
2016-01-13 23:52:56 +01:00
|
|
|
|
|
|
|
static int
|
|
|
|
_modinit(void)
|
|
|
|
{
|
2016-08-17 05:01:20 +02:00
|
|
|
using namespace chan::mode;
|
|
|
|
|
|
|
|
mymode = add('M', category::D, functor::hidden);
|
2016-01-13 23:52:56 +01:00
|
|
|
if (mymode == 0)
|
|
|
|
return -1;
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
_moddeinit(void)
|
|
|
|
{
|
2016-08-17 05:01:20 +02:00
|
|
|
chan::mode::orphan('M');
|
2016-01-13 23:52:56 +01:00
|
|
|
}
|
|
|
|
|
2016-03-07 06:48:27 +01:00
|
|
|
DECLARE_MODULE_AV2(chm_operpeace, _modinit, _moddeinit, NULL, NULL, chm_operpeace_hfnlist, NULL, NULL, chm_operpeace_desc);
|
2016-01-13 23:52:56 +01:00
|
|
|
|
|
|
|
static void
|
|
|
|
hdl_can_kick(hook_data_channel_approval *data)
|
|
|
|
{
|
2016-08-22 03:57:43 +02:00
|
|
|
client::client *source_p = data->client;
|
|
|
|
client::client *who = data->target;
|
2016-08-18 07:33:38 +02:00
|
|
|
const auto &chptr(data->chptr);
|
2016-01-13 23:52:56 +01:00
|
|
|
|
2016-08-24 00:25:09 +02:00
|
|
|
if(is(*source_p, umode::OPER))
|
2016-01-13 23:52:56 +01:00
|
|
|
return;
|
|
|
|
|
2016-08-24 00:25:09 +02:00
|
|
|
if((chptr->mode.mode & mymode) && is(*who, umode::OPER))
|
2016-01-13 23:52:56 +01:00
|
|
|
{
|
2016-08-26 13:50:12 +02:00
|
|
|
sendto_realops_snomask(sno::GENERAL, L_NETWIDE, "%s attempted to kick %s from %s (which is +M)",
|
2016-08-18 07:33:38 +02:00
|
|
|
source_p->name, who->name, chptr->name.c_str());
|
2016-01-13 23:52:56 +01:00
|
|
|
sendto_one_numeric(source_p, ERR_ISCHANSERVICE, "%s %s :Cannot kick IRC operators from that channel.",
|
2016-08-18 07:33:38 +02:00
|
|
|
who->name, chptr->name.c_str());
|
2016-01-13 23:52:56 +01:00
|
|
|
data->approved = 0;
|
|
|
|
}
|
|
|
|
}
|