]> git.netwichtig.de Git - user/henk/code/inspircd.git/commitdiff
Fix and finish 005 numeric. PREFIX= is now calculated automatically if you add any...
authorbrain <brain@e03df62e-2008-0410-955e-edbf42e46eb7>
Wed, 23 Aug 2006 21:16:02 +0000 (21:16 +0000)
committerbrain <brain@e03df62e-2008-0410-955e-edbf42e46eb7>
Wed, 23 Aug 2006 21:16:02 +0000 (21:16 +0000)
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

src/mode.cpp

index 301fbc872f6116120af384d02ed3616637ec4857..3a0937d91f9624d1d91020e8c3c9606dd86b43e8 100644 (file)
@@ -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)