summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorAdam <Adam@anope.org>2016-12-17 21:44:22 -0500
committerAdam <Adam@anope.org>2016-12-17 21:44:22 -0500
commit4fcbbbe4fbc137841b47c8e2372477b85649270a (patch)
treef2a5fd3b5a77ef0384df6e2712fdd74f832d7dfe /include
parented08d1a31119adb379f8bec46d7ad47ee35c4c92 (diff)
Split ircdproto send functions out into separate services
This makes it easier to see which send functions a protocol module implements as they are all explicitly registered by the module, and avoids the problem of subtly breaking other protocol modules when using inheritance. Also split the old "core" send implementations out into a module, and the TS6 ID generator
Diffstat (limited to 'include')
-rw-r--r--include/channels.h2
-rw-r--r--include/messages.h558
-rw-r--r--include/module.h1
-rw-r--r--include/modules/protocol/bahamut.h195
-rw-r--r--include/modules/protocol/charybdis.h98
-rw-r--r--include/modules/protocol/hybrid.h234
-rw-r--r--include/modules/protocol/inspircd20.h264
-rw-r--r--include/modules/protocol/ngircd.h88
-rw-r--r--include/modules/protocol/plexus.h99
-rw-r--r--include/modules/protocol/ratbox.h93
-rw-r--r--include/modules/protocol/rfc1459.h159
-rw-r--r--include/modules/protocol/ts6.h37
-rw-r--r--include/modules/protocol/unreal.h232
-rw-r--r--include/protocol.h196
14 files changed, 1848 insertions, 408 deletions
diff --git a/include/channels.h b/include/channels.h
index d3161b7ae..31fa582c4 100644
--- a/include/channels.h
+++ b/include/channels.h
@@ -70,7 +70,7 @@ class CoreExport Channel : public Base, public Extensible
Anope::string topic;
/* Who set the topic */
Anope::string topic_setter;
- /* The timestamp associated with the topic. Not necessarually anywhere close to Anope::CurTime.
+ /* The timestamp associated with the topic. Not necessarily anywhere close to Anope::CurTime.
* This is the time the topic was *originally set*. When we restore the topic we want to change the TS back
* to this, but we can only do this on certain IRCds.
*/
diff --git a/include/messages.h b/include/messages.h
new file mode 100644
index 000000000..3361d5740
--- /dev/null
+++ b/include/messages.h
@@ -0,0 +1,558 @@
+/*
+ * Anope IRC Services
+ *
+ * Copyright (C) 2016 Anope Team <team@anope.org>
+ *
+ * This file is part of Anope. Anope is free software; you can
+ * redistribute it and/or modify it under the terms of the GNU
+ * General Public License as published by the Free Software
+ * Foundation, version 2.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, see see <http://www.gnu.org/licenses/>.
+ */
+
+#pragma once
+
+template<typename T>
+class MessageSender : public Service
+{
+ public:
+ static constexpr const char *NAME = "messagesender";
+
+ MessageSender(Module *owner) : Service(owner, NAME, T::NAME) { }
+};
+
+namespace messages
+{
+
+class Akill : public MessageSender<Akill>
+{
+ public:
+ static constexpr const char *NAME = "akill";
+
+ using MessageSender::MessageSender;
+
+ /** Sets an akill. This is a recursive function that can be called multiple times
+ * for the same xline, but for different users, if the xline is not one that can be
+ * enforced by the IRCd, such as a nick/user/host/realname combination ban.
+ * @param u The user affected by the akill, if known
+ * @param x The akill
+ */
+ virtual void Send(User *, XLine *) anope_abstract;
+};
+
+class AkillDel : public MessageSender<AkillDel>
+{
+ public:
+ static constexpr const char *NAME = "akilldel";
+
+ using MessageSender::MessageSender;
+
+ virtual void Send(XLine *) anope_abstract;
+};
+
+class MessageChannel : public MessageSender<MessageChannel>
+{
+ public:
+ static constexpr const char *NAME = "channel";
+
+ using MessageSender::MessageSender;
+
+ /** Send a channel creation message to the uplink.
+ * On most IRCds this is a SJOIN with no nicks
+ */
+ virtual void Send(Channel *) anope_abstract;
+};
+
+class GlobalNotice : public MessageSender<GlobalNotice>
+{
+ public:
+ static constexpr const char *NAME = "globalnotice";
+
+ using MessageSender::MessageSender;
+
+ virtual void Send(const MessageSource &, Server *dest, const Anope::string &msg) anope_abstract;
+};
+
+class GlobalPrivmsg : public MessageSender<GlobalPrivmsg>
+{
+ public:
+ static constexpr const char *NAME = "globalprivmsg";
+
+ using MessageSender::MessageSender;
+
+ virtual void Send(const MessageSource &, Server *dest, const Anope::string &msg) anope_abstract;
+};
+
+class Invite : public MessageSender<Invite>
+{
+ public:
+ static constexpr const char *NAME = "invite";
+
+ using MessageSender::MessageSender;
+
+ virtual void Send(const MessageSource &source, Channel *c, User *u) anope_abstract;
+};
+
+class Join : public MessageSender<Join>
+{
+ public:
+ static constexpr const char *NAME = "join";
+
+ using MessageSender::MessageSender;
+
+ /** Joins one of our users to a channel.
+ * @param u The user to join
+ * @param c The channel to join the user to
+ * @param status The status to set on the user after joining. This may or may not already internally
+ * be set on the user. This may include the modes in the join, but will usually place them on the mode
+ * stacker to be set "soon".
+ */
+ virtual void Send(User *u, Channel *c, const ChannelStatus *status) anope_abstract;
+};
+
+class Kick : public MessageSender<Kick>
+{
+ public:
+ static constexpr const char *NAME = "kick";
+
+ using MessageSender::MessageSender;
+
+ /** Kick a user from a channel
+ * @param source Who is doing the kick
+ * @param channel Channel
+ * @param user Target of the kick
+ * @param reason Kick reason
+ */
+ virtual void Send(const MessageSource &source, Channel *channel, User *user, const Anope::string &reason) anope_abstract;
+};
+
+class Kill : public MessageSender<Kill>
+{
+ public:
+ static constexpr const char *NAME = "svskill";
+
+ using MessageSender::MessageSender;
+
+ virtual void Send(const MessageSource &source, const Anope::string &target, const Anope::string &reason) anope_abstract;
+
+ /** Kills a user
+ * @param source Who is doing the kill
+ * @param user The target to be killed
+ * @param reason Kill reason
+ */
+ virtual void Send(const MessageSource &source, User *user, const Anope::string &reason) anope_abstract;
+};
+
+class Login : public MessageSender<Login>
+{
+ public:
+ static constexpr const char *NAME = "login";
+
+ using MessageSender::MessageSender;
+
+ virtual void Send(User *u, NickServ::Nick *na) anope_abstract;
+};
+
+class Logout : public MessageSender<Logout>
+{
+ public:
+ static constexpr const char *NAME = "logout";
+
+ using MessageSender::MessageSender;
+
+ virtual void Send(User *u) anope_abstract;
+};
+
+class ModeChannel : public MessageSender<ModeChannel>
+{
+ public:
+ static constexpr const char *NAME = "modechannel";
+
+ using MessageSender::MessageSender;
+
+ /** Changes the mode on a channel
+ * @param source Who is changing the mode
+ * @param channel Channel
+ * @param modes Modes eg +nt
+ */
+ virtual void Send(const MessageSource &source, Channel *channel, const Anope::string &modes) anope_abstract;
+};
+
+class ModeUser : public MessageSender<ModeUser>
+{
+ public:
+ static constexpr const char *NAME = "modeuser";
+
+ using MessageSender::MessageSender;
+
+ /** Changes the mode on a user
+ * @param source Who is changing the mode
+ * @param user user
+ * @param modes Modes eg +i
+ */
+ virtual void Send(const MessageSource &source, User *user, const Anope::string &modes) anope_abstract;
+};
+
+class NickChange : public MessageSender<NickChange>
+{
+ public:
+ static constexpr const char *NAME = "nickchange";
+
+ using MessageSender::MessageSender;
+
+ /** Sends a nick change of one of our clients.
+ */
+ virtual void Send(User *u, const Anope::string &newnick, time_t ts) anope_abstract;
+};
+
+class NickIntroduction : public MessageSender<NickIntroduction>
+{
+ public:
+ static constexpr const char *NAME = "nickintroduction";
+
+ using MessageSender::MessageSender;
+
+ /** Introduces a client to the rest of the network
+ * @param user The client to introduce
+ */
+ virtual void Send(User *user) anope_abstract;
+};
+
+class NOOP : public MessageSender<NOOP>
+{
+ public:
+ static constexpr const char *NAME = "noop";
+
+ using MessageSender::MessageSender;
+
+ /** Sets the server in NOOP mode. If NOOP mode is enabled, no users
+ * will be able to oper on the server.
+ * @param s The server
+ * @param mode Whether to turn NOOP on or off
+ */
+ virtual void Send(Server *s, bool mode) anope_abstract;
+};
+
+class Notice : public MessageSender<Notice>
+{
+ public:
+ static constexpr const char *NAME = "notice";
+
+ using MessageSender::MessageSender;
+
+ /** Send a notice to a target
+ * @param source Source of the notice
+ * @param dest Destination user/channel
+ * @param msg Message to send
+ */
+ virtual void Send(const MessageSource &source, const Anope::string &dest, const Anope::string &msg) anope_abstract;
+};
+
+class Part : public MessageSender<Part>
+{
+ public:
+ static constexpr const char *NAME = "part";
+
+ using MessageSender::MessageSender;
+
+ virtual void Send(User *, Channel *chan, const Anope::string &reason) anope_abstract;
+};
+
+class Ping : public MessageSender<Ping>
+{
+ public:
+ static constexpr const char *NAME = "ping";
+
+ using MessageSender::MessageSender;
+
+ virtual void Send(const Anope::string &servname, const Anope::string &who) anope_abstract;
+};
+
+class Pong : public MessageSender<Pong>
+{
+ public:
+ static constexpr const char *NAME = "pong";
+
+ using MessageSender::MessageSender;
+
+ /**
+ * Send a PONG reply to a received PING.
+ * servname should be left empty to send a one param reply.
+ * @param servname Daemon or client that is responding to the PING.
+ * @param who Origin of the PING and destination of the PONG message.
+ **/
+ virtual void Send(const Anope::string &servname, const Anope::string &who) anope_abstract;
+};
+
+class Privmsg : public MessageSender<Privmsg>
+{
+ public:
+ static constexpr const char *NAME = "privmsg";
+
+ using MessageSender::MessageSender;
+
+ /** Send a privmsg to a target
+ * @param source Source of the privmsg
+ * @param dest Destination user/channel
+ * @param msg Message to send
+ */
+ virtual void Send(const MessageSource &source, const Anope::string &dest, const Anope::string &msg) anope_abstract;
+};
+
+class Quit : public MessageSender<Quit>
+{
+ public:
+ static constexpr const char *NAME = "quit";
+
+ using MessageSender::MessageSender;
+
+ virtual void Send(User *user, const Anope::string &reason) anope_abstract;
+};
+
+class MessageServer : public MessageSender<MessageServer>
+{
+ public:
+ static constexpr const char *NAME = "server";
+
+ using MessageSender::MessageSender;
+
+ /** Introduces a server to the uplink
+ */
+ virtual void Send(Server *s) anope_abstract;
+};
+
+class SASL : public MessageSender<SASL>
+{
+ public:
+ static constexpr const char *NAME = "sasl";
+
+ using MessageSender::MessageSender;
+
+ virtual void Send(const ::SASL::Message &) anope_abstract;
+};
+
+class SASLMechanisms : public MessageSender<SASLMechanisms>
+{
+ public:
+ static constexpr const char *NAME = "saslmechanisms";
+
+ using MessageSender::MessageSender;
+
+ virtual void Send(const std::vector<Anope::string> &mechanisms) anope_abstract;
+};
+
+// realname ban
+class SGLine : public MessageSender<SGLine>
+{
+ public:
+ static constexpr const char *NAME = "sgline";
+
+ using MessageSender::MessageSender;
+
+ virtual void Send(User *, XLine *) anope_abstract;
+};
+
+class SGLineDel : public MessageSender<SGLineDel>
+{
+ public:
+ static constexpr const char *NAME = "sglinedel";
+
+ using MessageSender::MessageSender;
+
+ virtual void Send(XLine *) anope_abstract;
+};
+
+// Nick ban (and sometimes channel)
+class SQLine : public MessageSender<SQLine>
+{
+ public:
+ static constexpr const char *NAME = "sqline";
+
+ using MessageSender::MessageSender;
+
+ virtual void Send(User *, XLine *) anope_abstract;
+};
+
+class SQLineDel : public MessageSender<SQLineDel>
+{
+ public:
+ static constexpr const char *NAME = "sqlinedel";
+
+ using MessageSender::MessageSender;
+
+ virtual void Send(XLine *) anope_abstract;
+};
+
+// IP ban
+class SZLine : public MessageSender<SZLine>
+{
+ public:
+ static constexpr const char *NAME = "szline";
+
+ using MessageSender::MessageSender;
+
+ virtual void Send(User *, XLine *) anope_abstract;
+};
+
+class SZLineDel : public MessageSender<SZLineDel>
+{
+ public:
+ static constexpr const char *NAME = "szlinedel";
+
+ using MessageSender::MessageSender;
+
+ virtual void Send(XLine *) anope_abstract;
+};
+
+class SQuit : public MessageSender<SQuit>
+{
+ public:
+ static constexpr const char *NAME = "squit";
+
+ using MessageSender::MessageSender;
+
+ virtual void Send(Server *s, const Anope::string &message) anope_abstract;
+};
+
+class SVSHold : public MessageSender<SVSHold>
+{
+ public:
+ static constexpr const char *NAME = "svshold";
+
+ using MessageSender::MessageSender;
+
+ virtual void Send(const Anope::string &, time_t) anope_abstract;
+};
+
+class SVSHoldDel : public MessageSender<SVSHoldDel>
+{
+ public:
+ static constexpr const char *NAME = "svsholddel";
+
+ using MessageSender::MessageSender;
+
+ virtual void Send(const Anope::string &) anope_abstract;
+};
+
+class SVSJoin : public MessageSender<SVSJoin>
+{
+ public:
+ static constexpr const char *NAME = "svsjoin";
+
+ using MessageSender::MessageSender;
+
+ /** Force joins a user that isn't ours to a channel.
+ * @param bi The source of the message
+ * @param u The user to join
+ * @param chan The channel to join the user to
+ * @param key Channel key
+ */
+ virtual void Send(const MessageSource &source, User *u, const Anope::string &chan, const Anope::string &key) anope_abstract;
+};
+
+class SVSNick : public MessageSender<SVSNick>
+{
+ public:
+ static constexpr const char *NAME = "svsnick";
+
+ using MessageSender::MessageSender;
+
+ virtual void Send(User *u, const Anope::string &newnick, time_t ts) anope_abstract;
+};
+
+class SVSPart : public MessageSender<SVSPart>
+{
+ public:
+ static constexpr const char *NAME = "svspart";
+
+ using MessageSender::MessageSender;
+
+ /** Force parts a user that isn't ours from a channel.
+ * @param source The source of the message
+ * @param u The user to part
+ * @param chan The channel to part the user from
+ * @param param part reason, some IRCds don't support this
+ */
+ virtual void Send(const MessageSource &source, User *u, const Anope::string &chan, const Anope::string &reason) anope_abstract;
+};
+
+class SVSLogin : public MessageSender<SVSLogin>
+{
+ public:
+ static constexpr const char *NAME = "svslogin";
+
+ using MessageSender::MessageSender;
+
+ virtual void Send(const Anope::string &uid, const Anope::string &acc, const Anope::string &vident, const Anope::string &vhost) anope_abstract;
+};
+
+class SWhois : public MessageSender<SWhois>
+{
+ public:
+ static constexpr const char *NAME = "swhois";
+
+ using MessageSender::MessageSender;
+
+ virtual void Send(const MessageSource &, User *user, const Anope::string &) anope_abstract;
+};
+
+class Topic : public MessageSender<Topic>
+{
+ public:
+ static constexpr const char *NAME = "topic";
+
+ using MessageSender::MessageSender;
+
+ /** Sets the topic on a channel
+ * @param source The bot to set the topic from
+ * @param chan The channel to set the topic on
+ * @param topic The new topic
+ * @param topic_ts The desired time set for the new topic
+ * @param topic_setter Who set the topic
+ */
+ virtual void Send(const MessageSource &source, Channel *channel, const Anope::string &topic, time_t topic_ts, const Anope::string &topic_setter) anope_abstract;
+};
+
+class VhostDel : public MessageSender<VhostDel>
+{
+ public:
+ static constexpr const char *NAME = "vhostdel";
+
+ using MessageSender::MessageSender;
+
+ virtual void Send(User *u) anope_abstract;
+};
+
+class VhostSet : public MessageSender<VhostSet>
+{
+ public:
+ static constexpr const char *NAME = "vhostset";
+
+ using MessageSender::MessageSender;
+
+ /** Sets a vhost on a user.
+ * @param u The user
+ * @param vident The ident to set
+ * @param vhost The vhost to set
+ */
+ virtual void Send(User *u, const Anope::string &vident, const Anope::string &vhost) anope_abstract;
+};
+
+class Wallops : public MessageSender<Wallops>
+{
+ public:
+ static constexpr const char *NAME = "wallops";
+
+ using MessageSender::MessageSender;
+
+ virtual void Send(const MessageSource &source, const Anope::string &msg) anope_abstract;
+};
+
+} // namespace messages
diff --git a/include/module.h b/include/module.h
index 58b012fce..66446105a 100644
--- a/include/module.h
+++ b/include/module.h
@@ -32,6 +32,7 @@
#include "lists.h"
#include "logger.h"
#include "mail.h"
+#include "messages.h"
#include "modes.h"
#include "modules.h"
#include "numeric.h"
diff --git a/include/modules/protocol/bahamut.h b/include/modules/protocol/bahamut.h
index f120c7d4c..fd0d47c87 100644
--- a/include/modules/protocol/bahamut.h
+++ b/include/modules/protocol/bahamut.h
@@ -22,62 +22,201 @@
namespace bahamut
{
-class Proto : public IRCDProto
+namespace senders
+{
+
+class Akill : public messages::Akill
{
public:
- Proto(Module *creator);
+ using messages::Akill::Akill;
- void SendMode(const MessageSource &source, Channel *dest, const Anope::string &buf) override;
+ void Send(User *, XLine *) override;
+};
- void SendMode(const MessageSource &source, User *u, const Anope::string &buf) override;
+class AkillDel : public messages::AkillDel
+{
+ public:
+ using messages::AkillDel::AkillDel;
- void SendGlobalNotice(ServiceBot *bi, Server *dest, const Anope::string &msg) override;
+ void Send(XLine *) override;
+};
+
+class MessageChannel : public messages::MessageChannel
+{
+ public:
+ using messages::MessageChannel::MessageChannel;
+
+ void Send(Channel *) override;
+};
- void SendGlobalPrivmsg(ServiceBot *bi, Server *dest, const Anope::string &msg) override;
+class Join : public messages::Join
+{
+ public:
+ using messages::Join::Join;
+
+ void Send(User *u, Channel *c, const ChannelStatus *status) override;
+};
+
+class Kill : public messages::Kill
+{
+ public:
+ using messages::Kill::Kill;
+
+ void Send(const MessageSource &source, const Anope::string &target, const Anope::string &reason) override;
+
+ void Send(const MessageSource &source, User *user, const Anope::string &reason) override;
+};
+
+class Login : public messages::Login
+{
+ public:
+ using messages::Login::Login;
- void SendSVSHold(const Anope::string &nick, time_t time) override;
+ void Send(User *u, NickServ::Nick *na) override;
+};
- void SendSVSHoldDel(const Anope::string &nick) override;
+class Logout : public messages::Logout
+{
+ public:
+ using messages::Logout::Logout;
- void SendSQLine(User *, XLine *x) override;
+ void Send(User *u) override;
+};
- void SendSGLineDel(XLine *x) override;
+class ModeChannel : public messages::ModeChannel
+{
+ public:
+ using messages::ModeChannel::ModeChannel;
- void SendSZLineDel(XLine *x) override;
+ void Send(const MessageSource &source, Channel *channel, const Anope::string &modes) override;
+};
- void SendSZLine(User *, XLine *x) override;
+class ModeUser : public messages::ModeUser
+{
+ public:
+ using messages::ModeUser::ModeUser;
- void SendSVSNOOP(Server *server, bool set) override;
+ void Send(const MessageSource &source, User *user, const Anope::string &modes) override;
+};
- void SendSGLine(User *, XLine *x) override;
+class NickIntroduction : public messages::NickIntroduction
+{
+ public:
+ using messages::NickIntroduction::NickIntroduction;
- void SendAkillDel(XLine *x) override;
+ void Send(User *user) override;
+};
- void SendTopic(const MessageSource &source, Channel *c) override;
+class NOOP : public messages::NOOP
+{
+ public:
+ static constexpr const char *NAME = "noop";
- void SendSQLineDel(XLine *x) override;
+ using messages::NOOP::NOOP;
- void SendJoin(User *user, Channel *c, const ChannelStatus *status) override;
+ void Send(Server *s, bool mode) override;
+};
- void SendAkill(User *u, XLine *x) override;
+class SGLine : public messages::SGLine
+{
+ public:
+ using messages::SGLine::SGLine;
- void SendSVSKill(const MessageSource &source, User *user, const Anope::string &buf) override;
+ void Send(User *, XLine *) override;
+};
- void SendBOB() override;
+class SGLineDel : public messages::SGLineDel
+{
+ public:
+ using messages::SGLineDel::SGLineDel;
- void SendEOB() override;
+ void Send(XLine *) override;
+};
- void SendClientIntroduction(User *u) override;
+class SQLine : public messages::SQLine
+{
+ public:
+ using messages::SQLine::SQLine;
+
+ void Send(User *, XLine *) override;
+};
+
+class SQLineDel : public messages::SQLineDel
+{
+ public:
+ using messages::SQLineDel::SQLineDel;
+
+ void Send(XLine *) override;
+};
+
+class SZLine : public messages::SZLine
+{
+ public:
+ using messages::SZLine::SZLine;
+
+ void Send(User *, XLine *) override;
+};
+
+class SZLineDel : public messages::SZLineDel
+{
+ public:
+ using messages::SZLineDel::SZLineDel;
+
+ void Send(XLine *) override;
+};
+
+class SVSHold : public messages::SVSHold
+{
+ public:
+ using messages::SVSHold::SVSHold;
+
+ void Send(const Anope::string &, time_t) override;
+};
+
+class SVSHoldDel : public messages::SVSHoldDel
+{
+ public:
+ using messages::SVSHoldDel::SVSHoldDel;
- void SendServer(Server *server) override;
+ void Send(const Anope::string &) override;
+};
- void SendConnect() override;
+class SVSNick : public messages::SVSNick
+{
+ public:
+ using messages::SVSNick::SVSNick;
- void SendChannel(Channel *c) override;
+ void Send(User *u, const Anope::string &newnick, time_t ts) override;
+};
- void SendLogin(User *u, NickServ::Nick *) override;
+class Topic : public messages::Topic
+{
+ public:
+ using messages::Topic::Topic;
+
+ void Send(const MessageSource &source, Channel *channel, const Anope::string &topic, time_t topic_ts, const Anope::string &topic_setter) override;
+};
+
+class Wallops : public messages::Wallops
+{
+ public:
+ using messages::Wallops::Wallops;
+
+ void Send(const MessageSource &source, const Anope::string &msg) override;
+};
+
+} // namespace senders
+
+class Proto : public IRCDProto
+{
+ public:
+ Proto(Module *creator);
+
+ void SendBOB() override;
+
+ void SendEOB() override;
- void SendLogout(User *u) override;
+ void Handshake() override;
};
class Burst : public IRCDMessage
diff --git a/include/modules/protocol/charybdis.h b/include/modules/protocol/charybdis.h
index ee81a60a1..f3c06bfeb 100644
--- a/include/modules/protocol/charybdis.h
+++ b/include/modules/protocol/charybdis.h
@@ -19,53 +19,91 @@
#pragma once
+#include "modules/protocol/ts6.h"
+#include "modules/protocol/ratbox.h"
+
namespace charybdis
{
-class Proto : public IRCDProto
+namespace senders
{
- ServiceReference<IRCDProto> ratbox; // XXX
+class NickIntroduction : public messages::NickIntroduction
+{
public:
- Proto(Module *creator);
+ using messages::NickIntroduction::NickIntroduction;
- 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 Send(User *user) override;
+};
- void SendConnect() override;
+class SASL : public messages::SASL
+{
+ public:
+ using messages::SASL::SASL;
- void SendClientIntroduction(User *u) override;
+ void Send(const ::SASL::Message &) override;
+};
- void SendForceNickChange(User *u, const Anope::string &newnick, time_t when) override;
+class SASLMechanisms : public messages::SASLMechanisms
+{
+ public:
+ using messages::SASLMechanisms::SASLMechanisms;
- void SendSVSHold(const Anope::string &nick, time_t delay) override;
+ void Send(const std::vector<Anope::string> &mechanisms) override;
+};
- void SendSVSHoldDel(const Anope::string &nick) override;
+class SVSHold : public messages::SVSHold
+{
+ public:
+ using messages::SVSHold::SVSHold;
- void SendVhost(User *u, const Anope::string &ident, const Anope::string &host) override;
+ void Send(const Anope::string &, time_t) override;
+};
- void SendVhostDel(User *u) override;
+class SVSHoldDel : public messages::SVSHoldDel
+{
+ public:
+ using messages::SVSHoldDel::SVSHoldDel;
- void SendSASLMechanisms(std::vector<Anope::string> &mechanisms) override;
+ void Send(const Anope::string &) override;
+};
+
+class SVSLogin : public messages::SVSLogin
+{
+ public:
+ using messages::SVSLogin::SVSLogin;
+
+ void Send(const Anope::string &uid, const Anope::string &acc, const Anope::string &vident, const Anope::string &vhost) override;
+};
+
+class VhostDel : public messages::VhostDel
+{
+ public:
+ using messages::VhostDel::VhostDel;
+
+ void Send(User *u) override;
+};
+
+class VhostSet : public messages::VhostSet
+{
+ public:
+ using messages::VhostSet::VhostSet;
+
+ void Send(User *u, const Anope::string &vident, const Anope::string &vhost) override;
+};
+
+} // namespace senders
+
+class Proto : public ts6::Proto
+{
+ ratbox::Proto ratbox;
+
+ public:
+ Proto(Module *creator);
- void SendSASLMessage(const SASL::Message &message) override;
+ bool IsIdentValid(const Anope::string &ident) override { return ratbox.IsIdentValid(ident); }
- void SendSVSLogin(const Anope::string &uid, const Anope::string &acc, const Anope::string &vident, const Anope::string &vhost) override;
+ void Handshake() override;
};
class Encap : public IRCDMessage
diff --git a/include/modules/protocol/hybrid.h b/include/modules/protocol/hybrid.h
index a0a9143a8..7843859c0 100644
--- a/include/modules/protocol/hybrid.h
+++ b/include/modules/protocol/hybrid.h
@@ -20,74 +20,242 @@
#pragma once
#include "modules/protocol/rfc1459.h"
+#include "modules/protocol/ts6.h"
namespace hybrid
{
-class Proto : public IRCDProto
+namespace senders
{
- ServiceBot *FindIntroduced();
- void SendSVSKill(const MessageSource &source, User *u, const Anope::string &buf) override;
+class Akill : public messages::Akill
+{
+ public:
+ using messages::Akill::Akill;
- public:
- Proto(Module *creator);
+ void Send(User *, XLine *) override;
+};
- void SendInvite(const MessageSource &source, Channel *c, User *u) override;
+class AkillDel : public messages::AkillDel
+{
+ public:
+ using messages::AkillDel::AkillDel;
- void SendGlobalNotice(ServiceBot *bi, Server *dest, const Anope::string &msg) override;
+ void Send(XLine *) override;
+};
- void SendGlobalPrivmsg(ServiceBot *bi, Server *dest, const Anope::string &msg) override;
+class MessageChannel : public messages::MessageChannel
+{
+ public:
+ using messages::MessageChannel::MessageChannel;
- void SendSQLine(User *, XLine *x) override;
+ void Send(Channel *) override;
+};
- void SendSGLineDel(XLine *x) override;
+class GlobalNotice : public messages::GlobalNotice
+{
+ public:
+ using messages::GlobalNotice::GlobalNotice;
- void SendSGLine(User *, XLine *x) override;
+ void Send(const MessageSource &, Server *dest, const Anope::string &msg) override;
+};
- void SendSZLineDel(XLine *x) override;
+class GlobalPrivmsg : public messages::GlobalPrivmsg
+{
+ public:
+ using messages::GlobalPrivmsg::GlobalPrivmsg;
- void SendSZLine(User *, XLine *x) override;
+ void Send(const MessageSource &, Server *dest, const Anope::string &msg) override;
+};
- void SendAkillDel(XLine *x) override;
+class Invite : public messages::Invite
+{
+ public:
+ using messages::Invite::Invite;
- void SendSQLineDel(XLine *x) override;
+ void Send(const MessageSource &source, Channel *chan, User *user) override;
+};
- void SendJoin(User *u, Channel *c, const ChannelStatus *status) override;
+class Join : public messages::Join
+{
+ public:
+ using messages::Join::Join;
- void SendAkill(User *u, XLine *x) override;
+ void Send(User *u, Channel *c, const ChannelStatus *status) override;
+};
- void SendServer(Server *server) override;
+class Login : public messages::Login
+{
+ public:
+ using messages::Login::Login;
- void SendConnect() override;
+ void Send(User *u, NickServ::Nick *na) override;
+};
- void SendClientIntroduction(User *u) override;
+class Logout : public messages::Logout
+{
+ public:
+ using messages::Logout::Logout;
- void SendEOB() override;
+ void Send(User *u) override;
+};
+
+class ModeUser : public messages::ModeUser
+{
+ public:
+ using messages::ModeUser::ModeUser;
- void SendMode(const MessageSource &source, User *u, const Anope::string &buf) override;
+ void Send(const MessageSource &source, User *user, const Anope::string &modes) override;
+};
+
+class NickIntroduction : public messages::NickIntroduction
+{
+ public:
+ using messages::NickIntroduction::NickIntroduction;
+
+ void Send(User *user) override;
+};
+
+class MessageServer : public messages::MessageServer
+{
+ public:
+ using messages::MessageServer::MessageServer;
+
+ void Send(Server *server) override;
+};
- void SendLogin(User *u, NickServ::Nick *na) override;
+class SGLine : public messages::SGLine
+{
+ public:
+ using messages::SGLine::SGLine;
- void SendLogout(User *u) override;
+ void Send(User *, XLine *) override;
+};
- void SendChannel(Channel *c) override;
+class SGLineDel : public messages::SGLineDel
+{
+ public:
+ using messages::SGLineDel::SGLineDel;
- void SendTopic(const MessageSource &source, Channel *c) override;
+ void Send(XLine *) override;
+};
- void SendForceNickChange(User *u, const Anope::string &newnick, time_t when) override;
+class SQLine : public messages::SQLine
+{
+ public:
+ using messages::SQLine::SQLine;
- void SendSVSJoin(const MessageSource &source, User *u, const Anope::string &chan, const Anope::string &) override;
+ void Send(User *, XLine *) override;
+};
- void SendSVSPart(const MessageSource &source, User *u, const Anope::string &chan, const Anope::string &param) override;
+class SQLineDel : public messages::SQLineDel
+{
+ public:
+ using messages::SQLineDel::SQLineDel;
- void SendSVSHold(const Anope::string &nick, time_t t) override;
+ void Send(XLine *) override;
+};
- void SendSVSHoldDel(const Anope::string &nick) override;
+class SZLine : public messages::SZLine
+{
+ public:
+ using messages::SZLine::SZLine;
- void SendVhost(User *u, const Anope::string &ident, const Anope::string &host) override;
+ void Send(User *, XLine *) override;
+};
- void SendVhostDel(User *u) override;
+class SZLineDel : public messages::SZLineDel
+{
+ public:
+ using messages::SZLineDel::SZLineDel;
+
+ void Send(XLine *) override;
+};
+
+class SVSHold : public messages::SVSHold
+{
+ public:
+ using messages::SVSHold::SVSHold;
+
+ void Send(const Anope::string &, time_t) override;
+};
+
+class SVSHoldDel : public messages::SVSHoldDel
+{
+ public:
+ using messages::SVSHoldDel::SVSHoldDel;
+
+ void Send(const Anope::string &) override;
+};
+
+class SVSJoin : public messages::SVSJoin
+{
+ public:
+ using messages::SVSJoin::SVSJoin;
+
+ void Send(const MessageSource &source, User *u, const Anope::string &chan, const Anope::string &key) override;
+};
+
+class SVSNick : public messages::SVSNick
+{
+ public:
+ using messages::SVSNick::SVSNick;
+
+ void Send(User *u, const Anope::string &newnick, time_t ts) override;
+};
+
+class SVSPart : public messages::SVSPart
+{
+ public:
+ using messages::SVSPart::SVSPart;
+
+ void Send(const MessageSource &source, User *u, const Anope::string &chan, const Anope::string &reason) override;
+};
+
+class Topic : public messages::Topic
+{
+ public:
+ using messages::Topic::Topic;
+
+ void Send(const MessageSource &source, Channel *channel, const Anope::string &topic, time_t topic_ts, const Anope::string &topic_setter) override;
+};
+
+class VhostDel : public messages::VhostDel
+{
+ public:
+ using messages::VhostDel::VhostDel;
+
+ void Send(User *u) override;
+};
+
+class VhostSet : public messages::VhostSet
+{
+ public:
+ using messages::VhostSet::VhostSet;
+
+ void Send(User *u, const Anope::string &vident, const Anope::string &vhost) override;
+};
+
+class Wallops : public messages::Wallops
+{
+ public:
+ using messages::Wallops::Wallops;
+
+ void Send(const MessageSource &source, const Anope::string &msg) override;
+};
+
+} // namespace senders
+
+class Proto : public ts6::Proto
+{
+ ServiceBot *FindIntroduced();
+
+ public:
+ Proto(Module *creator);
+
+ void Handshake() override;
+
+ void SendEOB() override;
bool IsIdentValid(const Anope::string &ident) override;
};
diff --git a/include/modules/protocol/inspircd20.h b/include/modules/protocol/inspircd20.h
index f2126a931..391a0bc79 100644
--- a/include/modules/protocol/inspircd20.h
+++ b/include/modules/protocol/inspircd20.h
@@ -19,88 +19,270 @@
#pragma once
+#include "modules/protocol/ts6.h"
+
namespace inspircd20
{
-class Proto : public IRCDProto
+class Proto;
+
+namespace senders
{
- private:
- void SendSVSKill(const MessageSource &source, User *user, const Anope::string &buf) override;
- void SendChgIdentInternal(const Anope::string &nick, const Anope::string &vIdent);
+class Akill : public messages::Akill
+{
+ Proto *proto = nullptr;
- void SendChgHostInternal(const Anope::string &nick, const Anope::string &vhost);
+ public:
+ Akill(Module *creator, Proto *p) : messages::Akill(creator),
+ proto(p)
+ {
+ }
- void SendAddLine(const Anope::string &xtype, const Anope::string &mask, time_t duration, const Anope::string &addedby, const Anope::string &reason);
+ void Send(User *, XLine *) override;
+};
- void SendDelLine(const Anope::string &xtype, const Anope::string &mask);
+class AkillDel : public messages::AkillDel
+{
+ Proto *proto = nullptr;
public:
- Proto(Module *creator);
+ AkillDel(Module *creator, Proto *p) : messages::AkillDel(creator),
+ proto(p)
+ {
+ }
- void SendConnect() override;
+ void Send(XLine *) override;
+};
- void SendGlobalNotice(ServiceBot *bi, Server *dest, const Anope::string &msg) override;
+class MessageChannel : public messages::MessageChannel
+{
+ public:
+ using messages::MessageChannel::MessageChannel;
- void SendGlobalPrivmsg(ServiceBot *bi, Server *dest, const Anope::string &msg) override;
+ void Send(Channel *) override;
+};
- void SendAkillDel(XLine *x) override;
+class Join : public messages::Join
+{
+ public:
+ using messages::Join::Join;
- void SendTopic(const MessageSource &source, Channel *c) override;
+ void Send(User *u, Channel *c, const ChannelStatus *status) override;
+};
- void SendVhostDel(User *u) override;
+class Login : public messages::Login
+{
+ public:
+ using messages::Login::Login;
- void SendAkill(User *u, XLine *x) override;
+ void Send(User *u, NickServ::Nick *na) override;
+};
- void SendNumeric(int numeric, User *dest, IRCMessage &message);
+class Logout : public messages::Logout
+{
+ public:
+ using messages::Logout::Logout;
- void SendMode(const MessageSource &source, Channel *dest, const Anope::string &buf) override;
+ void Send(User *u) override;
+};
- void SendClientIntroduction(User *u) override;
+class ModeChannel : public messages::ModeChannel
+{
+ public:
+ using messages::ModeChannel::ModeChannel;
- void SendServer(Server *server) override;
+ void Send(const MessageSource &source, Channel *channel, const Anope::string &modes) override;
+};
- void SendSquit(Server *s, const Anope::string &message) override;
+class NickIntroduction : public messages::NickIntroduction
+{
+ public:
+ using messages::NickIntroduction::NickIntroduction;
- void SendJoin(User *user, Channel *c, const ChannelStatus *status) override;
+ void Send(User *user) override;
+};
- void SendSQLineDel(XLine *x) override;
+class MessageServer : public messages::MessageServer
+{
+ public:
+ using messages::MessageServer::MessageServer;
- void SendSQLine(User *, XLine *x) override;
+ void Send(Server *server) override;
+};
- void SendVhost(User *u, const Anope::string &vIdent, const Anope::string &vhost) override;
+class SASL : public messages::SASL
+{
+ public:
+ using messages::SASL::SASL;
- void SendSVSHold(const Anope::string &nick, time_t t) override;
+ void Send(const ::SASL::Message &) override;
+};
- void SendSVSHoldDel(const Anope::string &nick) override;
+class SASLMechanisms : public messages::SASLMechanisms
+{
+ public:
+ using messages::SASLMechanisms::SASLMechanisms;
- void SendSZLineDel(XLine *x) override;
+ void Send(const std::vector<Anope::string> &mechanisms) override;
+};
- void SendSZLine(User *, XLine *x) override;
+class SQLine : public messages::SQLine
+{
+ Proto *proto = nullptr;
- void SendSVSJoin(const MessageSource &source, User *u, const Anope::string &chan, const Anope::string &) override;
+ public:
+ SQLine(Module *creator, Proto *p) : messages::SQLine(creator),
+ proto(p)
+ {
+ }
- void SendSVSPart(const MessageSource &source, User *u, const Anope::string &chan, const Anope::string &param) override;
+ void Send(User *, XLine *) override;
+};
- void SendSWhois(const MessageSource &, const Anope::string &who, const Anope::string &mask) override;
+class SQLineDel : public messages::SQLineDel
+{
+ Proto *proto = nullptr;
- void SendBOB() override;
+ public:
+ SQLineDel(Module *creator, Proto *p) : messages::SQLineDel(creator),
+ proto(p)
+ {
+ }
- void SendEOB() override;
+ void Send(XLine *) override;
+};
+
+class SQuit : public messages::SQuit
+{
+ public:
+ using messages::SQuit::SQuit;
+
+ void Send(Server *s, const Anope::string &message) override;
+};
+
+class SZLine : public messages::SZLine
+{
+ Proto *proto = nullptr;
+
+ public:
+ SZLine(Module *creator, Proto *p) : messages::SZLine(creator),
+ proto(p)
+ {
+ }
+
+ void Send(User *, XLine *) override;
+};
+
+class SZLineDel : public messages::SZLineDel
+{
+ Proto *proto = nullptr;
+
+ public:
+ SZLineDel(Module *creator, Proto *p) : messages::SZLineDel(creator),
+ proto(p)
+ {
+ }
+
+ void Send(XLine *) override;
+};
+
+class SVSHold : public messages::SVSHold
+{
+ public:
+ using messages::SVSHold::SVSHold;
+
+ void Send(const Anope::string &, time_t) override;
+};
+
+class SVSHoldDel : public messages::SVSHoldDel
+{
+ public:
+ using messages::SVSHoldDel::SVSHoldDel;
- void SendGlobops(const MessageSource &source, const Anope::string &buf) override;
+ void Send(const Anope::string &) override;
+};
- void SendLogin(User *u, NickServ::Nick *na) override;
+class SVSLogin : public messages::SVSLogin
+{
+ public:
+ using messages::SVSLogin::SVSLogin;
- void SendLogout(User *u) override;
+ void Send(const Anope::string &uid, const Anope::string &acc, const Anope::string &vident, const Anope::string &vhost) override;
+};
- void SendChannel(Channel *c) override;
+class SWhois : public messages::SWhois
+{
+ public:
+ using messages::SWhois::SWhois;
- void SendSASLMechanisms(std::vector<Anope::string> &mechanisms) override;
+ void Send(const MessageSource &, User *user, const Anope::string &) override;
+};
- void SendSASLMessage(const SASL::Message &message) override;
+class Topic : public messages::Topic
+{
+ public:
+ using messages::Topic::Topic;
+
+ void Send(const MessageSource &source, Channel *channel, const Anope::string &topic, time_t topic_ts, const Anope::string &topic_setter) override;
+};
+
+class VhostDel : public messages::VhostDel
+{
+ Proto *proto = nullptr;
+
+ public:
+ VhostDel(Module *creator, Proto *p) : messages::VhostDel(creator),
+ proto(p)
+ {
+ }
- void SendSVSLogin(const Anope::string &uid, const Anope::string &acc, const Anope::string &vident, const Anope::string &vhost) override;
+ void Send(User *u) override;
+};
+
+class VhostSet : public messages::VhostSet
+{
+ Proto *proto = nullptr;
+
+ public:
+ VhostSet(Module *creator, Proto *p) : messages::VhostSet(creator),
+ proto(p)
+ {
+ }
+
+ void Send(User *u, const Anope::string &vident, const Anope::string &vhost) override;
+};
+
+class Wallops : public messages::Wallops
+{
+ public:
+ using messages::Wallops::Wallops;
+
+ void Send(const MessageSource &source, const Anope::string &msg) override;
+};
+
+} // namespace senders
+
+class Proto : public ts6::Proto
+{
+ public:
+ Proto(Module *creator);
+
+ 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);
+
+ void Handshake() override;
+
+ void SendNumeric(int numeric, User *dest, IRCMessage &message) override;
+
+ void SendBOB() override;
+
+ void SendEOB() override;
bool IsExtbanValid(const Anope::string &mask) override;
@@ -272,7 +454,7 @@ class ServerMessage : public IRCDMessage
class SQuit : public rfc1459::SQuit
{
public:
- SQuit(Module *creator) : rfc1459::SQuit(creator) { }
+ using rfc1459::SQuit::SQuit;
void Run(MessageSource &source, const std::vector<Anope::string> &params) override;
};
diff --git a/include/modules/protocol/ngircd.h b/include/modules/protocol/ngircd.h
index fef637aca..072dfb0f6 100644
--- a/include/modules/protocol/ngircd.h
+++ b/include/modules/protocol/ngircd.h
@@ -23,46 +23,89 @@
namespace ngircd
{
-class Proto : public IRCDProto
+namespace senders
{
- void SendSVSKill(const MessageSource &source, User *user, const Anope::string &buf) override;
+class Akill : public messages::Akill
+{
public:
- Proto(Module *creator);
+ using messages::Akill::Akill;
+
+ void Send(User *, XLine *) override;
+};
+
+class AkillDel : public messages::AkillDel
+{
+ public:
+ using messages::AkillDel::AkillDel;
+
+ void Send(XLine *) override;
+};
- void SendAkill(User *u, XLine *x) override;
+class MessageChannel : public messages::MessageChannel
+{
+ public:
+ using messages::MessageChannel::MessageChannel;
- void SendAkillDel(XLine *x) override;
+ void Send(Channel *) override;
+};
- void SendChannel(Channel *c) override;
+class NickIntroduction : public messages::NickIntroduction
+{
+ public:
+ using messages::NickIntroduction::NickIntroduction;
+
+ void Send(User *user) override;
+};
- // Received: :dev.anope.de NICK DukeP 1 ~DukePyro p57ABF9C9.dip.t-dialin.net 1 +i :DukePyrolator
- void SendClientIntroduction(User *u) override;
+class Login : public messages::Login
+{
+ public:
+ using messages::Login::Login;
- void SendConnect() override;
+ void Send(User *u, NickServ::Nick *na) override;
+};
- void SendForceNickChange(User *u, const Anope::string &newnick, time_t when) override;
+class Logout : public messages::Logout
+{
+ public:
+ using messages::Logout::Logout;
- void SendGlobalNotice(ServiceBot *bi, Server *dest, const Anope::string &msg) override;
+ void Send(User *u) override;
+};
- void SendGlobalPrivmsg(ServiceBot *bi, Server *dest, const Anope::string &msg) override;
+class SVSNick : public messages::SVSNick
+{
+ public:
+ using messages::SVSNick::SVSNick;
- void SendGlobops(const MessageSource &source, const Anope::string &buf) override;
+ void Send(User *u, const Anope::string &newnick, time_t ts) override;
+};
- void SendJoin(User *user, Channel *c, const ChannelStatus *status) override;
+class VhostDel : public messages::VhostDel
+{
+ public:
+ using messages::VhostDel::VhostDel;
- void SendLogin(User *u, NickServ::Nick *na) override;
+ void Send(User *u) override;
+};
- void SendLogout(User *u) override;
+class VhostSet : public messages::VhostSet
+{
+ public:
+ using messages::VhostSet::VhostSet;
- /* SERVER name hop descript */
- void SendServer(Server *server) override;
+ void Send(User *u, const Anope::string &vident, const Anope::string &vhost) override;
+};
- void SendTopic(const MessageSource &source, Channel *c) override;
+}
- void SendVhost(User *u, const Anope::string &vIdent, const Anope::string &vhost) override;
+class Proto : public IRCDProto
+{
+ public:
+ Proto(Module *creator);
- void SendVhostDel(User *u) override;
+ void Handshake() override;
Anope::string Format(IRCMessage &message) override;
};
@@ -72,7 +115,6 @@ class Numeric005 : public IRCDMessage
public:
Numeric005(Module *creator) : IRCDMessage(creator, "005", 1) { SetFlag(IRCDMESSAGE_SOFT_LIMIT); }
- // Please see <http://www.irc.org/tech_docs/005.html> for details.
void Run(MessageSource &source, const std::vector<Anope::string> &params) override;
};
@@ -168,4 +210,4 @@ class ServerMessage : public IRCDMessage
void Run(MessageSource &source, const std::vector<Anope::string> &params) override;
};
-} // namespace ngircd \ No newline at end of file
+} // namespace ngircd
diff --git a/include/modules/protocol/plexus.h b/include/modules/protocol/plexus.h
index 69be3d713..4afbc391e 100644
--- a/include/modules/protocol/plexus.h
+++ b/include/modules/protocol/plexus.h
@@ -19,55 +19,96 @@
#pragma once
+#include "modules/protocol/ts6.h"
+
namespace plexus
{
-class Proto : public IRCDProto
+namespace senders
{
- ServiceReference<IRCDProto> hybrid; // XXX use moddeps + inheritance here
+class ModeUser : public messages::ModeUser
+{
public:
- Proto(Module *creator);
+ using messages::ModeUser::ModeUser;
+
+ void Send(const MessageSource &source, User *user, const Anope::string &modes) override;
+};
+
+class NickIntroduction : public messages::NickIntroduction
+{
+ public:
+ using messages::NickIntroduction::NickIntroduction;
+
+ void Send(User *user) override;
+};
+
+class NOOP : public messages::NOOP
+{
+ public:
+ static constexpr const char *NAME = "noop";
+
+ using messages::NOOP::NOOP;
+
+ void Send(Server *s, bool mode) override;
+};
+
+class Topic : public messages::Topic
+{
+ public:
+ using messages::Topic::Topic;
- 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 Send(const MessageSource &source, Channel *channel, const Anope::string &topic, time_t topic_ts, const Anope::string &topic_setter) override;
+};
- void SendGlobops(const MessageSource &source, const Anope::string &buf) override;
+class SVSJoin : public messages::SVSJoin
+{
+ public:
+ using messages::SVSJoin::SVSJoin;
- void SendJoin(User *user, Channel *c, const ChannelStatus *status) override;
+ void Send(const MessageSource &source, User *u, const Anope::string &chan, const Anope::string &key) override;
+};
- void SendForceNickChange(User *u, const Anope::string &newnick, time_t when) override;
+class SVSNick : public messages::SVSNick
+{
+ public:
+ using messages::SVSNick::SVSNick;
- void SendVhost(User *u, const Anope::string &ident, const Anope::string &host) override;
+ void Send(User *u, const Anope::string &newnick, time_t ts) override;
+};
- void SendVhostDel(User *u) override;
+class SVSPart : public messages::SVSPart
+{
+ public:
+ using messages::SVSPart::SVSPart;
- void SendConnect() override;
+ void Send(const MessageSource &source, User *u, const Anope::string &chan, const Anope::string &reason) override;
+};
- void SendClientIntroduction(User *u) override;
+class VhostDel : public messages::VhostDel
+{
+ public:
+ using messages::VhostDel::VhostDel;
- void SendMode(const MessageSource &source, User *u, const Anope::string &buf) override;
+ void Send(User *u) override;
+};
- void SendLogin(User *u, NickServ::Nick *na) override;
+class VhostSet : public messages::VhostSet
+{
+ public:
+ using messages::VhostSet::VhostSet;
- void SendLogout(User *u) override;
+ void Send(User *u, const Anope::string &vident, const Anope::string &vhost) override;
+};
- void SendTopic(const MessageSource &source, Channel *c) override;
+} // namespace senders
- void SendSVSJoin(const MessageSource &source, User *user, const Anope::string &chan, const Anope::string &param) override;
+class Proto : public ts6::Proto
+{
+ public:
+ Proto(Module *creator);
- void SendSVSPart(const MessageSource &source, User *user, const Anope::string &chan, const Anope::string &param) override;
+ void Handshake() override;
};
class Encap : public IRCDMessage
diff --git a/include/modules/protocol/ratbox.h b/include/modules/protocol/ratbox.h
index ba7a7f19f..475b368cc 100644
--- a/include/modules/protocol/ratbox.h
+++ b/include/modules/protocol/ratbox.h
@@ -20,47 +20,92 @@
#pragma once
#include "modules/protocol/rfc1459.h"
+#include "modules/protocol/ts6.h"
namespace ratbox
{
-class Proto : public IRCDProto
+namespace senders
{
- ServiceReference<IRCDProto> hybrid; // XXX
- ServiceBot *FindIntroduced();
+class Login : public messages::Login
+{
+ public:
+ using messages::Login::Login;
+
+ void Send(User *u, NickServ::Nick *na) override;
+};
+class Logout : public messages::Logout
+{
public:
- Proto(Module *creator);
+ using messages::Logout::Logout;
+
+ void Send(User *u) override;
+};
+
+class NickIntroduction : public messages::NickIntroduction
+{
+ public:
+ using messages::NickIntroduction::NickIntroduction;
+
+ void Send(User *user) override;
+};
+
+class SQLine : public messages::SQLine
+{
+ public:
+ using messages::SQLine::SQLine;
+
+ void Send(User *, XLine *) override;
+};
+
+class SQLineDel : public messages::SQLineDel
+{
+ public:
+ using messages::SQLineDel::SQLineDel;
+
+ void Send(XLine *) override;
+};
+
+class SVSNick : public messages::SVSNick
+{
+ public:
+ using messages::SVSNick::SVSNick;
+
+ void Send(User *u, const Anope::string &newnick, time_t ts) override;
+};
+
+class Topic : public rfc1459::senders::Topic
+{
+ public:
+ using rfc1459::senders::Topic::Topic;
- 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 Send(const MessageSource &source, Channel *channel, const Anope::string &topic, time_t topic_ts, const Anope::string &topic_setter) override;
+};
- void SendGlobops(const MessageSource &source, const Anope::string &buf) override;
+class Wallops : public messages::Wallops
+{
+ public:
+ using messages::Wallops::Wallops;
- void SendConnect() override;
+ void Send(const MessageSource &source, const Anope::string &msg) override;
+};
- void SendClientIntroduction(User *u) override;
+} // senders
- void SendLogin(User *u, NickServ::Nick *na) override;
+class Proto : public ts6::Proto
+{
+ hybrid::Proto hybrid;
- void SendLogout(User *u) override;
+ ServiceBot *FindIntroduced();
- void SendTopic(const MessageSource &source, Channel *c) override;
+ public:
+ Proto(Module *creator);
- void SendSQLine(User *, XLine *x) override;
+ bool IsIdentValid(const Anope::string &ident) override { return hybrid.IsIdentValid(ident); }
- void SendSQLineDel(XLine *x) override;
+ void Handshake() override;
};
class Encap : public IRCDMessage
diff --git a/include/modules/protocol/rfc1459.h b/include/modules/protocol/rfc1459.h
index 4ef8f0313..54c4bada5 100644
--- a/include/modules/protocol/rfc1459.h
+++ b/include/modules/protocol/rfc1459.h
@@ -22,6 +22,165 @@
namespace rfc1459
{
+namespace senders
+{
+
+class GlobalNotice : public messages::GlobalNotice
+{
+ public:
+ using messages::GlobalNotice::GlobalNotice;
+
+ void Send(const MessageSource &, Server *dest, const Anope::string &msg) override;
+};
+
+class GlobalPrivmsg : public messages::GlobalPrivmsg
+{
+ public:
+ using messages::GlobalPrivmsg::GlobalPrivmsg;
+
+ void Send(const MessageSource &, Server *dest, const Anope::string &msg) override;
+};
+
+class Invite : public messages::Invite
+{
+ public:
+ using messages::Invite::Invite;
+
+ void Send(const MessageSource &source, Channel *chan, User *user) override;
+};
+
+class Join : public messages::Join
+{
+ public:
+ using messages::Join::Join;
+
+ void Send(User *u, Channel *c, const ChannelStatus *status) override;
+};
+
+class Kick : public messages::Kick
+{
+ public:
+ using messages::Kick::Kick;
+
+ void Send(const MessageSource &source, Channel *chan, User *user, const Anope::string &reason) override;
+};
+
+class Kill : public messages::Kill
+{
+ public:
+ using messages::Kill::Kill;
+
+ void Send(const MessageSource &source, const Anope::string &target, const Anope::string &reason) override;
+
+ void Send(const MessageSource &source, User *user, const Anope::string &reason) override;
+};
+
+class ModeChannel : public messages::ModeChannel
+{
+ public:
+ using messages::ModeChannel::ModeChannel;
+
+ void Send(const MessageSource &source, Channel *channel, const Anope::string &modes) override;
+};
+
+class ModeUser : public messages::ModeUser
+{
+ public:
+ using messages::ModeUser::ModeUser;
+
+ void Send(const MessageSource &source, User *user, const Anope::string &modes) override;
+};
+
+class NickChange : public messages::NickChange
+{
+ public:
+ using messages::NickChange::NickChange;
+
+ void Send(User *u, const Anope::string &newnick, time_t ts) override;
+};
+
+class Notice : public messages::Notice
+{
+ public:
+ using messages::Notice::Notice;
+
+ void Send(const MessageSource &source, const Anope::string &dest, const Anope::string &msg) override;
+};
+
+class Part : public messages::Part
+{
+ public:
+ using messages::Part::Part;
+
+ void Send(User *, Channel *chan, const Anope::string &reason) override;
+};
+
+class Ping : public messages::Ping
+{
+ public:
+ using messages::Ping::Ping;
+
+ void Send(const Anope::string &servname, const Anope::string &who) override;
+};
+
+class Pong : public messages::Pong
+{
+ public:
+ using messages::Pong::Pong;
+
+ void Send(const Anope::string &servname, const Anope::string &who) override;
+};
+
+class Privmsg : public messages::Privmsg
+{
+ public:
+ using messages::Privmsg::Privmsg;
+
+ void Send(const MessageSource &source, const Anope::string &dest, const Anope::string &msg) override;
+};
+
+class Quit : public messages::Quit
+{
+ public:
+ using messages::Quit::Quit;
+
+ void Send(User *user, const Anope::string &reason) override;
+};
+
+class MessageServer : public messages::MessageServer
+{
+ public:
+ using messages::MessageServer::MessageServer;
+
+ void Send(Server *server) override;
+};
+
+class SQuit : public messages::SQuit
+{
+ public:
+ using messages::SQuit::SQuit;
+
+ void Send(Server *s, const Anope::string &message) override;
+};
+
+class Topic : public messages::Topic
+{
+ public:
+ using messages::Topic::Topic;
+
+ void Send(const MessageSource &source, Channel *channel, const Anope::string &topic, time_t topic_ts, const Anope::string &topic_setter) override;
+};
+
+class Wallops : public messages::Wallops
+{
+ public:
+ using messages::Wallops::Wallops;
+
+ void Send(const MessageSource &, const Anope::string &msg) override;
+};
+
+} // namespace senders
+
class Away : public IRCDMessage
{
public:
diff --git a/include/modules/protocol/ts6.h b/include/modules/protocol/ts6.h
new file mode 100644
index 000000000..71748b5b7
--- /dev/null
+++ b/include/modules/protocol/ts6.h
@@ -0,0 +1,37 @@
+/*
+ * Anope IRC Services
+ *
+ * Copyright (C) 2016 Anope Team <team@anope.org>
+ *
+ * This file is part of Anope. Anope is free software; you can
+ * redistribute it and/or modify it under the terms of the GNU
+ * General Public License as published by the Free Software
+ * Foundation, version 2.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, see see <http://www.gnu.org/licenses/>.
+ */
+
+#pragma once
+
+namespace ts6
+{
+
+class Proto : public IRCDProto
+{
+ public:
+ Proto(Module *creator, const Anope::string &proto_name) : IRCDProto(creator, proto_name)
+ {
+ }
+
+ /* Retrieves the next free UID or SID */
+ Anope::string UID_Retrieve() override;
+ Anope::string SID_Retrieve() override;
+};
+
+} // namespace ts6
diff --git a/include/modules/protocol/unreal.h b/include/modules/protocol/unreal.h
index 0a01cb4be..9039cc2cd 100644
--- a/include/modules/protocol/unreal.h
+++ b/include/modules/protocol/unreal.h
@@ -22,79 +22,237 @@
namespace unreal
{
-class Proto : public IRCDProto
+namespace senders
+{
+
+class Akill : public messages::Akill
{
public:
- Proto(Module *creator);
+ using messages::Akill::Akill;
- private:
- void SendSVSNOOP(Server *server, bool set) override;
+ void Send(User *, XLine *) override;
+};
+
+class AkillDel : public messages::AkillDel
+{
+ public:
+ using messages::AkillDel::AkillDel;
+
+ void Send(XLine *) override;
+};
+
+class MessageChannel : public messages::MessageChannel
+{
+ public:
+ using messages::MessageChannel::MessageChannel;
+
+ void Send(Channel *) override;
+};
- void SendAkillDel(XLine *x) override;
+class Join : public messages::Join
+{
+ public:
+ using messages::Join::Join;
- void SendTopic(const MessageSource &source, Channel *c) override;
+ void Send(User *u, Channel *c, const ChannelStatus *status) override;
+};
- void SendGlobalNotice(ServiceBot *bi, Server *dest, const Anope::string &msg) override;
+class Login : public messages::Login
+{
+ public:
+ using messages::Login::Login;
- void SendGlobalPrivmsg(ServiceBot *bi, Server *dest, const Anope::string &msg) override;
+ void Send(User *u, NickServ::Nick *na) override;
+};
- void SendVhostDel(User *u) override;
+class Logout : public messages::Logout
+{
+ public:
+ using messages::Logout::Logout;
- void SendAkill(User *u, XLine *x) override;
+ void Send(User *u) override;
+};
- void SendSVSKill(const MessageSource &source, User *user, const Anope::string &buf) override;
+class Kill : public messages::Kill
+{
+ public:
+ using messages::Kill::Kill;
- void SendMode(const MessageSource &source, User *u, const Anope::string &buf) override;
+ void Send(const MessageSource &source, const Anope::string &target, const Anope::string &reason) override;
- void SendClientIntroduction(User *u) override;
+ void Send(const MessageSource &source, User *user, const Anope::string &reason) override;
+};
- void SendServer(Server *server) override;
+class ModeUser : public messages::ModeUser
+{
+ public:
+ using messages::ModeUser::ModeUser;
- void SendJoin(User *user, Channel *c, const ChannelStatus *status) override;
+ void Send(const MessageSource &source, User *user, const Anope::string &modes) override;
+};
- void SendSQLineDel(XLine *x) override;
+class NickIntroduction : public messages::NickIntroduction
+{
+ public:
+ using messages::NickIntroduction::NickIntroduction;
- void SendSQLine(User *, XLine *x) override;
+ void Send(User *user) override;
+};
- void SendVhost(User *u, const Anope::string &vIdent, const Anope::string &vhost) override;
+class SASL : public messages::SASL
+{
+ public:
+ using messages::SASL::SASL;
- void SendConnect() override;
+ void Send(const ::SASL::Message &) override;
+};
- void SendSVSHold(const Anope::string &nick, time_t t) override;
+class MessageServer : public messages::MessageServer
+{
+ public:
+ using messages::MessageServer::MessageServer;
- void SendSVSHoldDel(const Anope::string &nick) override;
+ void Send(Server *server) override;
+};
- void SendSGLineDel(XLine *x) override;
+class SGLine : public messages::SGLine
+{
+ public:
+ using messages::SGLine::SGLine;
- void SendSZLineDel(XLine *x) override;
+ void Send(User *, XLine *) override;
+};
- void SendSZLine(User *, XLine *x) override;
+class SGLineDel : public messages::SGLineDel
+{
+ public:
+ using messages::SGLineDel::SGLineDel;
- void SendSGLine(User *, XLine *x) override;
+ void Send(XLine *) override;
+};
- void SendSVSJoin(const MessageSource &source, User *user, const Anope::string &chan, const Anope::string &param) override;
+class SQLine : public messages::SQLine
+{
+ public:
+ using messages::SQLine::SQLine;
- void SendSVSPart(const MessageSource &source, User *user, const Anope::string &chan, const Anope::string &param) override;
+ void Send(User *, XLine *) override;
+};
- void SendSWhois(const MessageSource &source, const Anope::string &who, const Anope::string &mask) override;
+class SQLineDel : public messages::SQLineDel
+{
+ public:
+ using messages::SQLineDel::SQLineDel;
- void SendEOB() override;
+ void Send(XLine *) override;
+};
- bool IsNickValid(const Anope::string &nick) override;
+class SZLine : public messages::SZLine
+{
+ public:
+ using messages::SZLine::SZLine;
- bool IsChannelValid(const Anope::string &chan) override;
+ void Send(User *, XLine *) override;
+};
- bool IsExtbanValid(const Anope::string &mask) override;
+class SZLineDel : public messages::SZLineDel
+{
+ public:
+ using messages::SZLineDel::SZLineDel;
+
+ void Send(XLine *) override;
+};
+
+class SVSHold : public messages::SVSHold
+{
+ public:
+ using messages::SVSHold::SVSHold;
+
+ void Send(const Anope::string &, time_t) override;
+};
+
+class SVSHoldDel : public messages::SVSHoldDel
+{
+ public:
+ using messages::SVSHoldDel::SVSHoldDel;
+
+ void Send(const Anope::string &) override;
+};
+
+class SVSJoin : public messages::SVSJoin
+{
+ public:
+ using messages::SVSJoin::SVSJoin;
+
+ void Send(const MessageSource &source, User *u, const Anope::string &chan, const Anope::string &key) override;
+};
+
+class SVSLogin : public messages::SVSLogin
+{
+ public:
+ using messages::SVSLogin::SVSLogin;
+
+ void Send(const Anope::string &uid, const Anope::string &acc, const Anope::string &vident, const Anope::string &vhost) override;
+};
+
+class SVSPart : public messages::SVSPart
+{
+ public:
+ using messages::SVSPart::SVSPart;
+
+ void Send(const MessageSource &source, User *u, const Anope::string &chan, const Anope::string &reason) override;
+};
+
+class SWhois : public messages::SWhois
+{
+ public:
+ using messages::SWhois::SWhois;
+
+ void Send(const MessageSource &, User *user, const Anope::string &) override;
+};
+
+class Topic : public messages::Topic
+{
+ public:
+ using messages::Topic::Topic;
+
+ void Send(const MessageSource &source, Channel *channel, const Anope::string &topic, time_t topic_ts, const Anope::string &topic_setter) override;
+};
+
+class VhostDel : public messages::VhostDel
+{
+ public:
+ using messages::VhostDel::VhostDel;
+
+ void Send(User *u) override;
+};
+
+class VhostSet : public messages::VhostSet
+{
+ public:
+ using messages::VhostSet::VhostSet;
+
+ void Send(User *u, const Anope::string &vident, const Anope::string &vhost) override;
+};
- void SendLogin(User *u, NickServ::Nick *na) override;
+} // namespace senders
- void SendLogout(User *u) override;
+class Proto : public IRCDProto
+{
+ public:
+ Proto(Module *creator);
- void SendChannel(Channel *c) override;
+ private:
- void SendSASLMessage(const ::SASL::Message &message) override;
+ void Handshake() override;
- void SendSVSLogin(const Anope::string &uid, const Anope::string &acc, const Anope::string &vident, const Anope::string &vhost) 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;
bool IsIdentValid(const Anope::string &ident) override;
};
diff --git a/include/protocol.h b/include/protocol.h
index ee782903b..4dc115fe6 100644
--- a/include/protocol.h
+++ b/include/protocol.h
@@ -24,6 +24,7 @@
#include "service.h"
#include "servers.h"
#include "users.h"
+#include "messages.h"
class IRCMessage;
@@ -72,168 +73,26 @@ public:
virtual void Parse(const Anope::string &, Anope::string &, Anope::string &, std::vector<Anope::string> &);
virtual Anope::string Format(IRCMessage &);
- /** Kills a user
- * @param source Who is doing the kill
- * @param user The target to be killed
- * @param reason Kill reason
- */
- virtual void SendSVSKill(const MessageSource &source, User *user, const Anope::string &reason);
- virtual void SendMode(const MessageSource &, Channel *, const Anope::string &);
- virtual void SendMode(const MessageSource &, User *, const Anope::string &);
- virtual void SendKick(const MessageSource &, Channel *, User *, const Anope::string &);
- virtual void SendNotice(const MessageSource &, const Anope::string &dest, const Anope::string &msg);
- virtual void SendPrivmsg(const MessageSource &, const Anope::string &dest, const Anope::string &msg);
- virtual void SendQuit(User *, const Anope::string &reason);
- virtual void SendPart(User *, Channel *chan, const Anope::string &reason);
- virtual void SendGlobops(const MessageSource &, const Anope::string &buf);
virtual void SendCTCPReply(const MessageSource &, const Anope::string &dest, const Anope::string &buf);
virtual void SendNumeric(int numeric, User *dest, IRCMessage &);
/* Retrieves the next free UID or SID */
- virtual Anope::string UID_Retrieve();
- virtual Anope::string SID_Retrieve();
-
- /** Sets the server in NOOP mode. If NOOP mode is enabled, no users
- * will be able to oper on the server.
- * @param s The server
- * @param mode Whether to turn NOOP on or off
- */
- virtual void SendSVSNOOP(Server *s, bool mode) { }
-
- /** Sets the topic on a channel
- * @param bi The bot to set the topic from
- * @param c The channel to set the topic on. The topic being set is Channel::topic
- */
- virtual void SendTopic(const MessageSource &, Channel *);
-
- /** Sets a vhost on a user.
- * @param u The user
- * @param vident The ident to set
- * @param vhost The vhost to set
- */
- virtual void SendVhost(User *u, const Anope::string &vident, const Anope::string &vhost) { }
- virtual void SendVhostDel(User *) { }
-
- /** Sets an akill. This is a recursive function that can be called multiple times
- * for the same xline, but for different users, if the xline is not one that can be
- * enforced by the IRCd, such as a nick/user/host/realname combination ban.
- * @param u The user affected by the akill, if known
- * @param x The akill
- */
- virtual void SendAkill(User *, XLine *) anope_abstract;
- virtual void SendAkillDel(XLine *) anope_abstract;
-
- /* Realname ban */
- virtual void SendSGLine(User *, XLine *) { }
- virtual void SendSGLineDel(XLine *) { }
-
- /* IP ban */
- virtual void SendSZLine(User *u, XLine *) { }
- virtual void SendSZLineDel(XLine *) { }
-
- /* Nick ban (and sometimes channel) */
- virtual void SendSQLine(User *, XLine *x) { }
- virtual void SendSQLineDel(XLine *x) { }
-
- virtual void SendKill(const MessageSource &source, const Anope::string &target, const Anope::string &reason);
-
- /** Introduces a client to the rest of the network
- * @param u The client to introduce
- */
- virtual void SendClientIntroduction(User *u) anope_abstract;
+ virtual Anope::string UID_Retrieve() { return ""; }
+ virtual Anope::string SID_Retrieve() { return ""; }
virtual void SendAction(const MessageSource &source, const Anope::string &dest, const Anope::string &message);
- virtual void SendGlobalNotice(ServiceBot *bi, Server *dest, const Anope::string &msg) anope_abstract;
- virtual void SendGlobalPrivmsg(ServiceBot *bi, Server *desc, const Anope::string &msg) anope_abstract;
-
-
- virtual void SendPing(const Anope::string &servname, const Anope::string &who);
-
- /**
- * Send a PONG reply to a received PING.
- * servname should be left empty to send a one param reply.
- * @param servname Daemon or client that is responding to the PING.
- * @param who Origin of the PING and destination of the PONG message.
- **/
- virtual void SendPong(const Anope::string &servname, const Anope::string &who);
-
- /** Joins one of our users to a channel.
- * @param u The user to join
- * @param c The channel to join the user to
- * @param status The status to set on the user after joining. This may or may not already internally
- * be set on the user. This may include the modes in the join, but will usually place them on the mode
- * stacker to be set "soon".
- */
- virtual void SendJoin(User *u, Channel *c, const ChannelStatus *status) anope_abstract;
-
- /** Force joins a user that isn't ours to a channel.
- * @param bi The source of the message
- * @param u The user to join
- * @param chan The channel to join the user to
- * @param param Channel key?
- */
- virtual void SendSVSJoin(const MessageSource &source, User *u, const Anope::string &chan, const Anope::string &param) { }
-
- /** Force parts a user that isn't ours from a channel.
- * @param source The source of the message
- * @param u The user to part
- * @param chan The channel to part the user from
- * @param param part reason, some IRCds don't support this
- */
- virtual void SendSVSPart(const MessageSource &source, User *u, const Anope::string &chan, const Anope::string &param) { }
-
- virtual void SendInvite(const MessageSource &source, Channel *c, User *u);
-
-
- /** Sends a nick change of one of our clients.
- */
- virtual void SendNickChange(User *u, const Anope::string &newnick);
-
- /** Forces a nick change of a user that isn't ours (SVSNICK)
- */
- virtual void SendForceNickChange(User *u, const Anope::string &newnick, time_t when);
-
- /** Used to introduce ourselves to our uplink. Usually will SendServer(Me) and any other
- * initial handshake requirements.
+ /** Used to introduce ourselves to our uplink.
*/
- virtual void SendConnect() anope_abstract;
+ virtual void Handshake() anope_abstract;
- /** Called right before we begin our burst, after we have handshaked successfully with the uplink/
- * At this point none of our servesr, users, or channels exist on the uplink
+ /** Called right before we begin our burst, after we have handshaked successfully with the uplink.
+ * At this point none of our servers, users, or channels exist on the uplink
*/
virtual void SendBOB() { }
virtual void SendEOB() { }
- virtual void SendSVSHold(const Anope::string &, time_t) { }
- virtual void SendSVSHoldDel(const Anope::string &) { }
-
- virtual void SendSWhois(const MessageSource &, const Anope::string &, const Anope::string &) { }
-
- /** Introduces a server to the uplink
- */
- virtual void SendServer(Server *) anope_abstract;
- virtual void SendSquit(Server *, const Anope::string &message);
-
-
- virtual void SendLogin(User *u, NickServ::Nick *na) anope_abstract;
- virtual void SendLogout(User *u) anope_abstract;
-
- /** Send a channel creation message to the uplink.
- * On most TS6 IRCds this is a SJOIN with no nick
- */
- virtual void SendChannel(Channel *c) { }
-
- /** Make the user an IRC operator
- * Normally this is a simple +o, though some IRCds require us to send the oper type
- */
- virtual void SendOper(User *u);
-
- virtual void SendSASLMechanisms(std::vector<Anope::string> &) { }
- virtual void SendSASLMessage(const SASL::Message &) { }
- virtual void SendSVSLogin(const Anope::string &uid, const Anope::string &acc, const Anope::string &vident, const Anope::string &vhost) { }
-
virtual bool IsNickValid(const Anope::string &);
virtual bool IsChannelValid(const Anope::string &);
virtual bool IsIdentValid(const Anope::string &);
@@ -247,35 +106,48 @@ public:
virtual Anope::string NormalizeMask(const Anope::string &mask);
+ template<typename T, typename... Args> void Send(Args&&... args)
+ {
+ ServiceReference<MessageSender<T>> sender(T::NAME);
+
+ if (!sender)
+ {
+ Log(LOG_DEBUG) << "No message sender for type " << T::NAME;
+ return;
+ }
+
+ static_cast<T*>(static_cast<MessageSender<T>*>(sender))->Send(std::forward<Args>(args)...);
+ }
+
/* Templated functions which overload the normal functions to provide format strings */
- template<typename... Args> void SendSVSKill(const MessageSource &source, User *user, const Anope::string &reason, Args&&... args)
+ template<typename... Args> void SendKill(const MessageSource &source, User *user, const Anope::string &reason, Args&&... args)
{
- SendSVSKill(source, user, Anope::Format(reason, std::forward<Args>(args)...));
+ Send<messages::Kill>(source, user, Anope::Format(reason, std::forward<Args>(args)...));
}
template<typename... Args> void SendMode(const MessageSource &source, Channel *chan, const Anope::string &modes, Args&&... args)
{
- SendMode(source, chan, Anope::Format(modes, std::forward<Args>(args)...));
+ Send<messages::ModeChannel>(source, chan, Anope::Format(modes, std::forward<Args>(args)...));
}
template<typename... Args> void SendMode(const MessageSource &source, User *u, const Anope::string &modes, Args&&... args)
{
- SendMode(source, u, Anope::Format(modes, std::forward<Args>(args)...));
+ Send<messages::ModeUser>(source, u, Anope::Format(modes, std::forward<Args>(args)...));
}
- template<typename... Args> void SendKick(const MessageSource &source, const Channel *chan, User *user, const Anope::string &reason, Args&&... args)
+ template<typename... Args> void SendKick(const MessageSource &source, Channel *chan, User *user, const Anope::string &reason, Args&&... args)
{
- SendKick(source, chan, user, Anope::Format(reason, std::forward<Args>(args)...));
+ Send<messages::Kick>(source, chan, user, Anope::Format(reason, std::forward<Args>(args)...));
}
template<typename... Args> void SendNotice(const MessageSource &source, const Anope::string &dest, const Anope::string &message, Args&&... args)
{
- SendNotice(source, dest, Anope::Format(message, std::forward<Args>(args)...));
+ Send<messages::Notice>(source, dest, Anope::Format(message, std::forward<Args>(args)...));
}
template<typename... Args> void SendPrivmsg(const MessageSource &source, const Anope::string &dest, const Anope::string &message, Args&&... args)
{
- SendPrivmsg(source, dest, Anope::Format(message, std::forward<Args>(args)...));
+ Send<messages::Privmsg>(source, dest, Anope::Format(message, std::forward<Args>(args)...));
}
template<typename... Args> void SendAction(const MessageSource &source, const Anope::string &dest, const Anope::string &message, Args&&... args)
@@ -288,21 +160,21 @@ public:
SendCTCPReply(source, dest, Anope::Format(message, std::forward<Args>(args)...));
}
- template<typename... Args> void SendGlobops(const MessageSource &source, const Anope::string &msg, Args&&... args)
+ template<typename... Args> void SendWallops(const MessageSource &source, const Anope::string &msg, Args&&... args)
{
- SendGlobops(source, Anope::Format(msg, std::forward<Args>(args)...));
+ Send<messages::Wallops>(source, Anope::Format(msg, std::forward<Args>(args)...));
}
template<typename... Args> void SendNumeric(int numeric, User *dest, Args&&... args);
template<typename... Args> void SendQuit(User *u, const Anope::string &reason, Args&&... args)
{
- SendQuit(u, Anope::Format(reason, std::forward<Args>(args)...));
+ Send<messages::Quit>(u, Anope::Format(reason, std::forward<Args>(args)...));
}
template<typename... Args> void SendPart(User *u, Channel *chan, const Anope::string &reason, Args&&... args)
{
- SendPart(u, chan, Anope::Format(reason, std::forward<Args>(args)...));
+ Send<messages::Part>(u, chan, Anope::Format(reason, std::forward<Args>(args)...));
}
};
@@ -334,10 +206,10 @@ enum IRCDMessageFlag
class CoreExport IRCDMessage : public Service
{
Anope::string name;
- unsigned param_count;
+ unsigned int param_count;
std::set<IRCDMessageFlag> flags;
public:
- static constexpr const char *NAME = "IRCDMessage";
+ static constexpr const char *NAME = "ircdmessage";
IRCDMessage(Module *owner, const Anope::string &n, unsigned int p = 0);
unsigned int GetParamCount() const;