From 693eeed762eac490b1289f8f4428ff0b5bbf1672 Mon Sep 17 00:00:00 2001 From: Sadie Powell Date: Mon, 24 Jun 2024 14:29:55 +0100 Subject: Rework how CTCP messages are sent and received. --- include/anope.h | 14 ++++++++++++++ include/protocol.h | 4 ---- 2 files changed, 14 insertions(+), 4 deletions(-) (limited to 'include') diff --git a/include/anope.h b/include/anope.h index 8d58acdce..b66a211b3 100644 --- a/include/anope.h +++ b/include/anope.h @@ -601,6 +601,20 @@ namespace Anope /** Expands a module path. */ inline auto ExpandModule(const Anope::string &path) { return Expand(ModuleDir, path); } + /** Formats a CTCP message for sending to a client. + * @param name The name of the CTCP. + * @param body If present then the body of the CTCP. + * @return A formatted CTCP ready to send to a client. + */ + extern CoreExport Anope::string FormatCTCP(const Anope::string &name, const Anope::string &body = ""); + + /** Parses a CTCP message received from a client. + * @param text The raw message to parse. + * @param name The location to store the name of the CTCP. + * @param body The location to store body of the CTCP if one is present. + * @return True if the message was a well formed CTCP; otherwise, false. + */ + extern CoreExport bool ParseCTCP(const Anope::string &text, Anope::string &name, Anope::string &body); } /** sepstream allows for splitting token separated lists. diff --git a/include/protocol.h b/include/protocol.h index d69fa66fc..7f36a2917 100644 --- a/include/protocol.h +++ b/include/protocol.h @@ -43,7 +43,6 @@ public: virtual void SendNotice(const MessageSource &source, const Anope::string &dest, const Anope::string &msg, const Anope::map &tags = {}); virtual void SendPrivmsg(const MessageSource &source, const Anope::string &dest, const Anope::string &msg, const Anope::map &tags = {}); - virtual void SendCTCPInternal(const MessageSource &, const Anope::string &dest, const Anope::string &buf); /** Parses an incoming message from the IRC server. * @param message The message to parse. @@ -213,9 +212,6 @@ public: virtual void SendKick(const MessageSource &source, const Channel *chan, User *user, const Anope::string &msg); - virtual void SendAction(const MessageSource &source, const Anope::string &dest, const char *fmt, ...) ATTR_FORMAT(4, 5); - virtual void SendCTCP(const MessageSource &source, const Anope::string &dest, const char *fmt, ...) ATTR_FORMAT(4, 5); - virtual void SendGlobalNotice(BotInfo *bi, const Server *dest, const Anope::string &msg) = 0; virtual void SendGlobalPrivmsg(BotInfo *bi, const Server *desc, const Anope::string &msg) = 0; -- cgit