diff options
author | Adam <Adam@anope.org> | 2016-12-17 21:44:22 -0500 |
---|---|---|
committer | Adam <Adam@anope.org> | 2016-12-17 21:44:22 -0500 |
commit | 4fcbbbe4fbc137841b47c8e2372477b85649270a (patch) | |
tree | f2a5fd3b5a77ef0384df6e2712fdd74f832d7dfe /include/modules/protocol/plexus.h | |
parent | ed08d1a31119adb379f8bec46d7ad47ee35c4c92 (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/modules/protocol/plexus.h')
-rw-r--r-- | include/modules/protocol/plexus.h | 99 |
1 files changed, 70 insertions, 29 deletions
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 ¶m) override; +class Proto : public ts6::Proto +{ + public: + Proto(Module *creator); - void SendSVSPart(const MessageSource &source, User *user, const Anope::string &chan, const Anope::string ¶m) override; + void Handshake() override; }; class Encap : public IRCDMessage |