From 706b5a5a5bebb7fb25f2ec91a9fe48837ec200c8 Mon Sep 17 00:00:00 2001 From: Attila Molnar Date: Fri, 5 Sep 2014 15:06:21 +0200 Subject: Unset oper-only modes in User::UnOper() in a more sensible way Get the user mode list from the ModeParser instead of trying all possible mode letters --- src/users.cpp | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/users.cpp b/src/users.cpp index 4f9b6c945..9dcbcae0c 100644 --- a/src/users.cpp +++ b/src/users.cpp @@ -450,10 +450,11 @@ void User::UnOper() /* Remove all oper only modes from the user when the deoper - Bug #466*/ Modes::ChangeList changelist; - for (unsigned char letter = 'A'; letter <= 'z'; letter++) + const ModeParser::ModeHandlerMap& usermodes = ServerInstance->Modes->GetModes(MODETYPE_USER); + for (ModeParser::ModeHandlerMap::const_iterator i = usermodes.begin(); i != usermodes.end(); ++i) { - ModeHandler* mh = ServerInstance->Modes->FindMode(letter, MODETYPE_USER); - if (mh && mh->NeedsOper()) + ModeHandler* mh = i->second; + if (mh->NeedsOper()) changelist.push_remove(mh); } -- cgit v1.2.3