diff options
author | Adam <Adam@anope.org> | 2012-11-23 23:10:41 -0500 |
---|---|---|
committer | Adam <Adam@anope.org> | 2012-11-23 23:10:41 -0500 |
commit | ded89b0d4939c4c1b9bbbb9007cd12286ff077a0 (patch) | |
tree | f1962bc7e4dcd4ebedde23dbd875399bfb0f4932 | |
parent | 36b1166cf6efddbc9a9abc8f00ad13bb0d4e56a9 (diff) |
Made IRCDProto a Service
-rw-r--r-- | include/modules.h | 4 | ||||
-rw-r--r-- | include/protocol.h | 4 | ||||
-rw-r--r-- | modules/protocol/bahamut.cpp | 8 | ||||
-rw-r--r-- | modules/protocol/hybrid.cpp | 8 | ||||
-rw-r--r-- | modules/protocol/inspircd11.cpp | 8 | ||||
-rw-r--r-- | modules/protocol/inspircd12.cpp | 16 | ||||
-rw-r--r-- | modules/protocol/inspircd20.cpp | 11 | ||||
-rw-r--r-- | modules/protocol/ngircd.cpp | 8 | ||||
-rw-r--r-- | modules/protocol/plexus.cpp | 12 | ||||
-rw-r--r-- | modules/protocol/ratbox.cpp | 12 | ||||
-rw-r--r-- | modules/protocol/unreal.cpp | 8 | ||||
-rw-r--r-- | src/module.cpp | 5 | ||||
-rw-r--r-- | src/protocol.cpp | 2 |
13 files changed, 30 insertions, 76 deletions
diff --git a/include/modules.h b/include/modules.h index bbdfc5659..09df6617e 100644 --- a/include/modules.h +++ b/include/modules.h @@ -256,10 +256,6 @@ class CoreExport Module : public Extensible */ ModuleVersion GetVersion() const; - /** Gets the IRCd protocol published by this module - */ - virtual IRCDProto *GetIRCDProto(); - /* Everything below here are events. Modules must ModuleManager::Attach to these events * before they will be called. */ diff --git a/include/protocol.h b/include/protocol.h index 65b31680f..7d86693bc 100644 --- a/include/protocol.h +++ b/include/protocol.h @@ -18,12 +18,12 @@ #include "service.h" /* Encapsultes the IRCd protocol we are speaking. */ -class CoreExport IRCDProto +class CoreExport IRCDProto : public Service { Anope::string proto_name; protected: - IRCDProto(const Anope::string &proto_name); + IRCDProto(Module *creator, const Anope::string &proto_name); public: virtual ~IRCDProto(); diff --git a/modules/protocol/bahamut.cpp b/modules/protocol/bahamut.cpp index d9963485b..518fc5ee1 100644 --- a/modules/protocol/bahamut.cpp +++ b/modules/protocol/bahamut.cpp @@ -35,7 +35,7 @@ class ChannelModeFlood : public ChannelModeParam class BahamutIRCdProto : public IRCDProto { public: - BahamutIRCdProto() : IRCDProto("Bahamut 1.8.x") + BahamutIRCdProto(Module *creator) : IRCDProto(creator, "Bahamut 1.8.x") { DefaultPseudoclientModes = "+"; CanSVSNick = true; @@ -559,6 +559,7 @@ class ProtoBahamut : public Module public: ProtoBahamut(const Anope::string &modname, const Anope::string &creator) : Module(modname, creator, PROTOCOL), + ircd_proto(this), message_away(this), message_capab(this), message_error(this), message_join(this), message_kick(this), message_kill(this), message_motd(this), message_part(this), message_ping(this), message_privmsg(this), message_quit(this), message_squit(this), @@ -574,11 +575,6 @@ class ProtoBahamut : public Module ModuleManager::Attach(I_OnUserNickChange, this); } - IRCDProto *GetIRCDProto() anope_override - { - return &ircd_proto; - } - void OnUserNickChange(User *u, const Anope::string &) anope_override { u->RemoveModeInternal(ModeManager::FindUserModeByName(UMODE_REGISTERED)); diff --git a/modules/protocol/hybrid.cpp b/modules/protocol/hybrid.cpp index 2597197ff..331db994f 100644 --- a/modules/protocol/hybrid.cpp +++ b/modules/protocol/hybrid.cpp @@ -17,7 +17,7 @@ static Anope::string UplinkSID; class HybridProto : public IRCDProto { public: - HybridProto() : IRCDProto("Hybrid 8.0.0") + HybridProto(Module *creator) : IRCDProto(creator, "Hybrid 8.0.0") { DefaultPseudoclientModes = "+oi"; CanSNLine = true; @@ -601,6 +601,7 @@ class ProtoHybrid : public Module public: ProtoHybrid(const Anope::string &modname, const Anope::string &creator) : Module(modname, creator, PROTOCOL), + ircd_proto(this), message_away(this), message_capab(this), message_error(this), message_kick(this), message_kill(this), message_mode(this), message_motd(this), message_part(this), message_ping(this), message_privmsg(this), message_quit(this), message_squit(this), message_stats(this), message_time(this), message_topic(this), @@ -626,11 +627,6 @@ public: it->second->GenerateUID(); } - IRCDProto *GetIRCDProto() anope_override - { - return &ircd_proto; - } - void OnUserNickChange(User *u, const Anope::string &) anope_override { u->RemoveModeInternal(ModeManager::FindUserModeByName(UMODE_REGISTERED)); diff --git a/modules/protocol/inspircd11.cpp b/modules/protocol/inspircd11.cpp index bc93e125e..14ac8fde7 100644 --- a/modules/protocol/inspircd11.cpp +++ b/modules/protocol/inspircd11.cpp @@ -22,7 +22,7 @@ static bool has_hidechansmod = false; class InspIRCdProto : public IRCDProto { public: - InspIRCdProto() : IRCDProto("InspIRCd 1.1") + InspIRCdProto(Module *creator) : IRCDProto(creator, "InspIRCd 1.1") { DefaultPseudoclientModes = "+I"; CanSVSNick = true; @@ -867,6 +867,7 @@ class ProtoInspIRCd : public Module public: ProtoInspIRCd(const Anope::string &modname, const Anope::string &creator) : Module(modname, creator, PROTOCOL), + ircd_proto(this), message_away(this), message_error(this), message_join(this), message_kick(this), message_kill(this), message_motd(this), message_part(this), message_ping(this), message_privmsg(this), message_quit(this), message_squit(this), message_stats(this), message_time(this), message_topic(this), message_version(this), @@ -886,11 +887,6 @@ class ProtoInspIRCd : public Module ModuleManager::Attach(I_OnUserNickChange, this); } - IRCDProto *GetIRCDProto() anope_override - { - return &ircd_proto; - } - void OnUserNickChange(User *u, const Anope::string &) anope_override { u->RemoveModeInternal(ModeManager::FindUserModeByName(UMODE_REGISTERED)); diff --git a/modules/protocol/inspircd12.cpp b/modules/protocol/inspircd12.cpp index 242dd41e1..133074eac 100644 --- a/modules/protocol/inspircd12.cpp +++ b/modules/protocol/inspircd12.cpp @@ -59,18 +59,18 @@ class InspIRCd12Proto : public IRCDProto UplinkSocket::Message(Me) << "CHGHOST " << nick << " " << vhost; } - void SendAddLine(const Anope::string &type, const Anope::string &mask, time_t duration, const Anope::string &addedby, const Anope::string &reason) + void SendAddLine(const Anope::string &xtype, const Anope::string &mask, time_t duration, const Anope::string &addedby, const Anope::string &reason) { - UplinkSocket::Message(Me) << "ADDLINE " << type << " " << mask << " " << addedby << " " << Anope::CurTime << " " << duration << " :" << reason; + UplinkSocket::Message(Me) << "ADDLINE " << xtype << " " << mask << " " << addedby << " " << Anope::CurTime << " " << duration << " :" << reason; } - void SendDelLine(const Anope::string &type, const Anope::string &mask) + void SendDelLine(const Anope::string &xtype, const Anope::string &mask) { - UplinkSocket::Message(Me) << "DELLINE " << type << " " << mask; + UplinkSocket::Message(Me) << "DELLINE " << xtype << " " << mask; } public: - InspIRCd12Proto() : IRCDProto("InspIRCd 1.2") + InspIRCd12Proto(Module *creator) : IRCDProto(creator, "InspIRCd 1.2") { DefaultPseudoclientModes = "+I"; CanSVSNick = true; @@ -1206,6 +1206,7 @@ class ProtoInspIRCd : public Module public: ProtoInspIRCd(const Anope::string &modname, const Anope::string &creator) : Module(modname, creator, PROTOCOL), + ircd_proto(this), message_away(this), message_error(this), message_join(this), message_kick(this), message_kill(this), message_motd(this), message_part(this), message_ping(this), message_privmsg(this), message_quit(this), message_squit(this), message_stats(this), message_topic(this), message_version(this), @@ -1233,11 +1234,6 @@ class ProtoInspIRCd : public Module it->second->GenerateUID(); } - IRCDProto *GetIRCDProto() anope_override - { - return &ircd_proto; - } - void OnUserNickChange(User *u, const Anope::string &) anope_override { /* InspIRCd 1.2 doesn't set -r on nick change, remove -r here. Note that if we have to set +r later diff --git a/modules/protocol/inspircd20.cpp b/modules/protocol/inspircd20.cpp index 965294904..5410ac2f4 100644 --- a/modules/protocol/inspircd20.cpp +++ b/modules/protocol/inspircd20.cpp @@ -20,12 +20,12 @@ static bool has_svstopic_topiclock = false; static unsigned int spanningtree_proto_ver = 0; static bool has_servicesmod = false; -static IRCDProto *insp12; +static ServiceReference<IRCDProto> insp12("IRCDProto", "inspircd12"); class InspIRCd20Proto : public IRCDProto { public: - InspIRCd20Proto() : IRCDProto("InspIRCd 2.0") + InspIRCd20Proto(Module *creator) : IRCDProto(creator, "InspIRCd 2.0") { DefaultPseudoclientModes = "+I"; CanSVSNick = true; @@ -647,6 +647,7 @@ class ProtoInspIRCd : public Module public: ProtoInspIRCd(const Anope::string &modname, const Anope::string &creator) : Module(modname, creator, PROTOCOL), + ircd_proto(this), message_away(this), message_error(this), message_join(this), message_kick(this), message_kill(this), message_motd(this), message_part(this), message_ping(this), message_privmsg(this), message_quit(this), message_squit(this), message_stats(this), message_topic(this), message_version(this), @@ -675,7 +676,6 @@ class ProtoInspIRCd : public Module m_insp12 = ModuleManager::FindModule("inspircd12"); if (!m_insp12) throw ModuleException("Unable to find inspircd12"); - insp12 = m_insp12->GetIRCDProto(); if (!insp12) throw ModuleException("No protocol interface for insp12"); ModuleManager::DetachAll(m_insp12); @@ -689,11 +689,6 @@ class ProtoInspIRCd : public Module ModuleManager::UnloadModule(m_insp12, NULL); } - IRCDProto *GetIRCDProto() anope_override - { - return &ircd_proto; - } - void OnUserNickChange(User *u, const Anope::string &) anope_override { u->RemoveModeInternal(ModeManager::FindUserModeByName(UMODE_REGISTERED)); diff --git a/modules/protocol/ngircd.cpp b/modules/protocol/ngircd.cpp index 40c6a4e5c..af60df3c9 100644 --- a/modules/protocol/ngircd.cpp +++ b/modules/protocol/ngircd.cpp @@ -16,7 +16,7 @@ class ngIRCdProto : public IRCDProto { public: - ngIRCdProto() : IRCDProto("ngIRCd") + ngIRCdProto(Module *creator) : IRCDProto(creator, "ngIRCd") { DefaultPseudoclientModes = "+oi"; CanSVSNick = true; @@ -658,6 +658,7 @@ class ProtongIRCd : public Module public: ProtongIRCd(const Anope::string &modname, const Anope::string &creator) : Module(modname, creator, PROTOCOL), + ircd_proto(this), message_capab(this), message_error(this), message_kick(this), message_kill(this), message_motd(this), message_part(this), message_ping(this), message_privmsg(this), message_squery(this, "SQUERY"), message_quit(this), message_squit(this), message_stats(this), message_time(this), message_version(this), @@ -676,11 +677,6 @@ class ProtongIRCd : public Module ModuleManager::Attach(i, this, sizeof(i) / sizeof(Implementation)); } - IRCDProto *GetIRCDProto() anope_override - { - return &ircd_proto; - } - void OnUserNickChange(User *u, const Anope::string &) anope_override { u->RemoveModeInternal(ModeManager::FindUserModeByName(UMODE_REGISTERED)); diff --git a/modules/protocol/plexus.cpp b/modules/protocol/plexus.cpp index 1faab05b8..3026e1c4d 100644 --- a/modules/protocol/plexus.cpp +++ b/modules/protocol/plexus.cpp @@ -12,12 +12,13 @@ #include "module.h" static Anope::string UplinkSID; -static IRCDProto *hybrid; + +static ServiceReference<IRCDProto> hybrid("IRCDProto", "hybrid"); class PlexusProto : public IRCDProto { public: - PlexusProto() : IRCDProto("hybrid-7.2.3+plexus-3.0.1") + PlexusProto(Module *creator) : IRCDProto(creator, "hybrid-7.2.3+plexus-3.0.1") { DefaultPseudoclientModes = "+oiU"; CanSVSNick = true; @@ -327,6 +328,7 @@ class ProtoPlexus : public Module public: ProtoPlexus(const Anope::string &modname, const Anope::string &creator) : Module(modname, creator, PROTOCOL), + ircd_proto(this), message_away(this), message_capab(this), message_error(this), message_kick(this), message_kill(this), message_mode(this), message_motd(this), message_part(this), message_ping(this), message_privmsg(this), message_quit(this), message_squit(this), message_stats(this), message_time(this), message_topic(this), message_version(this), message_whois(this), @@ -346,7 +348,6 @@ class ProtoPlexus : public Module m_hybrid = ModuleManager::FindModule("hybrid"); if (!m_hybrid) throw ModuleException("Unable to find hybrid"); - hybrid = m_hybrid->GetIRCDProto(); if (!hybrid) throw ModuleException("No protocol interface for hybrid"); @@ -361,11 +362,6 @@ class ProtoPlexus : public Module ModuleManager::UnloadModule(m_hybrid, NULL); } - IRCDProto *GetIRCDProto() anope_override - { - return &ircd_proto; - } - void OnServerSync(Server *s) anope_override { if (NickServService) diff --git a/modules/protocol/ratbox.cpp b/modules/protocol/ratbox.cpp index ba8eea82c..52795485f 100644 --- a/modules/protocol/ratbox.cpp +++ b/modules/protocol/ratbox.cpp @@ -12,12 +12,13 @@ #include "module.h" static Anope::string UplinkSID; -static IRCDProto *hybrid; + +static ServiceReference<IRCDProto> hybrid("IRCDProto", "hybrid"); class RatboxProto : public IRCDProto { public: - RatboxProto() : IRCDProto("Ratbox 3.0+") + RatboxProto(Module *creator) : IRCDProto(creator, "Ratbox 3.0+") { DefaultPseudoclientModes = "+oiS"; CanSNLine = true; @@ -230,6 +231,7 @@ class ProtoRatbox : public Module public: ProtoRatbox(const Anope::string &modname, const Anope::string &creator) : Module(modname, creator, PROTOCOL), + ircd_proto(this), message_away(this), message_capab(this), message_error(this), message_kick(this), message_kill(this), message_mode(this), message_motd(this), message_part(this), message_ping(this), message_privmsg(this), message_quit(this), message_squit(this), message_stats(this), message_time(this), message_topic(this), @@ -249,7 +251,6 @@ class ProtoRatbox : public Module m_hybrid = ModuleManager::FindModule("hybrid"); if (!m_hybrid) throw ModuleException("Unable to find hybrid"); - hybrid = m_hybrid->GetIRCDProto(); if (!hybrid) throw ModuleException("No protocol interface for hybrid"); @@ -264,11 +265,6 @@ class ProtoRatbox : public Module ModuleManager::UnloadModule(m_hybrid, NULL); } - IRCDProto *GetIRCDProto() anope_override - { - return &ircd_proto; - } - void OnServerSync(Server *s) anope_override { if (NickServService) diff --git a/modules/protocol/unreal.cpp b/modules/protocol/unreal.cpp index 01541a93e..da96bd03b 100644 --- a/modules/protocol/unreal.cpp +++ b/modules/protocol/unreal.cpp @@ -16,7 +16,7 @@ class UnrealIRCdProto : public IRCDProto { public: - UnrealIRCdProto() : IRCDProto("UnrealIRCd 3.2.x") + UnrealIRCdProto(Module *creator) : IRCDProto(creator, "UnrealIRCd 3.2.x") { DefaultPseudoclientModes = "+Soiq"; CanSVSNick = true; @@ -1196,6 +1196,7 @@ class ProtoUnreal : public Module public: ProtoUnreal(const Anope::string &modname, const Anope::string &creator) : Module(modname, creator, PROTOCOL), + ircd_proto(this), message_away(this), message_error(this), message_join(this), message_kick(this), message_kill(this), message_motd(this), message_part(this), message_ping(this), message_privmsg(this), message_quit(this), message_squit(this), message_stats(this), message_time(this), message_version(this), @@ -1215,11 +1216,6 @@ class ProtoUnreal : public Module ModuleManager::SetPriority(this, PRIORITY_FIRST); } - IRCDProto *GetIRCDProto() anope_override - { - return &ircd_proto; - } - void OnUserNickChange(User *u, const Anope::string &) anope_override { u->RemoveModeInternal(ModeManager::FindUserModeByName(UMODE_REGISTERED)); diff --git a/src/module.cpp b/src/module.cpp index 3c3b8fdd1..e9c130076 100644 --- a/src/module.cpp +++ b/src/module.cpp @@ -85,11 +85,6 @@ void Module::SetAuthor(const Anope::string &nauthor) this->author = nauthor; } -IRCDProto *Module::GetIRCDProto() -{ - return NULL; -} - ModuleVersion::ModuleVersion(int maj, int min, int pa) : version_major(maj), version_minor(min), version_patch(pa) { } diff --git a/src/protocol.cpp b/src/protocol.cpp index d3372731c..315b3955c 100644 --- a/src/protocol.cpp +++ b/src/protocol.cpp @@ -23,7 +23,7 @@ IRCDProto *IRCD = NULL; -IRCDProto::IRCDProto(const Anope::string &p) : proto_name(p) +IRCDProto::IRCDProto(Module *creator, const Anope::string &p) : Service(creator, "IRCDProto", creator->name), proto_name(p) { DefaultPseudoclientModes = "+io"; CanSVSNick = CanSetVHost = CanSetVIdent = CanSNLine = CanSQLine = CanSQLineChannel = CanSZLine = CanSVSHold = |