summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAttila Molnar <attilamolnar@hush.com>2016-08-30 16:33:46 +0200
committerAttila Molnar <attilamolnar@hush.com>2016-08-30 16:33:46 +0200
commit6a35f493f316be130357dd2c75b64343a3aacdeb (patch)
tree3a481eb1ffff84f92e3e735d744a0b88c61e0963
parent1def7fd7f486d3d2d2999c4ee74392405db9ca7d (diff)
Return std::string from Membership::GetAllPrefixChars()
-rw-r--r--include/membership.h2
-rw-r--r--src/channels.cpp11
-rw-r--r--src/modules/m_check.cpp2
3 files changed, 6 insertions, 9 deletions
diff --git a/include/membership.h b/include/membership.h
index 92e0f790b..c952d09ae 100644
--- a/include/membership.h
+++ b/include/membership.h
@@ -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
* this when multiple prefixes are used names lists.
*/
- const char* GetAllPrefixChars() const;
+ std::string GetAllPrefixChars() const;
};
diff --git a/src/channels.cpp b/src/channels.cpp
index a757cdc5a..49fa75f98 100644
--- a/src/channels.cpp
+++ b/src/channels.cpp
@@ -611,20 +611,17 @@ unsigned int Membership::getRank()
return rv;
}
-const char* Membership::GetAllPrefixChars() const
+std::string Membership::GetAllPrefixChars() const
{
- static char prefix[64];
- int ctr = 0;
-
+ std::string ret;
for (std::string::const_iterator i = modes.begin(); i != modes.end(); ++i)
{
PrefixMode* mh = ServerInstance->Modes->FindPrefixMode(*i);
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)
diff --git a/src/modules/m_check.cpp b/src/modules/m_check.cpp
index 4330f410d..f4123466e 100644
--- a/src/modules/m_check.cpp
+++ b/src/modules/m_check.cpp
@@ -264,7 +264,7 @@ class CommandCheck : public Command
*/
const UserManager::CloneCounts& clonecount = ServerInstance->Users->GetCloneCounts(i->first);
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()));
}