From ca1b136b306784191235a6579da59f7e862003d1 Mon Sep 17 00:00:00 2001 From: danieldg Date: Sun, 13 Sep 2009 20:32:19 +0000 Subject: Fix GetPrefixChar returning empty if a non-prefix mode was used git-svn-id: http://svn.inspircd.org/repository/trunk/inspircd@11706 e03df62e-2008-0410-955e-edbf42e46eb7 --- src/channels.cpp | 18 ++++-------------- 1 file changed, 4 insertions(+), 14 deletions(-) (limited to 'src/channels.cpp') diff --git a/src/channels.cpp b/src/channels.cpp index 7f2cefd2b..0afbc93bb 100644 --- a/src/channels.cpp +++ b/src/channels.cpp @@ -914,7 +914,7 @@ const char* Channel::GetPrefixChar(User *user) { char mchar = m->second->modes[i]; ModeHandler* mh = ServerInstance->Modes->FindMode(mchar, MODETYPE_CHANNEL); - if (mh && mh->GetPrefixRank() > bestrank) + if (mh && mh->GetPrefixRank() > bestrank && mh->GetPrefix()) { bestrank = mh->GetPrefixRank(); pf[0] = mh->GetPrefix(); @@ -960,20 +960,10 @@ const char* Channel::GetAllPrefixChars(User* user) unsigned int Channel::GetPrefixValue(User* user) { - unsigned int bestrank = 0; - UserMembIter m = userlist.find(user); - if (m != userlist.end()) - { - for(unsigned int i=0; i < m->second->modes.length(); i++) - { - char mchar = m->second->modes[i]; - ModeHandler* mh = ServerInstance->Modes->FindMode(mchar, MODETYPE_CHANNEL); - if (mh && mh->GetPrefixRank() > bestrank) - bestrank = mh->GetPrefixRank(); - } - } - return bestrank; + if (m == userlist.end()) + return 0; + return m->second->getRank(); } void Channel::SetPrefix(User* user, char prefix, bool adding) -- cgit v1.2.3