summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorSadie Powell <sadie@witchery.services>2024-06-24 14:29:55 +0100
committerSadie Powell <sadie@witchery.services>2024-06-24 14:29:55 +0100
commit693eeed762eac490b1289f8f4428ff0b5bbf1672 (patch)
tree974cbad287da04fc9e137d7f51092efd2e474acd /include
parent6e5713d64a379fc64c7ff6658362d02b3618c3ca (diff)
Rework how CTCP messages are sent and received.
Diffstat (limited to 'include')
-rw-r--r--include/anope.h14
-rw-r--r--include/protocol.h4
2 files changed, 14 insertions, 4 deletions
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<Anope::string> &tags = {});
virtual void SendPrivmsg(const MessageSource &source, const Anope::string &dest, const Anope::string &msg, const Anope::map<Anope::string> &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;