From f9e91eceaaee7fa62dcf817fa092f2f4f3f23eb7 Mon Sep 17 00:00:00 2001 From: "B.Greenham" Date: Tue, 23 Feb 2010 18:14:43 -0500 Subject: [PATCH] Add chmode +E, which prevents ops from using /kick on channels where it is set. --- help/opers/cmode | 2 ++ include/channel.h | 1 + include/numeric.h | 2 ++ modules/core/m_kick.c | 8 ++++++++ src/chmode.c | 2 +- src/messages.tab | 2 +- 6 files changed, 15 insertions(+), 2 deletions(-) diff --git a/help/opers/cmode b/help/opers/cmode index c3f84b0..751c1a0 100644 --- a/help/opers/cmode +++ b/help/opers/cmode @@ -31,6 +31,8 @@ NO PARAMETERS: +D - Disable CTCP ACTION. All CTCP ACTIONs to the channel will be blocked. +T - Disable notice. All notices to the channel are disallowed. + +E - No kicks. Chanops will not be able to use /kick on this + channel. WITH PARAMETERS: +f - Forward. Forwards users who cannot join because of +i, diff --git a/include/channel.h b/include/channel.h index c9c3ee1..4939ff9 100644 --- a/include/channel.h +++ b/include/channel.h @@ -174,6 +174,7 @@ typedef int (*ExtbanFunc)(const char *data, struct Client *client_p, #define MODE_NOCTCP 0x8000 /* Block CTCPs directed to this channel */ #define MODE_NONOTICE 0x16000 /* Block notices directed to this channel */ #define MODE_NOACTION 0x32000 /* Block CTCP ACTION directed to this channel */ +#define MODE_NOKICK 0x64000 /* Disable /kick on this channel */ #define CHFL_BAN 0x10000000 /* ban channel flag */ #define CHFL_EXCEPTION 0x20000000 /* exception to ban channel flag */ diff --git a/include/numeric.h b/include/numeric.h index 1648189..e8cc0f2 100644 --- a/include/numeric.h +++ b/include/numeric.h @@ -319,6 +319,8 @@ extern const char *form_str(int); #define ERR_DISABLED 517 /* from ircu */ +#define ERR_NOKICK 519 /* from old shadow */ + #define ERR_HELPNOTFOUND 524 #define RPL_WHOISSECURE 671 /* Unreal3.2 --nenolod */ diff --git a/modules/core/m_kick.c b/modules/core/m_kick.c index 88befac..841485f 100644 --- a/modules/core/m_kick.c +++ b/modules/core/m_kick.c @@ -158,6 +158,14 @@ m_kick(struct Client *client_p, struct Client *source_p, int parc, const char *p return 0; } + if(MyClient(source_p) && chptr->mode.mode & MODE_NOKICK) + { + sendto_one_numeric(source_p, ERR_NOKICK, + form_str(ERR_NOKICK), + chptr->chname); + return 0; + } + if(MyClient(source_p)) { hook_data_channel_approval hookdata; diff --git a/src/chmode.c b/src/chmode.c index 7095ade..a1fbbce 100644 --- a/src/chmode.c +++ b/src/chmode.c @@ -1401,7 +1401,7 @@ struct ChannelMode chmode_table[256] = {chm_nosuch, 0 }, /* B */ {chm_simple, MODE_NOCTCP }, /* C */ {chm_simple, MODE_NOACTION }, /* D */ - {chm_nosuch, 0 }, /* E */ + {chm_simple, MODE_NOKICK }, /* E */ {chm_simple, MODE_FREETARGET }, /* F */ {chm_nosuch, 0 }, /* G */ {chm_nosuch, 0 }, /* H */ diff --git a/src/messages.tab b/src/messages.tab index cce3b41..c24ebd2 100644 --- a/src/messages.tab +++ b/src/messages.tab @@ -540,7 +540,7 @@ static const char * replies[] = { /* 516 */ NULL, /* 517 ERR_DISABLED */ "%s :This command has been administratively disabled", /* 518 */ NULL, -/* 519 */ NULL, +/* 519 ERR_NOKICK */ "%s :You cannot kick users in this channel because +E is set", /* 520 */ NULL, /* 521 */ NULL, /* 522 */ NULL,