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 /modules/protocol/ngircd.cpp | |
parent | 36602224b8b1a11326a224779d16bcb12f0ed532 (diff) |
Optimizations of much of the more commonly used code
Diffstat (limited to 'modules/protocol/ngircd.cpp')
-rw-r--r-- | modules/protocol/ngircd.cpp | 24 |
1 files changed, 7 insertions, 17 deletions
diff --git a/modules/protocol/ngircd.cpp b/modules/protocol/ngircd.cpp index e54a4f8f7..ef226f87e 100644 --- a/modules/protocol/ngircd.cpp +++ b/modules/protocol/ngircd.cpp @@ -83,7 +83,7 @@ class ngIRCdProto : public IRCDProto UplinkSocket::Message(Me) << "WALLOPS :" << buf; } - void SendJoin(const User *user, Channel *c, const ChannelStatus *status) anope_override + void SendJoin(User *user, Channel *c, const ChannelStatus *status) anope_override { UplinkSocket::Message(user) << "JOIN " << c->name; if (status) @@ -95,12 +95,11 @@ class ngIRCdProto : public IRCDProto */ ChanUserContainer *uc = c->FindUser(user); if (uc != NULL) - uc->status.modes.clear(); + uc->status.Clear(); BotInfo *setter = BotInfo::Find(user->nick); - for (unsigned i = 0; i < ModeManager::ChannelModes.size(); ++i) - if (cs.modes.count(ModeManager::ChannelModes[i]->name)) - c->SetMode(setter, ModeManager::ChannelModes[i], user->GetUID(), false); + for (size_t i = 0; i < cs.Modes().length(); ++i) + c->SetMode(setter, ModeManager::FindChannelModeByChar(cs.Modes()[i]), user->GetUID(), false); } } @@ -245,10 +244,8 @@ struct IRCDMessageChaninfo : IRCDMessage */ void Run(MessageSource &source, const std::vector<Anope::string> ¶ms) anope_override { - - Channel *c = Channel::Find(params[0]); - if (!c) - c = new Channel(params[0]); + bool created; + Channel *c = Channel::FindOrCreate(params[0], created); Anope::string modes = params[1]; @@ -470,15 +467,8 @@ struct IRCDMessageNJoin : IRCDMessage /* Get prefixes from the nick */ for (char ch; (ch = ModeManager::GetStatusChar(buf[0]));) { - ChannelMode *cm = ModeManager::FindChannelModeByChar(ch); buf.erase(buf.begin()); - if (!cm) - { - Log(LOG_DEBUG) << "Received unknown mode prefix " << ch << " in NJOIN string."; - continue; - } - - sju.first.modes.insert(cm->name); + sju.first.AddMode(ch); } sju.second = User::Find(buf); |