1
0
mirror of https://github.com/anope/anope.git synced 2026-06-29 18:56:37 +02:00

Made IRCDProto a Service

This commit is contained in:
Adam
2012-11-23 23:10:41 -05:00
parent 36b1166cf6
commit ded89b0d49
13 changed files with 30 additions and 76 deletions
-4
View File
@@ -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.
*/
+2 -2
View File
@@ -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();
+2 -6
View File
@@ -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));
+2 -6
View File
@@ -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));
+2 -6
View File
@@ -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));
+6 -10
View File
@@ -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
+3 -8
View File
@@ -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));
+2 -6
View File
@@ -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));
+4 -8
View File
@@ -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)
+4 -8
View File
@@ -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)
+2 -6
View File
@@ -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));
-5
View File
@@ -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)
{
}
+1 -1
View File
@@ -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 =