diff options
Diffstat (limited to 'modules/protocol')
-rw-r--r-- | modules/protocol/bahamut.cpp | 9 | ||||
-rw-r--r-- | modules/protocol/charybdis.cpp | 2 | ||||
-rw-r--r-- | modules/protocol/hybrid.cpp | 23 | ||||
-rw-r--r-- | modules/protocol/inspircd20.cpp | 34 | ||||
-rw-r--r-- | modules/protocol/ngircd.cpp | 3 | ||||
-rw-r--r-- | modules/protocol/plexus.cpp | 11 | ||||
-rw-r--r-- | modules/protocol/ratbox.cpp | 8 | ||||
-rw-r--r-- | modules/protocol/unreal.cpp | 35 |
8 files changed, 82 insertions, 43 deletions
diff --git a/modules/protocol/bahamut.cpp b/modules/protocol/bahamut.cpp index c320f3a3e..c7e5c45f1 100644 --- a/modules/protocol/bahamut.cpp +++ b/modules/protocol/bahamut.cpp @@ -192,24 +192,24 @@ class BahamutIRCdProto : public IRCDProto { /* No user (this akill was just added), and contains nick and/or realname. Find users that match and ban them */ for (user_map::const_iterator it = UserListByNick.begin(); it != UserListByNick.end(); ++it) - if (x->manager->Check(it->second, x)) + if (x->GetManager()->Check(it->second, x)) this->SendAkill(it->second, x); return; } XLine *old = x; - if (old->manager->HasEntry("*@" + u->host)) + if (old->GetManager()->HasEntry("*@" + u->host)) return; /* We can't akill x as it has a nick and/or realname included, so create a new akill for *@host */ - x = new XLine(xline); + x = Serialize::New<XLine *>(); x->SetMask("*@" + u->host); x->SetBy(old->GetBy()); x->SetExpires(old->GetExpires()); x->SetReason(old->GetReason()); x->SetID(old->GetID()); - old->manager->AddXLine(x); + old->GetManager()->AddXLine(x); Log(Config->GetClient("OperServ"), "akill") << "AKILL: Added an akill for " << x->GetMask() << " because " << u->GetMask() << "#" << u->realname << " matches " << old->GetMask(); } @@ -509,6 +509,7 @@ class ProtoBahamut : public Module public: ProtoBahamut(const Anope::string &modname, const Anope::string &creator) : Module(modname, creator, PROTOCOL | VENDOR) + , EventHook<Event::UserNickChange>(this) , ircd_proto(this) , message_away(this) , message_capab(this) diff --git a/modules/protocol/charybdis.cpp b/modules/protocol/charybdis.cpp index fc59a7214..c37e8aab0 100644 --- a/modules/protocol/charybdis.cpp +++ b/modules/protocol/charybdis.cpp @@ -176,7 +176,7 @@ struct IRCDMessageEncap : IRCDMessage if (params[1] == "CERTFP") { u->fingerprint = params[2]; - Event::OnFingerprint(&Event::Fingerprint::OnFingerprint, u); + EventManager::Get()->Dispatch(&Event::Fingerprint::OnFingerprint, u); } /* * Received: :42X ENCAP * SASL 42XAAAAAH * S PLAIN diff --git a/modules/protocol/hybrid.cpp b/modules/protocol/hybrid.cpp index b5c524530..65ea4a565 100644 --- a/modules/protocol/hybrid.cpp +++ b/modules/protocol/hybrid.cpp @@ -149,7 +149,7 @@ class HybridProto : public IRCDProto * Find users that match and ban them. */ for (user_map::const_iterator it = UserListByNick.begin(); it != UserListByNick.end(); ++it) - if (x->manager->Check(it->second, x)) + if (x->GetManager()->Check(it->second, x)) this->SendAkill(it->second, x); return; @@ -157,13 +157,18 @@ class HybridProto : public IRCDProto XLine *old = x; - if (old->manager->HasEntry("*@" + u->host)) + if (old->GetManager()->HasEntry("*@" + u->host)) return; /* We can't akill x as it has a nick and/or realname included, so create a new akill for *@host */ - XLine *xl = new XLine("*@" + u->host, old->GetBy(), old->GetExpires(), old->GetReason(), old->id); - - old->manager->AddXLine(xl); + XLine *xl = Serialize::New<XLine *>(); + xl->SetMask("*@" + u->host); + xl->SetBy(old->GetBy()); + xl->SetExpires(old->GetExpires()); + xl->SetReason(old->GetReason()); + xl->SetID(old->GetID()); + + old->GetManager()->AddXLine(xl); x = xl; Log(Config->GetClient("OperServ"), "akill") << "AKILL: Added an akill for " << x->GetMask() << " because " << u->GetMask() << "#" @@ -277,14 +282,19 @@ class HybridProto : public IRCDProto void SendSVSHold(const Anope::string &nick, time_t t) override { +#if 0 XLine x(nick, Me->GetName(), Anope::CurTime + t, "Being held for registered user"); this->SendSQLine(NULL, &x); +#endif } +#warning "xline on stack" void SendSVSHoldDel(const Anope::string &nick) override { +#if 0 XLine x(nick); this->SendSQLineDel(&x); +#endif } void SendVhost(User *u, const Anope::string &ident, const Anope::string &host) override @@ -579,7 +589,7 @@ struct IRCDMessageCertFP: IRCDMessage User *u = source.GetUser(); u->fingerprint = params[0]; - Event::OnFingerprint(&Event::Fingerprint::OnFingerprint, u); + EventManager::Get()->Dispatch(&Event::Fingerprint::OnFingerprint, u); } }; @@ -627,6 +637,7 @@ class ProtoHybrid : public Module public: ProtoHybrid(const Anope::string &modname, const Anope::string &creator) : Module(modname, creator, PROTOCOL | VENDOR) + , EventHook<Event::UserNickChange>(this) , ircd_proto(this) , message_away(this) , message_capab(this) diff --git a/modules/protocol/inspircd20.cpp b/modules/protocol/inspircd20.cpp index f4c8bcf37..ae9cc700f 100644 --- a/modules/protocol/inspircd20.cpp +++ b/modules/protocol/inspircd20.cpp @@ -174,19 +174,23 @@ class InspIRCd20Proto : public IRCDProto { /* No user (this akill was just added), and contains nick and/or realname. Find users that match and ban them */ for (user_map::const_iterator it = UserListByNick.begin(); it != UserListByNick.end(); ++it) - if (x->manager->Check(it->second, x)) + if (x->GetManager()->Check(it->second, x)) this->SendAkill(it->second, x); return; } XLine *old = x; - if (old->manager->HasEntry("*@" + u->host)) + if (old->GetManager()->HasEntry("*@" + u->host)) return; /* We can't akill x as it has a nick and/or realname included, so create a new akill for *@host */ - x = new XLine("*@" + u->host, old->GetBy(), old->GetExpires(), old->GetReason(), old->GetID()); - old->manager->AddXLine(x); + x = Serialize::New<XLine *>(); + x->SetMask("*@" + u->host); + x->SetBy(old->GetBy()); + x->SetExpires(old->GetExpires()); + x->SetReason(old->GetReason()); + old->GetManager()->AddXLine(x); Log(Config->GetClient("OperServ"), "akill") << "AKILL: Added an akill for " << x->GetMask() << " because " << u->GetMask() << "#" << u->realname << " matches " << old->GetMask(); } @@ -645,14 +649,14 @@ struct IRCDMessageCapab : Message::Capab ChannelMode *cm = ModeManager::FindChannelModeByChar(modechar[0]); if (cm == nullptr) { - Log(owner) << "Warning: Uplink has unknown channel mode " << modename << "=" << modechar; + Log(this->GetOwner()) << "Warning: Uplink has unknown channel mode " << modename << "=" << modechar; continue; } char modesymbol = cm->type == MODE_STATUS ? (anope_dynamic_static_cast<ChannelModeStatus *>(cm))->symbol : 0; if (symbol != modesymbol) { - Log(owner) << "Warning: Channel mode " << modename << " has a misconfigured status character"; + Log(this->GetOwner()) << "Warning: Channel mode " << modename << " has a misconfigured status character"; continue; } } @@ -676,7 +680,7 @@ struct IRCDMessageCapab : Message::Capab UserMode *um = ModeManager::FindUserModeByChar(modechar[0]); if (um == nullptr) { - Log(owner) << "Warning: Uplink has unknown user mode " << modename << "=" << modechar; + Log(this->GetOwner()) << "Warning: Uplink has unknown user mode " << modename << "=" << modechar; continue; } } @@ -992,7 +996,7 @@ struct IRCDMessageMetadata : IRCDMessage { u->fingerprint = data.substr(pos1, pos2 - pos1); } - Event::OnFingerprint(&Event::Fingerprint::OnFingerprint, u); + EventManager::Get()->Dispatch(&Event::Fingerprint::OnFingerprint, u); } } // We deliberately ignore non-bursting servers to avoid pseudoserver fights @@ -1246,6 +1250,8 @@ struct IRCDMessageTime : IRCDMessage struct IRCDMessageUID : IRCDMessage { + ServiceReference<SASL::Service> sasl; + IRCDMessageUID(Module *creator) : IRCDMessage(creator, "UID", 8) { SetFlag(IRCDMESSAGE_REQUIRE_SERVER); SetFlag(IRCDMESSAGE_SOFT_LIMIT); } /* @@ -1270,7 +1276,7 @@ struct IRCDMessageUID : IRCDMessage modes += " " + params[i]; NickServ::Nick *na = NULL; - if (SASL::sasl) + if (sasl) for (std::list<SASLUser>::iterator it = saslusers.begin(); it != saslusers.end();) { SASLUser &u = *it; @@ -1302,6 +1308,7 @@ class ProtoInspIRCd20 : public Module { InspIRCd20Proto ircd_proto; ExtensibleItem<bool> ssl; + ServiceReference<ModeLocks> mlocks; /* Core message handlers */ Message::Away message_away; @@ -1349,6 +1356,13 @@ class ProtoInspIRCd20 : public Module public: ProtoInspIRCd20(const Anope::string &modname, const Anope::string &creator) : Module(modname, creator, PROTOCOL | VENDOR) + , EventHook<Event::UserNickChange>(this) + , EventHook<Event::ChannelSync>(this) + , EventHook<Event::ChanRegistered>(this) + , EventHook<Event::DelChan>(this) + , EventHook<Event::MLockEvents>(this) + , EventHook<Event::SetChannelOption>(this) + , ircd_proto(this) , ssl(this, "ssl") , message_away(this) @@ -1489,7 +1503,7 @@ class ProtoInspIRCd20 : public Module EventReturn OnSetChannelOption(CommandSource &source, Command *cmd, ChanServ::Channel *ci, const Anope::string &setting) override { - if (cmd->name == "chanserv/topic" && ci->c) + if (cmd->GetName() == "chanserv/topic" && ci->c) { if (setting == "topiclock on") SendChannelMetadata(ci->c, "topiclock", "1"); diff --git a/modules/protocol/ngircd.cpp b/modules/protocol/ngircd.cpp index b80f600e3..271466a42 100644 --- a/modules/protocol/ngircd.cpp +++ b/modules/protocol/ngircd.cpp @@ -357,7 +357,7 @@ struct IRCDMessageMetadata : IRCDMessage else if (params[1].equals_cs("certfp")) { u->fingerprint = params[2]; - Event::OnFingerprint(&Event::Fingerprint::OnFingerprint, u); + EventManager::Get()->Dispatch(&Event::Fingerprint::OnFingerprint, u); } else if (params[1].equals_cs("cloakhost")) { @@ -634,6 +634,7 @@ class ProtongIRCd : public Module public: ProtongIRCd(const Anope::string &modname, const Anope::string &creator) : Module(modname, creator, PROTOCOL | VENDOR) + , EventHook<Event::UserNickChange>(this) , ircd_proto(this) , message_capab(this) , message_error(this) diff --git a/modules/protocol/plexus.cpp b/modules/protocol/plexus.cpp index 027fa2a14..efa521377 100644 --- a/modules/protocol/plexus.cpp +++ b/modules/protocol/plexus.cpp @@ -13,12 +13,13 @@ static Anope::string UplinkSID; -static ServiceReference<IRCDProto> hybrid("IRCDProto", "hybrid"); - class PlexusProto : public IRCDProto { + ServiceReference<IRCDProto> hybrid; // XXX use moddeps + inheritance here + public: PlexusProto(Module *creator) : IRCDProto(creator, "hybrid-7.2.3+plexus-3.0.1") + , hybrid("hybrid") { DefaultPseudoclientModes = "+oiU"; CanSVSNick = true; @@ -204,7 +205,7 @@ struct IRCDMessageEncap : IRCDMessage if (u) { u->fingerprint = params[3]; - Event::OnFingerprint(&Event::Fingerprint::OnFingerprint, u); + EventManager::Get()->Dispatch(&Event::Fingerprint::OnFingerprint, u); } } return; @@ -366,8 +367,8 @@ class ProtoPlexus : public Module m_hybrid = ModuleManager::FindModule("hybrid"); if (!m_hybrid) throw ModuleException("Unable to find hybrid"); - if (!hybrid) - throw ModuleException("No protocol interface for hybrid"); +// if (!hybrid) +// throw ModuleException("No protocol interface for hybrid"); } ~ProtoPlexus() diff --git a/modules/protocol/ratbox.cpp b/modules/protocol/ratbox.cpp index 9e1ea0710..54f085a3e 100644 --- a/modules/protocol/ratbox.cpp +++ b/modules/protocol/ratbox.cpp @@ -13,12 +13,12 @@ static Anope::string UplinkSID; -static ServiceReference<IRCDProto> hybrid("IRCDProto", "hybrid"); - class RatboxProto : public IRCDProto { + ServiceReference<IRCDProto> hybrid; // XXX public: RatboxProto(Module *creator) : IRCDProto(creator, "Ratbox 3.0+") + , hybrid("hybrid") { DefaultPseudoclientModes = "+oiS"; CanSNLine = true; @@ -282,8 +282,8 @@ class ProtoRatbox : public Module m_hybrid = ModuleManager::FindModule("hybrid"); if (!m_hybrid) throw ModuleException("Unable to find hybrid"); - if (!hybrid) - throw ModuleException("No protocol interface for hybrid"); +// if (!hybrid) +// throw ModuleException("No protocol interface for hybrid"); } ~ProtoRatbox() diff --git a/modules/protocol/unreal.cpp b/modules/protocol/unreal.cpp index 3bb8ab93a..327f1c32e 100644 --- a/modules/protocol/unreal.cpp +++ b/modules/protocol/unreal.cpp @@ -12,6 +12,7 @@ #include "module.h" #include "modules/chanserv/mode.h" #include "modules/sasl.h" +#include "modules/operserv/stats.h" class UnrealIRCdProto : public IRCDProto { @@ -89,19 +90,25 @@ class UnrealIRCdProto : public IRCDProto { /* No user (this akill was just added), and contains nick and/or realname. Find users that match and ban them */ for (user_map::const_iterator it = UserListByNick.begin(); it != UserListByNick.end(); ++it) - if (x->manager->Check(it->second, x)) + if (x->GetManager()->Check(it->second, x)) this->SendAkill(it->second, x); return; } XLine *old = x; - if (old->manager->HasEntry("*@" + u->host)) + if (old->GetManager()->HasEntry("*@" + u->host)) return; /* We can't akill x as it has a nick and/or realname included, so create a new akill for *@host */ - XLine *xl = new XLine("*@" + u->host, old->GetBy(), old->GetExpires(), old->GetReason(), old->GetID()); - old->manager->AddXLine(xl); + XLine *xl = Serialize::New<XLine *>(); + xl->SetMask("*@" + u->host); + xl->SetBy(old->GetBy()); + xl->SetExpires(old->GetExpires()); + xl->SetReason(old->GetReason()); + xl->SetID(old->GetID()); + + old->GetManager()->AddXLine(xl); x = xl; Log(Config->GetClient("OperServ"), "akill") << "AKILL: Added an akill for " << x->GetMask() << " because " << u->GetMask() << "#" << u->realname << " matches " << old->GetMask(); @@ -693,7 +700,8 @@ struct IRCDMessageNetInfo : IRCDMessage void Run(MessageSource &source, const std::vector<Anope::string> ¶ms) override { - UplinkSocket::Message() << "NETINFO " << MaxUserCount << " " << Anope::CurTime << " " << convertTo<int>(params[2]) << " " << params[3] << " 0 0 0 :" << params[7]; + Stats *stats = Serialize::GetObject<Stats *>(); + UplinkSocket::Message() << "NETINFO " << (stats ? stats->GetMaxUserCount() : 0) << " " << Anope::CurTime << " " << convertTo<int>(params[2]) << " " << params[3] << " 0 0 0 :" << params[7]; } }; @@ -792,12 +800,14 @@ struct IRCDMessagePong : IRCDMessage struct IRCDMessageSASL : IRCDMessage { + ServiceReference<SASL::Service> sasl; + IRCDMessageSASL(Module *creator) : IRCDMessage(creator, "SASL", 4) { SetFlag(IRCDMESSAGE_SOFT_LIMIT); SetFlag(IRCDMESSAGE_REQUIRE_SERVER); } void Run(MessageSource &source, const std::vector<Anope::string> ¶ms) override { size_t p = params[1].find('!'); - if (!SASL::sasl || p == Anope::string::npos) + if (!sasl || p == Anope::string::npos) return; SASL::Message m; @@ -807,7 +817,7 @@ struct IRCDMessageSASL : IRCDMessage m.data = params[3]; m.ext = params.size() > 4 ? params[4] : ""; - SASL::sasl->ProcessMessage(m); + sasl->ProcessMessage(m); } }; @@ -1006,6 +1016,7 @@ class ProtoUnreal : public Module , public EventHook<Event::MLockEvents> { UnrealIRCdProto ircd_proto; + ServiceReference<ModeLocks> mlocks; /* Core message handlers */ Message::Away message_away; @@ -1049,11 +1060,11 @@ class ProtoUnreal : public Module public: ProtoUnreal(const Anope::string &modname, const Anope::string &creator) : Module(modname, creator, PROTOCOL | VENDOR) - , EventHook<Event::UserNickChange>(EventHook<Event::UserNickChange>::Priority::FIRST) - , EventHook<Event::ChannelSync>(EventHook<Event::ChannelSync>::Priority::FIRST) - , EventHook<Event::ChanRegistered>(EventHook<Event::ChanRegistered>::Priority::FIRST) - , EventHook<Event::DelChan>(EventHook<Event::DelChan>::Priority::FIRST) - , EventHook<Event::MLockEvents>(EventHook<Event::MLockEvents>::Priority::FIRST) + , EventHook<Event::UserNickChange>(this, EventHook<Event::UserNickChange>::Priority::FIRST) + , EventHook<Event::ChannelSync>(this, EventHook<Event::ChannelSync>::Priority::FIRST) + , EventHook<Event::ChanRegistered>(this, EventHook<Event::ChanRegistered>::Priority::FIRST) + , EventHook<Event::DelChan>(this, EventHook<Event::DelChan>::Priority::FIRST) + , EventHook<Event::MLockEvents>(this, EventHook<Event::MLockEvents>::Priority::FIRST) , ircd_proto(this) , message_away(this) , message_capab(this, "PROTOCTL") |