From a4fed1c1c767c8e31ffa47dc68ee7537ca28e317 Mon Sep 17 00:00:00 2001 From: brain Date: Thu, 14 Feb 2008 19:04:44 +0000 Subject: Duh, wasnt working when the user had NO prefixes at all! git-svn-id: http://svn.inspircd.org/repository/trunk/inspircd@8939 e03df62e-2008-0410-955e-edbf42e46eb7 --- src/mode.cpp | 19 +++++++++---------- 1 file changed, 9 insertions(+), 10 deletions(-) diff --git a/src/mode.cpp b/src/mode.cpp index 085a54326..a89e3ae19 100644 --- a/src/mode.cpp +++ b/src/mode.cpp @@ -516,14 +516,15 @@ void ModeParser::Process(const char** parameters, int pcnt, User *user, bool ser if (IS_LOCAL(user) && (MOD_RESULT == ACR_DENY)) continue; - if (IS_LOCAL(user) && (MOD_RESULT != ACR_ALLOW)) { + ServerInstance->Log(DEBUG,"Enter minimum prefix check"); /* Check access to this mode character */ if ((type == MODETYPE_CHANNEL) && (modehandlers[handler_id]->GetNeededPrefix())) { char needed = modehandlers[handler_id]->GetNeededPrefix(); ModeHandler* prefixmode = FindPrefix(needed); + ServerInstance->Log(DEBUG,"Needed prefix: %c", needed); if (prefixmode) { unsigned int neededrank = prefixmode->GetPrefixRank(); @@ -533,16 +534,14 @@ void ModeParser::Process(const char** parameters, int pcnt, User *user, bool ser * first, so we don't need to iterate, we just look up the first instead. */ std::string modestring = targetchannel->GetAllPrefixChars(user); - if (!modestring.empty()) + char ml = (modestring.empty() ? '\0' : modestring[0]); + ModeHandler* ourmode = FindPrefix(ml); + if (!ourmode || ourmode->GetPrefixRank() < neededrank) { - ModeHandler* ourmode = FindPrefix(modestring[0]); - if (!ourmode || ourmode->GetPrefixRank() < neededrank) - { - /* Bog off */ - user->WriteServ("482 %s %s :You require channel privilege '%c' or above to execute channel mode '%c'", - user->nick, targetchannel->name, needed, modechar); - continue; - } + /* Bog off */ + user->WriteServ("482 %s %s :You require channel privilege '%c' or above to execute channel mode '%c'", + user->nick, targetchannel->name, needed, modechar); + continue; } } } -- cgit v1.2.3