diff options
author | Adam <Adam@anope.org> | 2013-04-07 23:46:44 -0500 |
---|---|---|
committer | Adam <Adam@anope.org> | 2013-04-07 23:46:44 -0500 |
commit | fb7fef7a849342ab8463743497e781c5c3e6ae88 (patch) | |
tree | 5d230a68b6eed70c7b4f718410dd62fea779654c /src/messages.cpp | |
parent | 36602224b8b1a11326a224779d16bcb12f0ed532 (diff) |
Optimizations of much of the more commonly used code
Diffstat (limited to 'src/messages.cpp')
-rw-r--r-- | src/messages.cpp | 15 |
1 files changed, 7 insertions, 8 deletions
diff --git a/src/messages.cpp b/src/messages.cpp index 567a24b6a..178d376c3 100644 --- a/src/messages.cpp +++ b/src/messages.cpp @@ -64,7 +64,7 @@ void Join::Run(MessageSource &source, const std::vector<Anope::string> ¶ms) { for (User::ChanUserList::iterator it = user->chans.begin(), it_end = user->chans.end(); it != it_end; ) { - ChanUserContainer *cc = *it++; + ChanUserContainer *cc = it->second++; Anope::string channame = cc->chan->name; FOREACH_MOD(I_OnPrePartChannel, OnPrePartChannel(user, cc->chan)); @@ -84,14 +84,12 @@ void Join::Run(MessageSource &source, const std::vector<Anope::string> ¶ms) void Join::SJoin(MessageSource &source, const Anope::string &chan, time_t ts, const Anope::string &modes, const std::list<SJoinUser> &users) { - Channel *c = Channel::Find(chan); + bool created; + Channel *c = Channel::FindOrCreate(chan, created, ts ? ts : Anope::CurTime); bool keep_their_modes = true; - if (!c) - { - c = new Channel(chan, ts ? ts : Anope::CurTime); + if (created) c->Extend("SYNCING"); - } /* Some IRCds do not include a TS */ else if (!ts) ; @@ -124,7 +122,8 @@ void Join::SJoin(MessageSource &source, const Anope::string &chan, time_t ts, co ChanUserContainer *cc = c->JoinUser(u); /* Update their status internally on the channel */ - cc->status = status; + if (keep_their_modes) + cc->status = status; /* Set whatever modes the user should have, and remove any that * they aren't allowed to have (secureops etc). @@ -193,7 +192,7 @@ void Kill::Run(MessageSource &source, const std::vector<Anope::string> ¶ms) bi->introduced = true; for (User::ChanUserList::const_iterator cit = bi->chans.begin(), cit_end = bi->chans.end(); cit != cit_end; ++cit) - IRCD->SendJoin(bi, (*cit)->chan, &(*cit)->status); + IRCD->SendJoin(bi, cit->second->chan, &cit->second->status); } else u->KillInternal(source.GetSource(), params[1]); |