]> git.netwichtig.de Git - user/henk/code/inspircd.git/commitdiff
Comments
authorbrain <brain@e03df62e-2008-0410-955e-edbf42e46eb7>
Wed, 27 Sep 2006 07:56:01 +0000 (07:56 +0000)
committerbrain <brain@e03df62e-2008-0410-955e-edbf42e46eb7>
Wed, 27 Sep 2006 07:56:01 +0000 (07:56 +0000)
git-svn-id: http://svn.inspircd.org/repository/trunk/inspircd@5349 e03df62e-2008-0410-955e-edbf42e46eb7

src/channels.cpp

index 5e2ef907c866da549c550019daf48e093f830979..bfd676429ead768a5229a678a9efbf266e5542a5 100644 (file)
@@ -892,6 +892,11 @@ const char* chanrec::GetPrefixChar(userrec *user)
        {
                if (n->second.size())
                {
+                       /* If the user has any prefixes, their highest prefix
+                        * will always be at the head of the list, as the list is
+                        * sorted in rank order highest first (see SetPrefix()
+                        * for reasons why)
+                        */
                        *pf = n->second.begin()->first;
                        return pf;
                }
@@ -973,11 +978,6 @@ int chanrec::GetStatus(userrec *user)
        return STATUS_NORMAL;
 }
 
-/*bool ModeParser::PrefixComparison(const prefixtype one, const prefixtype two)
-{       
-        return one.second > two.second;
-}*/
-
 void chanrec::SetPrefix(userrec* user, char prefix, unsigned int prefix_value, bool adding)
 {
        prefixlist::iterator n = prefixes.find(user);
@@ -989,6 +989,11 @@ void chanrec::SetPrefix(userrec* user, char prefix, unsigned int prefix_value, b
                        if (std::find(n->second.begin(), n->second.end(), pfx) == n->second.end())
                        {
                                n->second.push_back(pfx);
+                               /* We must keep prefixes in rank order, largest first.
+                                * This is for two reasons, firstly because x-chat *ass-u-me's* this
+                                * state, and secondly it turns out to be a benefit to us later.
+                                * See above in GetPrefix().
+                                */
                                std::sort(n->second.begin(), n->second.end(), ModeParser::PrefixComparison);
                        }
                }