summaryrefslogtreecommitdiff
path: root/src/channels.cpp
diff options
context:
space:
mode:
authorbrain <brain@e03df62e-2008-0410-955e-edbf42e46eb7>2006-09-27 07:56:01 +0000
committerbrain <brain@e03df62e-2008-0410-955e-edbf42e46eb7>2006-09-27 07:56:01 +0000
commit526dfce2251b5cf28e5731c0ee588cc00ed47bb8 (patch)
treecfd85f7d756ea20989d6927d05321d162966d337 /src/channels.cpp
parent9c322ab976d05b80df7b2e86281b6531bb85ae25 (diff)
Comments
git-svn-id: http://svn.inspircd.org/repository/trunk/inspircd@5349 e03df62e-2008-0410-955e-edbf42e46eb7
Diffstat (limited to 'src/channels.cpp')
-rw-r--r--src/channels.cpp15
1 files changed, 10 insertions, 5 deletions
diff --git a/src/channels.cpp b/src/channels.cpp
index 5e2ef907c..bfd676429 100644
--- a/src/channels.cpp
+++ b/src/channels.cpp
@@ -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);
}
}