From 0e98ca83b5ed6a0f8ed5ec3a6ea80014cb6dea6c Mon Sep 17 00:00:00 2001 From: Attila Molnar Date: Fri, 20 Jun 2014 16:29:40 +0200 Subject: Reject nickname case changes too when enforcing --- src/users.cpp | 28 +++++++++++++++------------- 1 file changed, 15 insertions(+), 13 deletions(-) (limited to 'src') diff --git a/src/users.cpp b/src/users.cpp index 8b34cfe8d..87e40a53e 100644 --- a/src/users.cpp +++ b/src/users.cpp @@ -628,6 +628,21 @@ bool User::ChangeNick(const std::string& newnick, bool force, time_t newts) // If a module denied the change, abort now if (MOD_RESULT == MOD_RES_DENY) return false; + + // Disallow the nick change if is on and there is a ban matching this user in + // one of the channels they are on + if (ServerInstance->Config->RestrictBannedUsers) + { + for (UCListIter i = this->chans.begin(); i != this->chans.end(); ++i) + { + Channel* chan = (*i)->chan; + if (chan->GetPrefixValue(this) < VOICE_VALUE && chan->IsBanned(this)) + { + this->WriteNumeric(ERR_CANNOTSENDTOCHAN, "%s :Cannot send to channel (you're banned)", chan->name.c_str()); + return false; + } + } + } } if (assign(newnick) == assign(nick)) @@ -661,19 +676,6 @@ bool User::ChangeNick(const std::string& newnick, bool force, time_t newts) this->WriteNumeric(ERR_ERRONEUSNICKNAME, "%s :Invalid nickname: %s", newnick.c_str(), mq->reason.c_str()); return false; } - - if (ServerInstance->Config->RestrictBannedUsers) - { - for (UCListIter i = this->chans.begin(); i != this->chans.end(); i++) - { - Channel* chan = (*i)->chan; - if (chan->GetPrefixValue(this) < VOICE_VALUE && chan->IsBanned(this)) - { - this->WriteNumeric(ERR_CANNOTSENDTOCHAN, "%s :Cannot send to channel (you're banned)", chan->name.c_str()); - return false; - } - } - } } /* -- cgit v1.2.3