From: brain Date: Wed, 23 Aug 2006 21:16:02 +0000 (+0000) Subject: Fix and finish 005 numeric. PREFIX= is now calculated automatically if you add any... X-Git-Tag: v2.0.23~7327 X-Git-Url: https://git.netwichtig.de/gitweb/?a=commitdiff_plain;h=9f9e49509ea6d4c4ab0b70e15356d50e1376fdba;p=user%2Fhenk%2Fcode%2Finspircd.git Fix and finish 005 numeric. PREFIX= is now calculated automatically if you add any prefixes. You do not need to mess with the numeric yourself. git-svn-id: http://svn.inspircd.org/repository/trunk/inspircd@5001 e03df62e-2008-0410-955e-edbf42e46eb7 --- diff --git a/src/mode.cpp b/src/mode.cpp index 301fbc872..3a0937d91 100644 --- a/src/mode.cpp +++ b/src/mode.cpp @@ -644,7 +644,7 @@ std::string ModeParser::ParaModeList() bool ModeParser::PrefixComparison(const prefixtype one, const prefixtype two) { - return (one.second) < (two.second); + return one.second > two.second; } std::string ModeParser::BuildPrefixes() @@ -652,18 +652,28 @@ std::string ModeParser::BuildPrefixes() std::string mletters = ""; std::string mprefixes = ""; pfxcontainer pfx; + std::map prefix_to_mode; for (unsigned char mode = 'A'; mode <= 'z'; mode++) { unsigned char pos = (mode-65) | MASK_CHANNEL; if ((modehandlers[pos]) && (modehandlers[pos]->GetPrefix())) + { pfx.push_back(std::make_pair(modehandlers[pos]->GetPrefix(), modehandlers[pos]->GetPrefixRank())); + prefix_to_mode[modehandlers[pos]->GetPrefix()] = modehandlers[pos]->GetModeChar(); + } } sort(pfx.begin(), pfx.end(), ModeParser::PrefixComparison); - return ""; + for (pfxcontainer::iterator n = pfx.begin(); n != pfx.end(); n++) + { + mletters = mletters + n->first; + mprefixes = mprefixes + prefix_to_mode.find(n->first)->second; + } + + return "(" + mprefixes + ")" + mletters; } bool ModeParser::AddModeWatcher(ModeWatcher* mw)