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/inspircd11.cpp | |
| parent | 36602224b8b1a11326a224779d16bcb12f0ed532 (diff) | |
Optimizations of much of the more commonly used code
Diffstat (limited to 'modules/protocol/inspircd11.cpp')
| -rw-r--r-- | modules/protocol/inspircd11.cpp | 27 |
1 files changed, 11 insertions, 16 deletions
diff --git a/modules/protocol/inspircd11.cpp b/modules/protocol/inspircd11.cpp index 0761f478c..b6cb905c2 100644 --- a/modules/protocol/inspircd11.cpp +++ b/modules/protocol/inspircd11.cpp @@ -80,16 +80,14 @@ class InspIRCdProto : public IRCDProto return; /* ZLine if we can instead */ - try - { - if (x->GetUser() == "*") + if (x->GetUser() == "*" && x->GetHost().find_first_not_of("0123456789:.") == Anope::string::npos) + try { sockaddrs(x->GetHost()); IRCD->SendSZLineDel(x); return; } - } - catch (const SocketException &) { } + catch (const SocketException &) { } UplinkSocket::Message(OperServ) << "GLINE " << x->mask; } @@ -136,16 +134,14 @@ class InspIRCdProto : public IRCDProto } /* ZLine if we can instead */ - try - { - if (x->GetUser() == "*") + if (x->GetUser() == "*" && x->GetHost().find_first_not_of("0123456789:.") == Anope::string::npos) + try { sockaddrs(x->GetHost()); IRCD->SendSZLine(u, x); return; } - } - catch (const SocketException &) { } + catch (const SocketException &) { } // Calculate the time left before this would expire, capping it at 2 days time_t timeleft = x->expires - Anope::CurTime; @@ -203,7 +199,7 @@ class InspIRCdProto : public IRCDProto } /* JOIN */ - 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 << " " << c->creation_time; if (status) @@ -215,12 +211,11 @@ class InspIRCdProto : 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); } } @@ -653,7 +648,7 @@ struct IRCDMessageFJoin : IRCDMessage continue; } - sju.first.modes.insert(cm->name); + sju.first.AddMode(cm->mchar); } /* Erase the , */ buf.erase(buf.begin()); |
