summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorom <om@e03df62e-2008-0410-955e-edbf42e46eb7>2006-03-30 22:14:51 +0000
committerom <om@e03df62e-2008-0410-955e-edbf42e46eb7>2006-03-30 22:14:51 +0000
commit0974364c1a67edaffec275c5a65e72ba8289ac02 (patch)
tree8f14fa065cc54a621435aaf033c0d31bb79f2473
parent2c228fe6eba583df21a4c29356b7b16964675439 (diff)
Make chlist() use an ostringstream, should be faster
git-svn-id: http://svn.inspircd.org/repository/trunk/inspircd@3790 e03df62e-2008-0410-955e-edbf42e46eb7
-rw-r--r--src/message.cpp12
1 files changed, 4 insertions, 8 deletions
diff --git a/src/message.cpp b/src/message.cpp
index e9d634e76..655591607 100644
--- a/src/message.cpp
+++ b/src/message.cpp
@@ -401,12 +401,10 @@ char lst[MAXBUF];
std::string chlist(userrec *user,userrec* source)
{
/* Should this be a stringstream? Not sure if it would be faster as streams are more oriented at appending stuff, which is all we do */
- std::string lst;
+ std::ostringstream list;
if (!user || !source)
- {
- return lst;
- }
+ return "";
for (std::vector<ucrec*>::const_iterator i = user->chans.begin(); i != user->chans.end(); i++)
{
@@ -422,13 +420,11 @@ std::string chlist(userrec *user,userrec* source)
// if the user is the same as the source or is an oper, shortcircuit the comparison.
if ((source == user) || (*source->oper && Config->OperSpyWhois) || (((!rec->channel->modes[CM_PRIVATE]) && (!rec->channel->modes[CM_SECRET]) && !(user->modebits & UM_INVISIBLE)) || (rec->channel->HasUser(source))))
{
- lst += cmode(user, rec->channel);
- lst += rec->channel->name;
- lst += " ";
+ list << cmode(user, rec->channel) << rec->channel->name << " ";
}
//}
}
}
- return lst;
+ return list.str();
}