From afc96cde1f0bf2bf8fa14e04fcabe652735b63c0 Mon Sep 17 00:00:00 2001 From: brain Date: Mon, 28 Aug 2006 18:01:43 +0000 Subject: Zed, you are found guilty of over-assuming the IRC protocol and forcing ircd developers to sort lists during prefix adding. How do you plead. SOD THAT, YOURE GUILTY!!!!! git-svn-id: http://svn.inspircd.org/repository/trunk/inspircd@5052 e03df62e-2008-0410-955e-edbf42e46eb7 --- src/channels.cpp | 16 +++++++--------- 1 file changed, 7 insertions(+), 9 deletions(-) (limited to 'src/channels.cpp') diff --git a/src/channels.cpp b/src/channels.cpp index 780251f5f..ba4277eb5 100644 --- a/src/channels.cpp +++ b/src/channels.cpp @@ -921,20 +921,12 @@ const char* chanrec::GetAllPrefixChars(userrec* user) int ctr = 0; *prefix = 0; - /* Cheat and always put the highest first. - * This fixes a NASTY ass-umption in xchat. - */ - const char* first = this->GetPrefixChar(user); - if (*first) - prefix[ctr++] = *first; - prefixlist::iterator n = prefixes.find(user); if (n != prefixes.end()) { for (std::vector::iterator x = n->second.begin(); x != n->second.end(); x++) { - if (x->first != *first) - prefix[ctr++] = x->first; + prefix[ctr++] = x->first; } } @@ -1001,6 +993,11 @@ 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); @@ -1012,6 +1009,7 @@ 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); + std::sort(n->second.begin(), n->second.end(), ModeParser::PrefixComparison); } } else -- cgit v1.2.3