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/ratbox.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/ratbox.h')
-rw-r--r-- | include/modules/protocol/ratbox.h | 93 |
1 files changed, 69 insertions, 24 deletions
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 |