Return std::string from Membership::GetAllPrefixChars()

This commit is contained in:
Attila Molnar 2016-08-30 16:33:46 +02:00
parent 1def7fd7f4
commit 6a35f493f3
3 changed files with 6 additions and 9 deletions

View File

@ -110,5 +110,5 @@ class CoreExport Membership : public Extensible, public insp::intrusive_list_nod
* be in rank order, greatest first, as certain IRC clients require * be in rank order, greatest first, as certain IRC clients require
* this when multiple prefixes are used names lists. * this when multiple prefixes are used names lists.
*/ */
const char* GetAllPrefixChars() const; std::string GetAllPrefixChars() const;
}; };

View File

@ -611,20 +611,17 @@ unsigned int Membership::getRank()
return rv; return rv;
} }
const char* Membership::GetAllPrefixChars() const std::string Membership::GetAllPrefixChars() const
{ {
static char prefix[64]; std::string ret;
int ctr = 0;
for (std::string::const_iterator i = modes.begin(); i != modes.end(); ++i) for (std::string::const_iterator i = modes.begin(); i != modes.end(); ++i)
{ {
PrefixMode* mh = ServerInstance->Modes->FindPrefixMode(*i); PrefixMode* mh = ServerInstance->Modes->FindPrefixMode(*i);
if (mh && mh->GetPrefix()) if (mh && mh->GetPrefix())
prefix[ctr++] = mh->GetPrefix(); ret.push_back(mh->GetPrefix());
} }
prefix[ctr] = 0;
return prefix; return ret;
} }
unsigned int Channel::GetPrefixValue(User* user) unsigned int Channel::GetPrefixValue(User* user)

View File

@ -264,7 +264,7 @@ class CommandCheck : public Command
*/ */
const UserManager::CloneCounts& clonecount = ServerInstance->Users->GetCloneCounts(i->first); const UserManager::CloneCounts& clonecount = ServerInstance->Users->GetCloneCounts(i->first);
context.Write("member", InspIRCd::Format("%-3u %s%s (%s@%s) %s ", clonecount.global, context.Write("member", InspIRCd::Format("%-3u %s%s (%s@%s) %s ", clonecount.global,
i->second->GetAllPrefixChars(), i->first->nick.c_str(), i->second->GetAllPrefixChars().c_str(), i->first->nick.c_str(),
i->first->ident.c_str(), i->first->dhost.c_str(), i->first->fullname.c_str())); i->first->ident.c_str(), i->first->dhost.c_str(), i->first->fullname.c_str()));
} }