diff options
author | brain <brain@e03df62e-2008-0410-955e-edbf42e46eb7> | 2006-08-23 21:16:02 +0000 |
---|---|---|
committer | brain <brain@e03df62e-2008-0410-955e-edbf42e46eb7> | 2006-08-23 21:16:02 +0000 |
commit | 9f9e49509ea6d4c4ab0b70e15356d50e1376fdba (patch) | |
tree | 84ae7405049b5bb1f9b52f1759ea133e39c298ac /src/mode.cpp | |
parent | 594d430ee457b621c731a6cc70d84c02c295d59c (diff) |
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
Diffstat (limited to 'src/mode.cpp')
-rw-r--r-- | src/mode.cpp | 14 |
1 files changed, 12 insertions, 2 deletions
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<char,char> 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<char,unsigned int>(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) |