summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAdam <Adam@anope.org>2016-12-08 10:18:27 -0500
committerAdam <Adam@anope.org>2016-12-08 10:18:27 -0500
commited08d1a31119adb379f8bec46d7ad47ee35c4c92 (patch)
treebe5de3edeaf26ad7efbf23a3d6508645614f283e
parent0d112886980787ffd5c69e514eebe476bcec8343 (diff)
Export protocol implementations into protocol module headers
-rw-r--r--include/modules/protocol/bahamut.h60
-rw-r--r--include/modules/protocol/charybdis.h46
-rw-r--r--include/modules/protocol/hybrid.h68
-rw-r--r--include/modules/protocol/inspircd20.h85
-rw-r--r--include/modules/protocol/ngircd.h46
-rw-r--r--include/modules/protocol/plexus.h48
-rw-r--r--include/modules/protocol/ratbox.h39
-rw-r--r--include/modules/protocol/unreal.h77
-rw-r--r--modules/protocol/bahamut.cpp452
-rw-r--r--modules/protocol/charybdis.cpp222
-rw-r--r--modules/protocol/hybrid.cpp499
-rw-r--r--modules/protocol/inspircd20.cpp723
-rw-r--r--modules/protocol/ngircd.cpp236
-rw-r--r--modules/protocol/plexus.cpp266
-rw-r--r--modules/protocol/ratbox.cpp216
-rw-r--r--modules/protocol/unreal.cpp660
16 files changed, 2060 insertions, 1683 deletions
diff --git a/include/modules/protocol/bahamut.h b/include/modules/protocol/bahamut.h
index 634360f99..f120c7d4c 100644
--- a/include/modules/protocol/bahamut.h
+++ b/include/modules/protocol/bahamut.h
@@ -22,6 +22,64 @@
namespace bahamut
{
+class Proto : public IRCDProto
+{
+ public:
+ Proto(Module *creator);
+
+ void SendMode(const MessageSource &source, Channel *dest, const Anope::string &buf) override;
+
+ void SendMode(const MessageSource &source, User *u, const Anope::string &buf) override;
+
+ void SendGlobalNotice(ServiceBot *bi, Server *dest, const Anope::string &msg) override;
+
+ void SendGlobalPrivmsg(ServiceBot *bi, Server *dest, const Anope::string &msg) override;
+
+ void SendSVSHold(const Anope::string &nick, time_t time) override;
+
+ void SendSVSHoldDel(const Anope::string &nick) override;
+
+ void SendSQLine(User *, XLine *x) override;
+
+ void SendSGLineDel(XLine *x) override;
+
+ void SendSZLineDel(XLine *x) override;
+
+ void SendSZLine(User *, XLine *x) override;
+
+ void SendSVSNOOP(Server *server, bool set) override;
+
+ void SendSGLine(User *, XLine *x) override;
+
+ void SendAkillDel(XLine *x) override;
+
+ void SendTopic(const MessageSource &source, Channel *c) override;
+
+ void SendSQLineDel(XLine *x) override;
+
+ void SendJoin(User *user, Channel *c, const ChannelStatus *status) override;
+
+ void SendAkill(User *u, XLine *x) override;
+
+ void SendSVSKill(const MessageSource &source, User *user, const Anope::string &buf) override;
+
+ void SendBOB() override;
+
+ void SendEOB() override;
+
+ void SendClientIntroduction(User *u) override;
+
+ void SendServer(Server *server) override;
+
+ void SendConnect() override;
+
+ void SendChannel(Channel *c) override;
+
+ void SendLogin(User *u, NickServ::Nick *) override;
+
+ void SendLogout(User *u) override;
+};
+
class Burst : public IRCDMessage
{
public:
@@ -70,4 +128,4 @@ class Topic : public IRCDMessage
void Run(MessageSource &source, const std::vector<Anope::string> &params) override;
};
-} // namespace bahamut \ No newline at end of file
+} // namespace bahamut
diff --git a/include/modules/protocol/charybdis.h b/include/modules/protocol/charybdis.h
index d65e094a0..ee81a60a1 100644
--- a/include/modules/protocol/charybdis.h
+++ b/include/modules/protocol/charybdis.h
@@ -22,6 +22,52 @@
namespace charybdis
{
+class Proto : public IRCDProto
+{
+ ServiceReference<IRCDProto> ratbox; // XXX
+
+ public:
+ Proto(Module *creator);
+
+ void SendSVSKill(const MessageSource &source, User *targ, const Anope::string &reason) override { ratbox->SendSVSKill(source, targ, reason); }
+ void SendGlobalNotice(ServiceBot *bi, Server *dest, const Anope::string &msg) override { ratbox->SendGlobalNotice(bi, dest, msg); }
+ void SendGlobalPrivmsg(ServiceBot *bi, Server *dest, const Anope::string &msg) override { ratbox->SendGlobalPrivmsg(bi, dest, msg); }
+ void SendGlobops(const MessageSource &source, const Anope::string &buf) override { ratbox->SendGlobops(source, buf); }
+ void SendSGLine(User *u, XLine *x) override { ratbox->SendSGLine(u, x); }
+ void SendSGLineDel(XLine *x) override { ratbox->SendSGLineDel(x); }
+ void SendAkill(User *u, XLine *x) override { ratbox->SendAkill(u, x); }
+ void SendAkillDel(XLine *x) override { ratbox->SendAkillDel(x); }
+ void SendSQLine(User *u, XLine *x) override { ratbox->SendSQLine(u, x); }
+ void SendSQLineDel(XLine *x) override { ratbox->SendSQLineDel(x); }
+ void SendJoin(User *user, Channel *c, const ChannelStatus *status) override { ratbox->SendJoin(user, c, status); }
+ void SendServer(Server *server) override { ratbox->SendServer(server); }
+ void SendChannel(Channel *c) override { ratbox->SendChannel(c); }
+ void SendTopic(const MessageSource &source, Channel *c) override { ratbox->SendTopic(source, c); }
+ bool IsIdentValid(const Anope::string &ident) override { return ratbox->IsIdentValid(ident); }
+ void SendLogin(User *u, NickServ::Nick *na) override { ratbox->SendLogin(u, na); }
+ void SendLogout(User *u) override { ratbox->SendLogout(u); }
+
+ void SendConnect() override;
+
+ void SendClientIntroduction(User *u) override;
+
+ void SendForceNickChange(User *u, const Anope::string &newnick, time_t when) override;
+
+ void SendSVSHold(const Anope::string &nick, time_t delay) override;
+
+ void SendSVSHoldDel(const Anope::string &nick) override;
+
+ void SendVhost(User *u, const Anope::string &ident, const Anope::string &host) override;
+
+ void SendVhostDel(User *u) override;
+
+ void SendSASLMechanisms(std::vector<Anope::string> &mechanisms) override;
+
+ void SendSASLMessage(const SASL::Message &message) override;
+
+ void SendSVSLogin(const Anope::string &uid, const Anope::string &acc, const Anope::string &vident, const Anope::string &vhost) override;
+};
+
class Encap : public IRCDMessage
{
ServiceReference<SASL::Service> sasl;
diff --git a/include/modules/protocol/hybrid.h b/include/modules/protocol/hybrid.h
index 943480f54..a0a9143a8 100644
--- a/include/modules/protocol/hybrid.h
+++ b/include/modules/protocol/hybrid.h
@@ -24,6 +24,74 @@
namespace hybrid
{
+class Proto : public IRCDProto
+{
+ ServiceBot *FindIntroduced();
+
+ void SendSVSKill(const MessageSource &source, User *u, const Anope::string &buf) override;
+
+ public:
+ Proto(Module *creator);
+
+ void SendInvite(const MessageSource &source, Channel *c, User *u) override;
+
+ void SendGlobalNotice(ServiceBot *bi, Server *dest, const Anope::string &msg) override;
+
+ void SendGlobalPrivmsg(ServiceBot *bi, Server *dest, const Anope::string &msg) override;
+
+ void SendSQLine(User *, XLine *x) override;
+
+ void SendSGLineDel(XLine *x) override;
+
+ void SendSGLine(User *, XLine *x) override;
+
+ void SendSZLineDel(XLine *x) override;
+
+ void SendSZLine(User *, XLine *x) override;
+
+ void SendAkillDel(XLine *x) override;
+
+ void SendSQLineDel(XLine *x) override;
+
+ void SendJoin(User *u, Channel *c, const ChannelStatus *status) override;
+
+ void SendAkill(User *u, XLine *x) override;
+
+ void SendServer(Server *server) override;
+
+ void SendConnect() override;
+
+ void SendClientIntroduction(User *u) override;
+
+ void SendEOB() override;
+
+ void SendMode(const MessageSource &source, User *u, const Anope::string &buf) override;
+
+ void SendLogin(User *u, NickServ::Nick *na) override;
+
+ void SendLogout(User *u) override;
+
+ void SendChannel(Channel *c) override;
+
+ void SendTopic(const MessageSource &source, Channel *c) override;
+
+ void SendForceNickChange(User *u, const Anope::string &newnick, time_t when) override;
+
+ void SendSVSJoin(const MessageSource &source, User *u, const Anope::string &chan, const Anope::string &) override;
+
+ void SendSVSPart(const MessageSource &source, User *u, const Anope::string &chan, const Anope::string &param) override;
+
+ void SendSVSHold(const Anope::string &nick, time_t t) override;
+
+ void SendSVSHoldDel(const Anope::string &nick) override;
+
+ void SendVhost(User *u, const Anope::string &ident, const Anope::string &host) override;
+
+ void SendVhostDel(User *u) override;
+
+ bool IsIdentValid(const Anope::string &ident) override;
+};
+
class BMask : public IRCDMessage
{
public:
diff --git a/include/modules/protocol/inspircd20.h b/include/modules/protocol/inspircd20.h
index 9489353d0..f2126a931 100644
--- a/include/modules/protocol/inspircd20.h
+++ b/include/modules/protocol/inspircd20.h
@@ -22,6 +22,91 @@
namespace inspircd20
{
+class Proto : public IRCDProto
+{
+ private:
+ void SendSVSKill(const MessageSource &source, User *user, const Anope::string &buf) override;
+
+ void SendChgIdentInternal(const Anope::string &nick, const Anope::string &vIdent);
+
+ void SendChgHostInternal(const Anope::string &nick, const Anope::string &vhost);
+
+ void SendAddLine(const Anope::string &xtype, const Anope::string &mask, time_t duration, const Anope::string &addedby, const Anope::string &reason);
+
+ void SendDelLine(const Anope::string &xtype, const Anope::string &mask);
+
+ public:
+ Proto(Module *creator);
+
+ void SendConnect() override;
+
+ void SendGlobalNotice(ServiceBot *bi, Server *dest, const Anope::string &msg) override;
+
+ void SendGlobalPrivmsg(ServiceBot *bi, Server *dest, const Anope::string &msg) override;
+
+ void SendAkillDel(XLine *x) override;
+
+ void SendTopic(const MessageSource &source, Channel *c) override;
+
+ void SendVhostDel(User *u) override;
+
+ void SendAkill(User *u, XLine *x) override;
+
+ void SendNumeric(int numeric, User *dest, IRCMessage &message);
+
+ void SendMode(const MessageSource &source, Channel *dest, const Anope::string &buf) override;
+
+ void SendClientIntroduction(User *u) override;
+
+ void SendServer(Server *server) override;
+
+ void SendSquit(Server *s, const Anope::string &message) override;
+
+ void SendJoin(User *user, Channel *c, const ChannelStatus *status) override;
+
+ void SendSQLineDel(XLine *x) override;
+
+ void SendSQLine(User *, XLine *x) override;
+
+ void SendVhost(User *u, const Anope::string &vIdent, const Anope::string &vhost) override;
+
+ void SendSVSHold(const Anope::string &nick, time_t t) override;
+
+ void SendSVSHoldDel(const Anope::string &nick) override;
+
+ void SendSZLineDel(XLine *x) override;
+
+ void SendSZLine(User *, XLine *x) override;
+
+ void SendSVSJoin(const MessageSource &source, User *u, const Anope::string &chan, const Anope::string &) override;
+
+ void SendSVSPart(const MessageSource &source, User *u, const Anope::string &chan, const Anope::string &param) override;
+
+ void SendSWhois(const MessageSource &, const Anope::string &who, const Anope::string &mask) override;
+
+ void SendBOB() override;
+
+ void SendEOB() override;
+
+ void SendGlobops(const MessageSource &source, const Anope::string &buf) override;
+
+ void SendLogin(User *u, NickServ::Nick *na) override;
+
+ void SendLogout(User *u) override;
+
+ void SendChannel(Channel *c) override;
+
+ void SendSASLMechanisms(std::vector<Anope::string> &mechanisms) override;
+
+ void SendSASLMessage(const SASL::Message &message) override;
+
+ void SendSVSLogin(const Anope::string &uid, const Anope::string &acc, const Anope::string &vident, const Anope::string &vhost) override;
+
+ bool IsExtbanValid(const Anope::string &mask) override;
+
+ bool IsIdentValid(const Anope::string &ident) override;
+};
+
class Capab : public rfc1459::Capab
{
public:
diff --git a/include/modules/protocol/ngircd.h b/include/modules/protocol/ngircd.h
index 0bfebea9f..fef637aca 100644
--- a/include/modules/protocol/ngircd.h
+++ b/include/modules/protocol/ngircd.h
@@ -23,6 +23,50 @@
namespace ngircd
{
+class Proto : public IRCDProto
+{
+ void SendSVSKill(const MessageSource &source, User *user, const Anope::string &buf) override;
+
+ public:
+ Proto(Module *creator);
+
+ void SendAkill(User *u, XLine *x) override;
+
+ void SendAkillDel(XLine *x) override;
+
+ void SendChannel(Channel *c) override;
+
+ // Received: :dev.anope.de NICK DukeP 1 ~DukePyro p57ABF9C9.dip.t-dialin.net 1 +i :DukePyrolator
+ void SendClientIntroduction(User *u) override;
+
+ void SendConnect() override;
+
+ void SendForceNickChange(User *u, const Anope::string &newnick, time_t when) override;
+
+ void SendGlobalNotice(ServiceBot *bi, Server *dest, const Anope::string &msg) override;
+
+ void SendGlobalPrivmsg(ServiceBot *bi, Server *dest, const Anope::string &msg) override;
+
+ void SendGlobops(const MessageSource &source, const Anope::string &buf) override;
+
+ void SendJoin(User *user, Channel *c, const ChannelStatus *status) override;
+
+ void SendLogin(User *u, NickServ::Nick *na) override;
+
+ void SendLogout(User *u) override;
+
+ /* SERVER name hop descript */
+ void SendServer(Server *server) override;
+
+ void SendTopic(const MessageSource &source, Channel *c) override;
+
+ void SendVhost(User *u, const Anope::string &vIdent, const Anope::string &vhost) override;
+
+ void SendVhostDel(User *u) override;
+
+ Anope::string Format(IRCMessage &message) override;
+};
+
class Numeric005 : public IRCDMessage
{
public:
@@ -92,7 +136,7 @@ struct Nick : public IRCDMessage
class NJoin : public IRCDMessage
{
public:
- NJoin(Module *creator) : IRCDMessage(creator, "NJOIN",2) { SetFlag(IRCDMESSAGE_REQUIRE_SERVER); };
+ NJoin(Module *creator) : IRCDMessage(creator, "NJOIN", 2) { SetFlag(IRCDMESSAGE_REQUIRE_SERVER); };
/*
* RFC 2813, 4.2.2: Njoin Message:
diff --git a/include/modules/protocol/plexus.h b/include/modules/protocol/plexus.h
index 0c5d8d8c0..69be3d713 100644
--- a/include/modules/protocol/plexus.h
+++ b/include/modules/protocol/plexus.h
@@ -22,6 +22,54 @@
namespace plexus
{
+class Proto : public IRCDProto
+{
+ ServiceReference<IRCDProto> hybrid; // XXX use moddeps + inheritance here
+
+ public:
+ Proto(Module *creator);
+
+ void SendSVSKill(const MessageSource &source, User *targ, const Anope::string &reason) override { hybrid->SendSVSKill(source, targ, reason); }
+ void SendGlobalNotice(ServiceBot *bi, Server *dest, const Anope::string &msg) override { hybrid->SendGlobalNotice(bi, dest, msg); }
+ void SendGlobalPrivmsg(ServiceBot *bi, Server *dest, const Anope::string &msg) override { hybrid->SendGlobalPrivmsg(bi, dest, msg); }
+ void SendSQLine(User *u, XLine *x) override { hybrid->SendSQLine(u, x); }
+ void SendSQLineDel(XLine *x) override { hybrid->SendSQLineDel(x); }
+ void SendSGLineDel(XLine *x) override { hybrid->SendSGLineDel(x); }
+ void SendSGLine(User *u, XLine *x) override { hybrid->SendSGLine(u, x); }
+ void SendAkillDel(XLine *x) override { hybrid->SendAkillDel(x); }
+ void SendAkill(User *u, XLine *x) override { hybrid->SendAkill(u, x); }
+ void SendServer(Server *server) override { hybrid->SendServer(server); }
+ void SendChannel(Channel *c) override { hybrid->SendChannel(c); }
+ void SendSVSHold(const Anope::string &nick, time_t t) override { hybrid->SendSVSHold(nick, t); }
+ void SendSVSHoldDel(const Anope::string &nick) override { hybrid->SendSVSHoldDel(nick); }
+
+ void SendGlobops(const MessageSource &source, const Anope::string &buf) override;
+
+ void SendJoin(User *user, Channel *c, const ChannelStatus *status) override;
+
+ void SendForceNickChange(User *u, const Anope::string &newnick, time_t when) override;
+
+ void SendVhost(User *u, const Anope::string &ident, const Anope::string &host) override;
+
+ void SendVhostDel(User *u) override;
+
+ void SendConnect() override;
+
+ void SendClientIntroduction(User *u) override;
+
+ void SendMode(const MessageSource &source, User *u, const Anope::string &buf) override;
+
+ void SendLogin(User *u, NickServ::Nick *na) override;
+
+ void SendLogout(User *u) override;
+
+ void SendTopic(const MessageSource &source, Channel *c) override;
+
+ void SendSVSJoin(const MessageSource &source, User *user, const Anope::string &chan, const Anope::string &param) override;
+
+ void SendSVSPart(const MessageSource &source, User *user, const Anope::string &chan, const Anope::string &param) override;
+};
+
class Encap : public IRCDMessage
{
public:
diff --git a/include/modules/protocol/ratbox.h b/include/modules/protocol/ratbox.h
index 2ad4a5529..ba7a7f19f 100644
--- a/include/modules/protocol/ratbox.h
+++ b/include/modules/protocol/ratbox.h
@@ -24,6 +24,45 @@
namespace ratbox
{
+class Proto : public IRCDProto
+{
+ ServiceReference<IRCDProto> hybrid; // XXX
+
+ ServiceBot *FindIntroduced();
+
+ public:
+ Proto(Module *creator);
+
+ void SendSVSKill(const MessageSource &source, User *targ, const Anope::string &reason) override { hybrid->SendSVSKill(source, targ, reason); }
+ void SendGlobalNotice(ServiceBot *bi, Server *dest, const Anope::string &msg) override { hybrid->SendGlobalNotice(bi, dest, msg); }
+ void SendGlobalPrivmsg(ServiceBot *bi, Server *dest, const Anope::string &msg) override { hybrid->SendGlobalPrivmsg(bi, dest, msg); }
+ void SendSGLine(User *u, XLine *x) override { hybrid->SendSGLine(u, x); }
+ void SendSGLineDel(XLine *x) override { hybrid->SendSGLineDel(x); }
+ void SendAkill(User *u, XLine *x) override { hybrid->SendAkill(u, x); }
+ void SendAkillDel(XLine *x) override { hybrid->SendAkillDel(x); }
+ void SendJoin(User *user, Channel *c, const ChannelStatus *status) override { hybrid->SendJoin(user, c, status); }
+ void SendServer(Server *server) override { hybrid->SendServer(server); }
+ void SendMode(const MessageSource &source, User *u, const Anope::string &buf) override { hybrid->SendMode(source, u, buf); }
+ void SendChannel(Channel *c) override { hybrid->SendChannel(c); }
+ bool IsIdentValid(const Anope::string &ident) override { return hybrid->IsIdentValid(ident); }
+
+ void SendGlobops(const MessageSource &source, const Anope::string &buf) override;
+
+ void SendConnect() override;
+
+ void SendClientIntroduction(User *u) override;
+
+ void SendLogin(User *u, NickServ::Nick *na) override;
+
+ void SendLogout(User *u) override;
+
+ void SendTopic(const MessageSource &source, Channel *c) override;
+
+ void SendSQLine(User *, XLine *x) override;
+
+ void SendSQLineDel(XLine *x) override;
+};
+
class Encap : public IRCDMessage
{
public:
diff --git a/include/modules/protocol/unreal.h b/include/modules/protocol/unreal.h
index 88ed05997..0a01cb4be 100644
--- a/include/modules/protocol/unreal.h
+++ b/include/modules/protocol/unreal.h
@@ -22,6 +22,83 @@
namespace unreal
{
+class Proto : public IRCDProto
+{
+ public:
+ Proto(Module *creator);
+
+ private:
+ void SendSVSNOOP(Server *server, bool set) override;
+
+ void SendAkillDel(XLine *x) override;
+
+ void SendTopic(const MessageSource &source, Channel *c) override;
+
+ void SendGlobalNotice(ServiceBot *bi, Server *dest, const Anope::string &msg) override;
+
+ void SendGlobalPrivmsg(ServiceBot *bi, Server *dest, const Anope::string &msg) override;
+
+ void SendVhostDel(User *u) override;
+
+ void SendAkill(User *u, XLine *x) override;
+
+ void SendSVSKill(const MessageSource &source, User *user, const Anope::string &buf) override;
+
+ void SendMode(const MessageSource &source, User *u, const Anope::string &buf) override;
+
+ void SendClientIntroduction(User *u) override;
+
+ void SendServer(Server *server) override;
+
+ void SendJoin(User *user, Channel *c, const ChannelStatus *status) override;
+
+ void SendSQLineDel(XLine *x) override;
+
+ void SendSQLine(User *, XLine *x) override;
+
+ void SendVhost(User *u, const Anope::string &vIdent, const Anope::string &vhost) override;
+
+ void SendConnect() override;
+
+ void SendSVSHold(const Anope::string &nick, time_t t) override;
+
+ void SendSVSHoldDel(const Anope::string &nick) override;
+
+ void SendSGLineDel(XLine *x) override;
+
+ void SendSZLineDel(XLine *x) override;
+
+ void SendSZLine(User *, XLine *x) override;
+
+ void SendSGLine(User *, XLine *x) override;
+
+ void SendSVSJoin(const MessageSource &source, User *user, const Anope::string &chan, const Anope::string &param) override;
+
+ void SendSVSPart(const MessageSource &source, User *user, const Anope::string &chan, const Anope::string &param) override;
+
+ void SendSWhois(const MessageSource &source, const Anope::string &who, const Anope::string &mask) override;
+
+ void SendEOB() override;
+
+ bool IsNickValid(const Anope::string &nick) override;
+
+ bool IsChannelValid(const Anope::string &chan) override;
+
+ bool IsExtbanValid(const Anope::string &mask) override;
+
+ void SendLogin(User *u, NickServ::Nick *na) override;
+
+ void SendLogout(User *u) override;
+
+ void SendChannel(Channel *c) override;
+
+ void SendSASLMessage(const ::SASL::Message &message) override;
+
+ void SendSVSLogin(const Anope::string &uid, const Anope::string &acc, const Anope::string &vident, const Anope::string &vhost) override;
+
+ bool IsIdentValid(const Anope::string &ident) override;
+};
+
class ChgHost : public IRCDMessage
{
public:
diff --git a/modules/protocol/bahamut.cpp b/modules/protocol/bahamut.cpp
index 7ab9dd9b2..46ffb3ea2 100644
--- a/modules/protocol/bahamut.cpp
+++ b/modules/protocol/bahamut.cpp
@@ -42,281 +42,277 @@ class ChannelModeFlood : public ChannelModeParam
}
};
-class BahamutIRCdProto : public IRCDProto
+bahamut::Proto::Proto(Module *creator) : IRCDProto(creator, "Bahamut 1.8.x")
{
- public:
- BahamutIRCdProto(Module *creator) : IRCDProto(creator, "Bahamut 1.8.x")
- {
- DefaultPseudoclientModes = "+";
- CanSVSNick = true;
- CanSNLine = true;
- CanSQLine = true;
- CanSQLineChannel = true;
- CanSZLine = true;
- CanSVSHold = true;
- MaxModes = 60;
- }
-
- void SendMode(const MessageSource &source, Channel *dest, const Anope::string &buf) override
- {
- if (Servers::Capab.count("TSMODE") > 0)
- {
- IRCMessage message(source, "MODE", dest->name, dest->creation_time);
- message.TokenizeAndPush(buf);
- Uplink::SendMessage(message);
- }
- else
- {
- IRCDProto::SendMode(source, dest, buf);
- }
- }
+ DefaultPseudoclientModes = "+";
+ CanSVSNick = true;
+ CanSNLine = true;
+ CanSQLine = true;
+ CanSQLineChannel = true;
+ CanSZLine = true;
+ CanSVSHold = true;
+ MaxModes = 60;
+}
- void SendMode(const MessageSource &source, User *u, const Anope::string &buf) override
+void bahamut::Proto::SendMode(const MessageSource &source, Channel *dest, const Anope::string &buf)
+{
+ if (Servers::Capab.count("TSMODE") > 0)
{
- IRCMessage message(source, "SVSMODE", u->nick, u->timestamp);
+ IRCMessage message(source, "MODE", dest->name, dest->creation_time);
message.TokenizeAndPush(buf);
Uplink::SendMessage(message);
}
-
- void SendGlobalNotice(ServiceBot *bi, Server *dest, const Anope::string &msg) override
+ else
{
- Uplink::Send(bi, "NOTICE", "$" + dest->GetName(), msg);
+ IRCDProto::SendMode(source, dest, buf);
}
+}
- void SendGlobalPrivmsg(ServiceBot *bi, Server *dest, const Anope::string &msg) override
- {
- Uplink::Send(bi, "PRIVMSG", "$" + dest->GetName(), msg);
- }
+void bahamut::Proto::SendMode(const MessageSource &source, User *u, const Anope::string &buf)
+{
+ IRCMessage message(source, "SVSMODE", u->nick, u->timestamp);
+ message.TokenizeAndPush(buf);
+ Uplink::SendMessage(message);
+}
- /* SVSHOLD - set */
- void SendSVSHold(const Anope::string &nick, time_t time) override
- {
- Uplink::Send(Me, "SVSHOLD", nick, time, "Being held for registered user");
- }
+void bahamut::Proto::SendGlobalNotice(ServiceBot *bi, Server *dest, const Anope::string &msg)
+{
+ Uplink::Send(bi, "NOTICE", "$" + dest->GetName(), msg);
+}
- /* SVSHOLD - release */
- void SendSVSHoldDel(const Anope::string &nick) override
- {
- Uplink::Send(Me, "SVSHOLD", nick, 0);
- }
+void bahamut::Proto::SendGlobalPrivmsg(ServiceBot *bi, Server *dest, const Anope::string &msg)
+{
+ Uplink::Send(bi, "PRIVMSG", "$" + dest->GetName(), msg);
+}
- /* SQLINE */
- void SendSQLine(User *, XLine *x) override
- {
- Uplink::Send(Me, "SQLINE", x->GetMask(), x->GetReason());
- }
+/* SVSHOLD - set */
+void bahamut::Proto::SendSVSHold(const Anope::string &nick, time_t time)
+{
+ Uplink::Send(Me, "SVSHOLD", nick, time, "Being held for registered user");
+}
- /* UNSLINE */
- void SendSGLineDel(XLine *x) override
- {
- Uplink::Send("UNSGLINE", 0, x->GetMask());
- }
+/* SVSHOLD - release */
+void bahamut::Proto::SendSVSHoldDel(const Anope::string &nick)
+{
+ Uplink::Send(Me, "SVSHOLD", nick, 0);
+}
- /* UNSZLINE */
- void SendSZLineDel(XLine *x) override
- {
- /* this will likely fail so its only here for legacy */
- Uplink::Send("UNSZLINE", 0, x->GetHost());
- /* this is how we are supposed to deal with it */
- Uplink::Send("RAKILL", x->GetHost(), "*");
- }
+/* SQLINE */
+void bahamut::Proto::SendSQLine(User *, XLine *x)
+{
+ Uplink::Send(Me, "SQLINE", x->GetMask(), x->GetReason());
+}
- /* SZLINE */
- void SendSZLine(User *, XLine *x) override
- {
- // Calculate the time left before this would expire, capping it at 2 days
- time_t timeleft = x->GetExpires() - Anope::CurTime;
- if (timeleft > 172800 || !x->GetExpires())
- timeleft = 172800;
- /* this will likely fail so its only here for legacy */
- Uplink::Send("SZLINE", x->GetHost(), x->GetReason());
- /* this is how we are supposed to deal with it */
- Uplink::Send("AKILL", x->GetHost(), "*", timeleft, x->GetBy(), Anope::CurTime, x->GetReason());
- }
+/* UNSLINE */
+void bahamut::Proto::SendSGLineDel(XLine *x)
+{
+ Uplink::Send("UNSGLINE", 0, x->GetMask());
+}
- /* SVSNOOP */
- void SendSVSNOOP(Server *server, bool set) override
- {
- Uplink::Send("SVSNOOP", server->GetName(), set ? "+" : "-");
- }
+/* UNSZLINE */
+void bahamut::Proto::SendSZLineDel(XLine *x)
+{
+ /* this will likely fail so its only here for legacy */
+ Uplink::Send("UNSZLINE", 0, x->GetHost());
+ /* this is how we are supposed to deal with it */
+ Uplink::Send("RAKILL", x->GetHost(), "*");
+}
- /* SGLINE */
- void SendSGLine(User *, XLine *x) override
- {
- Uplink::Send("SGLINE", x->GetMask().length(), x->GetMask() + ":" + x->GetReason());
- }
+/* SZLINE */
+void bahamut::Proto::SendSZLine(User *, XLine *x)
+{
+ // Calculate the time left before this would expire, capping it at 2 days
+ time_t timeleft = x->GetExpires() - Anope::CurTime;
+ if (timeleft > 172800 || !x->GetExpires())
+ timeleft = 172800;
+ /* this will likely fail so its only here for legacy */
+ Uplink::Send("SZLINE", x->GetHost(), x->GetReason());
+ /* this is how we are supposed to deal with it */
+ Uplink::Send("AKILL", x->GetHost(), "*", timeleft, x->GetBy(), Anope::CurTime, x->GetReason());
+}
- /* RAKILL */
- void SendAkillDel(XLine *x) override
- {
- if (x->IsRegex() || x->HasNickOrReal())
- return;
+/* SVSNOOP */
+void bahamut::Proto::SendSVSNOOP(Server *server, bool set)
+{
+ Uplink::Send("SVSNOOP", server->GetName(), set ? "+" : "-");
+}
- /* ZLine if we can instead */
- if (x->GetUser() == "*")
- {
- cidr a(x->GetHost());
- if (a.valid())
- {
- IRCD->SendSZLineDel(x);
- return;
- }
- }
+/* SGLINE */
+void bahamut::Proto::SendSGLine(User *, XLine *x)
+{
+ Uplink::Send("SGLINE", x->GetMask().length(), x->GetMask() + ":" + x->GetReason());
+}
- Uplink::Send("RAKKILL", x->GetHost(), x->GetUser());
- }
+/* RAKILL */
+void bahamut::Proto::SendAkillDel(XLine *x)
+{
+ if (x->IsRegex() || x->HasNickOrReal())
+ return;
- /* TOPIC */
- void SendTopic(const MessageSource &source, Channel *c) override
+ /* ZLine if we can instead */
+ if (x->GetUser() == "*")
{
- Uplink::Send(source, "TOPIC", c->name, c->topic_setter, c->topic_ts, c->topic);
+ cidr a(x->GetHost());
+ if (a.valid())
+ {
+ IRCD->SendSZLineDel(x);
+ return;
+ }
}
- /* UNSQLINE */
- void SendSQLineDel(XLine *x) override
- {
- Uplink::Send("UNSQLINE", x->GetMask());
- }
+ Uplink::Send("RAKKILL", x->GetHost(), x->GetUser());
+}
+
+/* TOPIC */
+void bahamut::Proto::SendTopic(const MessageSource &source, Channel *c)
+{
+ Uplink::Send(source, "TOPIC", c->name, c->topic_setter, c->topic_ts, c->topic);
+}
+
+/* UNSQLINE */
+void bahamut::Proto::SendSQLineDel(XLine *x)
+{
+ Uplink::Send("UNSQLINE", x->GetMask());
+}
- /* JOIN - SJOIN */
- void SendJoin(User *user, Channel *c, const ChannelStatus *status) override
+/* JOIN - SJOIN */
+void bahamut::Proto::SendJoin(User *user, Channel *c, const ChannelStatus *status)
+{
+ Uplink::Send(user, "SJOIN", c->creation_time, c->name);
+
+ if (status)
{
- Uplink::Send(user, "SJOIN", c->creation_time, c->name);
+ /* First save the channel status incase uc->Status == status */
+ ChannelStatus cs = *status;
+ /* If the user is internally on the channel with flags, kill them so that
+ * the stacker will allow this.
+ */
+ ChanUserContainer *uc = c->FindUser(user);
+ if (uc != NULL)
+ uc->status.Clear();
- if (status)
- {
- /* First save the channel status incase uc->Status == status */
- ChannelStatus cs = *status;
- /* If the user is internally on the channel with flags, kill them so that
- * the stacker will allow this.
- */
- ChanUserContainer *uc = c->FindUser(user);
- if (uc != NULL)
- uc->status.Clear();
-
- ServiceBot *setter = ServiceBot::Find(user->GetUID());
- for (size_t i = 0; i < cs.Modes().length(); ++i)
- c->SetMode(setter, ModeManager::FindChannelModeByChar(cs.Modes()[i]), user->GetUID(), false);
-
- if (uc != NULL)
- uc->status = cs;
- }
+ ServiceBot *setter = ServiceBot::Find(user->GetUID());
+ for (size_t i = 0; i < cs.Modes().length(); ++i)
+ c->SetMode(setter, ModeManager::FindChannelModeByChar(cs.Modes()[i]), user->GetUID(), false);
+
+ if (uc != NULL)
+ uc->status = cs;
}
+}
- void SendAkill(User *u, XLine *x) override
+void bahamut::Proto::SendAkill(User *u, XLine *x)
+{
+ if (x->IsRegex() || x->HasNickOrReal())
{
- if (x->IsRegex() || x->HasNickOrReal())
+ if (!u)
{
- if (!u)
- {
- /* 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->GetManager()->Check(it->second, x))
- this->SendAkill(it->second, x);
- return;
- }
+ /* 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->GetManager()->Check(it->second, x))
+ this->SendAkill(it->second, x);
+ return;
+ }
- XLine *old = x;
+ XLine *old = x;
- if (old->GetManager()->HasEntry("*@" + u->host))
- return;
+ 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 = Serialize::New<XLine *>();
- x->SetMask("*@" + u->host);
- x->SetBy(old->GetBy());
- x->SetExpires(old->GetExpires());
- x->SetReason(old->GetReason());
- x->SetID(old->GetID());
- old->GetManager()->AddXLine(x);
+ /* We can't akill x as it has a nick and/or realname included, so create a new akill for *@host */
+ 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->GetManag