diff options
author | Sadie Powell <sadie@witchery.services> | 2024-06-24 14:46:41 +0100 |
---|---|---|
committer | Sadie Powell <sadie@witchery.services> | 2024-06-24 14:46:41 +0100 |
commit | 01e0cf4868a96e452712c06620c9307d34c89210 (patch) | |
tree | 2cca6d11e04c847aeac6ba7c099249ae1a3f4702 | |
parent | 693eeed762eac490b1289f8f4428ff0b5bbf1672 (diff) |
Add support for sending tag messages.
-rw-r--r-- | include/protocol.h | 4 | ||||
-rw-r--r-- | modules/protocol/inspircd.cpp | 10 | ||||
-rw-r--r-- | modules/protocol/unrealircd.cpp | 1 | ||||
-rw-r--r-- | src/protocol.cpp | 6 |
4 files changed, 21 insertions, 0 deletions
diff --git a/include/protocol.h b/include/protocol.h index 7f36a2917..6a7c8a07f 100644 --- a/include/protocol.h +++ b/include/protocol.h @@ -43,6 +43,7 @@ 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 SendTagmsg(const MessageSource &source, const Anope::string &dest, const Anope::map<Anope::string> &tags); /** Parses an incoming message from the IRC server. * @param message The message to parse. @@ -109,6 +110,9 @@ public: /** Can we ask the server to unban a user? */ bool CanClearBans = false; + /** Can we send tag messages? */ + bool CanTagMessage = false; + /* The maximum length of a channel name. */ size_t MaxChannel = 0; diff --git a/modules/protocol/inspircd.cpp b/modules/protocol/inspircd.cpp index e3cf294f4..0b0a60c8b 100644 --- a/modules/protocol/inspircd.cpp +++ b/modules/protocol/inspircd.cpp @@ -1147,6 +1147,7 @@ struct IRCDMessageCapab final IRCD->CanClearBans = false; IRCD->CanSQLineChannel = false; IRCD->CanSVSHold = false; + IRCD->CanTagMessage = false; IRCD->DefaultPseudoclientModes = "+oI"; } else if (params[0].equals_cs("CHANMODES") && params.size() > 1) @@ -1523,6 +1524,9 @@ struct IRCDMessageCapab final else if (modname.equals_cs("chgident")) Servers::Capab.insert("CHGIDENT"); + + else if (modname.equals_cs("ircv3_ctctags")) + IRCD->CanTagMessage = true; } const auto &anoperegex = Config->GetBlock("options")->Get<const Anope::string>("regexengine"); @@ -1583,6 +1587,9 @@ struct IRCDMessageCapab final if (!IRCD->CanSQLineChannel) Log() << "The remote server does not have the cban module; services will manually enforce forbidden channels until the module is loaded."; + if (!IRCD->CanTagMessage) + Log() << "The remote server does not have the ircv3_ctctags module; sending tag messages is disabled until the module is loaded."; + if (!Servers::Capab.count("CHGHOST")) Log() << "The remote server does not have the chghost module; vhosts are disabled until the module is loaded."; @@ -1954,6 +1961,9 @@ public: else if (modname.equals_cs("hidechans")) required = true; + else if (modname.equals_cs("ircv3_ctctags")) + IRCD->CanTagMessage = plus; + else if (modname.equals_cs("rline")) capab = "RLINE"; diff --git a/modules/protocol/unrealircd.cpp b/modules/protocol/unrealircd.cpp index 1c3f53270..aaae92b38 100644 --- a/modules/protocol/unrealircd.cpp +++ b/modules/protocol/unrealircd.cpp @@ -38,6 +38,7 @@ public: CanSVSHold = true; CanClearBans = true; CanCertFP = true; + CanTagMessage = true; RequiresID = true; MaxModes = 12; } diff --git a/src/protocol.cpp b/src/protocol.cpp index 1c5edd2a4..ad2bef770 100644 --- a/src/protocol.cpp +++ b/src/protocol.cpp @@ -145,6 +145,12 @@ void IRCDProto::SendPrivmsg(const MessageSource &source, const Anope::string &de Uplink::Send(tags, source, "PRIVMSG", dest, msg.empty() ? " " : msg); } +void IRCDProto::SendTagmsg(const MessageSource &source, const Anope::string &dest, const Anope::map<Anope::string> &tags) +{ + if (CanTagMessage) + Uplink::Send(tags, source, "TAGMSG", dest); +} + void IRCDProto::SendQuit(User *u, const Anope::string &buf) { if (!buf.empty()) |