aboutsummaryrefslogtreecommitdiffstats
path: root/src/channels.cpp
diff options
context:
space:
mode:
authorGravatar Daniel De Graaf2010-04-12 18:22:44 -0500
committerGravatar Daniel De Graaf2010-08-03 17:32:42 -0400
commitc120a4e37f8d13f0e2540e2534bd7cc36e1f1950 (patch)
treea0415046bbde3c687bf87c2b48b9963bdf9861ab /src/channels.cpp
parentRemove unneeded copy of server name for every remote user (diff)
Make irc::string faster and less wasteful
Change irc::string from an std::basic_string typedef to a wrapper around an std::string, to avoid unneeded copies in assign().
Diffstat (limited to 'src/channels.cpp')
-rw-r--r--src/channels.cpp16
1 files changed, 9 insertions, 7 deletions
diff --git a/src/channels.cpp b/src/channels.cpp
index a41c3857c..d8ed730e9 100644
--- a/src/channels.cpp
+++ b/src/channels.cpp
@@ -17,13 +17,15 @@
Channel::Channel(const std::string &cname, time_t ts)
{
- chan_hash::iterator findchan = ServerInstance->chanlist->find(cname);
+ name.assign(cname, 0, ServerInstance->Config->Limits.ChanMax);
+ age = ts ? ts : ServerInstance->Time();
+
+ chan_hash::iterator findchan = ServerInstance->chanlist->find(name);
if (findchan != ServerInstance->chanlist->end())
- throw CoreException("Cannot create duplicate channel " + cname);
+ throw CoreException("Cannot create duplicate channel " + name);
+
- (*(ServerInstance->chanlist))[cname.c_str()] = this;
- this->name.assign(cname, 0, ServerInstance->Config->Limits.ChanMax);
- this->age = ts ? ts : ServerInstance->Time();
+ ServerInstance->chanlist->insert(std::make_pair(name, this));
maxbans = topicset = 0;
modebits.reset();
@@ -294,7 +296,7 @@ Channel* Channel::JoinUser(User *user, const char* cn, bool override, const char
else if (MOD_RESULT == MOD_RES_PASSTHRU)
{
std::string ckey = Ptr->GetModeParameter('k');
- bool invited = IS_LOCAL(user)->IsInvited(Ptr->name.c_str());
+ bool invited = IS_LOCAL(user)->IsInvited(Ptr->name);
bool can_bypass = ServerInstance->Config->InvBypassModes && invited;
if (!ckey.empty())
@@ -341,7 +343,7 @@ Channel* Channel::JoinUser(User *user, const char* cn, bool override, const char
*/
if (invited)
{
- IS_LOCAL(user)->RemoveInvite(Ptr->name.c_str());
+ IS_LOCAL(user)->RemoveInvite(Ptr->name);
}
}
}