summaryrefslogtreecommitdiff
path: root/modules/protocol
diff options
context:
space:
mode:
authorAdam <Adam@anope.org>2011-04-28 22:44:34 -0400
committerAdam <Adam@anope.org>2011-05-16 04:09:32 -0400
commit583954d3a1db658281a9afb7b7dd6773726c8c11 (patch)
tree6a00865d5738c6d0bc42efb35f3f468c5876eb3e /modules/protocol
parent8fb1604f649bec6f356770daf5df6bb8ab811bbf (diff)
Use module type to determine what type each module is instead of its location in the configuration file.
Diffstat (limited to 'modules/protocol')
-rw-r--r--modules/protocol/bahamut.cpp3
-rw-r--r--modules/protocol/inspircd-ts6.h3
-rw-r--r--modules/protocol/inspircd11.cpp6
-rw-r--r--modules/protocol/inspircd12.cpp6
-rw-r--r--modules/protocol/inspircd20.cpp9
-rw-r--r--modules/protocol/plexus.cpp6
-rw-r--r--modules/protocol/ratbox.cpp6
-rw-r--r--modules/protocol/unreal.cpp (renamed from modules/protocol/unreal32.cpp)3
8 files changed, 25 insertions, 17 deletions
diff --git a/modules/protocol/bahamut.cpp b/modules/protocol/bahamut.cpp
index efe75b7ba..59f611867 100644
--- a/modules/protocol/bahamut.cpp
+++ b/modules/protocol/bahamut.cpp
@@ -598,13 +598,12 @@ class ProtoBahamut : public Module
}
public:
- ProtoBahamut(const Anope::string &modname, const Anope::string &creator) : Module(modname, creator),
+ ProtoBahamut(const Anope::string &modname, const Anope::string &creator) : Module(modname, creator, PROTOCOL),
message_svsmode("SVSMODE", OnMode), message_cs("CS", event_cs), message_hs("HS", event_hs),
message_ms("MS", event_ms), message_ns("NS", event_ns), message_os("OS", event_os),
message_burst("BURST", event_burst)
{
this->SetAuthor("Anope");
- this->SetType(PROTOCOL);
pmodule_ircd_var(myIrcd);
pmodule_ircd_proto(&this->ircd_proto);
diff --git a/modules/protocol/inspircd-ts6.h b/modules/protocol/inspircd-ts6.h
index a1b1d8df3..d76dc27c2 100644
--- a/modules/protocol/inspircd-ts6.h
+++ b/modules/protocol/inspircd-ts6.h
@@ -173,7 +173,8 @@ class InspIRCdTS6Proto : public IRCDProto
{
SendServer(Me);
send_cmd(Config->Numeric, "BURST");
- send_cmd(Config->Numeric, "VERSION :Anope-%s %s :%s - (%s) -- %s", Anope::Version().c_str(), Config->ServerName.c_str(), ircd->name, Config->EncModuleList.begin()->c_str(), Anope::VersionBuildString().c_str());
+ Module *enc = ModuleManager::FindFirstOf(ENCRYPTION);
+ send_cmd(Config->Numeric, "VERSION :Anope-%s %s :%s - (%s) -- %s", Anope::Version().c_str(), Config->ServerName.c_str(), ircd->name, enc ? enc->name.c_str() : "unknown", Anope::VersionBuildString().c_str());
}
/* SVSHOLD - set */
diff --git a/modules/protocol/inspircd11.cpp b/modules/protocol/inspircd11.cpp
index 0e787b0fe..5ab55ab07 100644
--- a/modules/protocol/inspircd11.cpp
+++ b/modules/protocol/inspircd11.cpp
@@ -202,7 +202,8 @@ class InspIRCdProto : public IRCDProto
inspircd_cmd_pass(uplink_server->password);
SendServer(Me);
send_cmd("", "BURST");
- send_cmd(Config->ServerName, "VERSION :Anope-%s %s :%s - (%s) -- %s", Anope::Version().c_str(), Config->ServerName.c_str(), ircd->name, Config->EncModuleList.begin()->c_str(), Anope::VersionBuildString().c_str());
+ Module *enc = ModuleManager::FindFirstOf(ENCRYPTION);
+ send_cmd(Config->ServerName, "VERSION :Anope-%s %s :%s - (%s) -- %s", Anope::Version().c_str(), Config->ServerName.c_str(), ircd->name, enc ? enc->name.c_str() : "unknown", Anope::VersionBuildString().c_str());
}
/* CHGIDENT */
@@ -890,7 +891,7 @@ class ProtoInspIRCd : public Module
}
public:
- ProtoInspIRCd(const Anope::string &modname, const Anope::string &creator) : Module(modname, creator),
+ ProtoInspIRCd(const Anope::string &modname, const Anope::string &creator) : Module(modname, creator, PROTOCOL),
message_endburst("ENDBURST", event_endburst), message_rsquit("RSQUIT", event_rsquit),
message_svsmode("SVSMODE", OnMode), message_chghost("CHGHOST", event_chghost),
message_chgident("CHGIDENT", event_chgident), message_chgname("CHGNAME", event_chgname),
@@ -900,7 +901,6 @@ class ProtoInspIRCd : public Module
message_idle("IDLE", event_idle), message_fjoin("FJOIN", OnSJoin)
{
this->SetAuthor("Anope");
- this->SetType(PROTOCOL);
pmodule_ircd_var(myIrcd);
pmodule_ircd_proto(&this->ircd_proto);
diff --git a/modules/protocol/inspircd12.cpp b/modules/protocol/inspircd12.cpp
index 4723a21af..9e81c2b3f 100644
--- a/modules/protocol/inspircd12.cpp
+++ b/modules/protocol/inspircd12.cpp
@@ -737,7 +737,7 @@ class ProtoInspIRCd : public Module
Inspircd12IRCdMessage ircd_message;
public:
- ProtoInspIRCd(const Anope::string &modname, const Anope::string &creator) : Module(modname, creator),
+ ProtoInspIRCd(const Anope::string &modname, const Anope::string &creator) : Module(modname, creator, PROTOCOL),
message_endburst("ENDBURST", event_endburst),
message_time("TIME", event_time), message_rsquit("RSQUIT", event_rsquit),
message_svsmode("SVSMODE", OnMode), message_fhost("FHOST", event_chghost),
@@ -749,7 +749,6 @@ class ProtoInspIRCd : public Module
message_metadata("METADATA", event_metadata)
{
this->SetAuthor("Anope");
- this->SetType(PROTOCOL);
pmodule_ircd_var(myIrcd);
pmodule_ircd_proto(&this->ircd_proto);
@@ -759,6 +758,9 @@ class ProtoInspIRCd : public Module
Implementation i[] = { I_OnUserNickChange, I_OnServerSync };
ModuleManager::Attach(i, this, 2);
+
+ if (Config->Numeric.empty())
+ throw ModuleException("This IRCd protocol requires a server id to be set in Anope's configuration.");
}
void OnUserNickChange(User *u, const Anope::string &)
diff --git a/modules/protocol/inspircd20.cpp b/modules/protocol/inspircd20.cpp
index 3cb4979a9..3bc521a63 100644
--- a/modules/protocol/inspircd20.cpp
+++ b/modules/protocol/inspircd20.cpp
@@ -82,7 +82,8 @@ class InspIRCdProto : public InspIRCdTS6Proto
send_cmd("", "CAPAB END");
SendServer(Me);
send_cmd(Config->Numeric, "BURST");
- send_cmd(Config->Numeric, "VERSION :Anope-%s %s :%s - (%s) -- %s", Anope::Version().c_str(), Config->ServerName.c_str(), ircd->name, Config->EncModuleList.begin()->c_str(), Anope::VersionBuildString().c_str());
+ Module *enc = ModuleManager::FindFirstOf(ENCRYPTION);
+ send_cmd(Config->Numeric, "VERSION :Anope-%s %s :%s - (%s) -- %s", Anope::Version().c_str(), Config->ServerName.c_str(), ircd->name, enc ? enc->name.c_str() : "unknown", Anope::VersionBuildString().c_str());
}
};
@@ -731,7 +732,7 @@ class ProtoInspIRCd : public Module
InspIRCdProto ircd_proto;
Inspircd20IRCdMessage ircd_message;
public:
- ProtoInspIRCd(const Anope::string &modname, const Anope::string &creator) : Module(modname, creator),
+ ProtoInspIRCd(const Anope::string &modname, const Anope::string &creator) : Module(modname, creator, PROTOCOL),
message_endburst("ENDBURST", event_endburst),
message_time("TIME", event_time), message_rsquit("RSQUIT", event_rsquit),
message_svsmode("SVSMODE", OnMode), message_fhost("FHOST", event_chghost),
@@ -743,7 +744,6 @@ class ProtoInspIRCd : public Module
message_metadata("METADATA", event_metadata)
{
this->SetAuthor("Anope");
- this->SetType(PROTOCOL);
pmodule_ircd_var(myIrcd);
pmodule_ircd_proto(&this->ircd_proto);
@@ -753,6 +753,9 @@ class ProtoInspIRCd : public Module
Implementation i[] = { I_OnUserNickChange, I_OnServerSync };
ModuleManager::Attach(i, this, 2);
+
+ if (Config->Numeric.empty())
+ throw ModuleException("This IRCd protocol requires a server id to be set in Anope's configuration.");
}
void OnUserNickChange(User *u, const Anope::string &)
diff --git a/modules/protocol/plexus.cpp b/modules/protocol/plexus.cpp
index 84faec449..04095e5a2 100644
--- a/modules/protocol/plexus.cpp
+++ b/modules/protocol/plexus.cpp
@@ -628,14 +628,13 @@ class ProtoPlexus : public Module
}
public:
- ProtoPlexus(const Anope::string &modname, const Anope::string &creator) : Module(modname, creator),
+ ProtoPlexus(const Anope::string &modname, const Anope::string &creator) : Module(modname, creator, PROTOCOL),
message_tmode("TMODE", event_tmode), message_bmask("BMASK", event_bmask),
message_pass("PASS", event_pass), message_tb("TBURST", event_tburst),
message_sid("SID", event_sid), message_encap("ENCAP", event_encap),
message_eob("EOB", event_eob)
{
this->SetAuthor("Anope");
- this->SetType(PROTOCOL);
pmodule_ircd_var(myIrcd);
pmodule_ircd_proto(&this->ircd_proto);
@@ -645,6 +644,9 @@ class ProtoPlexus : public Module
Implementation i[] = { I_OnServerSync };
ModuleManager::Attach(i, this, 1);
+
+ if (Config->Numeric.empty())
+ throw ModuleException("This IRCd protocol requires a server id to be set in Anope's configuration.");
}
void OnServerSync(Server *s)
diff --git a/modules/protocol/ratbox.cpp b/modules/protocol/ratbox.cpp
index 1ca9459a8..d6cfc761f 100644
--- a/modules/protocol/ratbox.cpp
+++ b/modules/protocol/ratbox.cpp
@@ -563,14 +563,13 @@ class ProtoRatbox : public Module
}
public:
- ProtoRatbox(const Anope::string &modname, const Anope::string &creator) : Module(modname, creator),
+ ProtoRatbox(const Anope::string &modname, const Anope::string &creator) : Module(modname, creator, PROTOCOL),
message_kick("KICK", event_kick), message_tmode("TMODE", event_tmode),
message_bmask("BMASK", event_bmask), message_pass("PASS", event_pass),
message_tb("TB", event_tburst), message_sid("SID", event_sid), message_encap("ENCAP", event_encap),
message_pong("PONG", event_pong)
{
this->SetAuthor("Anope");
- this->SetType(PROTOCOL);
pmodule_ircd_var(myIrcd);
pmodule_ircd_proto(&this->ircd_proto);
@@ -580,6 +579,9 @@ class ProtoRatbox : public Module
Implementation i[] = { I_OnServerSync };
ModuleManager::Attach(i, this, 1);
+
+ if (Config->Numeric.empty())
+ throw ModuleException("This IRCd protocol requires a server id to be set in Anope's configuration.");
}
void OnServerSync(Server *s)
diff --git a/modules/protocol/unreal32.cpp b/modules/protocol/unreal.cpp
index be7407af7..fa25a1049 100644
--- a/modules/protocol/unreal32.cpp
+++ b/modules/protocol/unreal.cpp
@@ -1096,7 +1096,7 @@ class ProtoUnreal : public Module
}
public:
- ProtoUnreal(const Anope::string &modname, const Anope::string &creator) : Module(modname, creator),
+ ProtoUnreal(const Anope::string &modname, const Anope::string &creator) : Module(modname, creator, PROTOCOL),
message_away("6", OnAway),
message_join("C", OnJoin),
message_kick("H", OnKick), message_kill(".", OnKill),
@@ -1123,7 +1123,6 @@ class ProtoUnreal : public Module
message_stats("2", OnStats), message_time(">", OnTime), message_version("+", OnVersion)
{
this->SetAuthor("Anope");
- this->SetType(PROTOCOL);
pmodule_ircd_var(myIrcd);
pmodule_ircd_proto(&this->ircd_proto);