From 8169c34a6459c70677a72087f700c867fcc9c69a Mon Sep 17 00:00:00 2001 From: Travis McArthur Date: Sat, 7 Jun 2014 21:09:49 -0700 Subject: [PATCH] Change error messages for bad access in modes --- src/modules/chanmodes/adminonly.c | 5 ++++- src/modules/chanmodes/noknock.c | 7 ++----- src/modules/chanmodes/operonly.c | 5 ++++- 3 files changed, 10 insertions(+), 7 deletions(-) diff --git a/src/modules/chanmodes/adminonly.c b/src/modules/chanmodes/adminonly.c index 41383525d..7e1503a6e 100644 --- a/src/modules/chanmodes/adminonly.c +++ b/src/modules/chanmodes/adminonly.c @@ -120,9 +120,12 @@ DLLFUNC int adminonly_topic_allow (aClient *sptr, aChannel *chptr) DLLFUNC int adminonly_require_admin(aClient *cptr, aChannel *chptr, char mode, char *para, int checkt, int what) { - if (!MyClient(cptr) || (IsSkoAdmin(cptr) && is_chan_op(cptr, chptr))) + if (!MyClient(cptr) || IsSkoAdmin(cptr)) return EX_ALLOW; + + sendto_one(cptr, err_str(ERR_CANNOTCHANGECHANMODE), + me.name, cptr->name, 'A', "You are not an Admin"); return EX_DENY; } diff --git a/src/modules/chanmodes/noknock.c b/src/modules/chanmodes/noknock.c index 336b93b56..7b330b449 100644 --- a/src/modules/chanmodes/noknock.c +++ b/src/modules/chanmodes/noknock.c @@ -117,16 +117,13 @@ DLLFUNC int noknock_mode_del (aChannel *chptr, int modeChar) DLLFUNC int noknock_mode_allow(aClient *cptr, aChannel *chptr, char mode, char *para, int checkt, int what) { - if (MyClient(cptr) && !is_chanop(cptr,chptr)) - return EX_DENY; - - if ((mode & EXTCMODE_NOKNOCK) && !(chptr->mode.mode & MODE_INVITEONLY)) + if (!(chptr->mode.mode & MODE_INVITEONLY)) { sendto_one(cptr, err_str(ERR_CANNOTCHANGECHANMODE), me.name, cptr->name, 'K', "+i must be set"); return EX_DENY; } - return EX_ALLOW; + return extcmode_default_requirechop(cptr,chptr,mode,para,checkt,what); } diff --git a/src/modules/chanmodes/operonly.c b/src/modules/chanmodes/operonly.c index 0f01f4c0c..612d9284b 100644 --- a/src/modules/chanmodes/operonly.c +++ b/src/modules/chanmodes/operonly.c @@ -119,9 +119,12 @@ DLLFUNC int operonly_topic_allow (aClient *sptr, aChannel *chptr) DLLFUNC int operonly_require_oper(aClient *cptr, aChannel *chptr, char mode, char *para, int checkt, int what) { - if (!MyClient(cptr) || (IsAnOper(cptr) && is_chan_op(cptr, chptr))) + if (!MyClient(cptr) || IsAnOper(cptr)) return EX_ALLOW; + + sendto_one(cptr, err_str(ERR_CANNOTCHANGECHANMODE), + me.name, cptr->name, 'O', "You are not an IRC operator"); return EX_DENY; }