summaryrefslogtreecommitdiff
path: root/src/users.cpp
diff options
context:
space:
mode:
authorSadie Powell <sadie@witchery.services>2024-02-22 13:23:18 +0000
committerSadie Powell <sadie@witchery.services>2024-02-22 13:23:18 +0000
commita75afb597b8b4f7e342c393bc3dea868e66f9b4c (patch)
tree78de3197b88e9811867b93258e3dc402aff3a0b5 /src/users.cpp
parentf93d9e76983e15bd1642c31d6acf430754f0600a (diff)
Add the IRCv3 reply tag to messages sent as responses to a user.
Diffstat (limited to 'src/users.cpp')
-rw-r--r--src/users.cpp24
1 files changed, 24 insertions, 0 deletions
diff --git a/src/users.cpp b/src/users.cpp
index 452d84706..84a5173a4 100644
--- a/src/users.cpp
+++ b/src/users.cpp
@@ -352,6 +352,30 @@ void User::SendMessage(BotInfo *source, const Anope::string &msg)
}
}
+void User::SendMessage(CommandSource& source, const Anope::string &msg)
+{
+ Anope::map<Anope::string> tags;
+ if (!source.msgid.empty())
+ tags["+draft/reply"] = source.msgid;
+
+ const char *translated_message = Language::Translate(this, msg.c_str());
+
+ /* Send privmsg instead of notice if:
+ * - UsePrivmsg is enabled
+ * - The user is not registered and NSDefMsg is enabled
+ * - The user is registered and has set /ns set msg on
+ */
+ bool send_privmsg = Config->UsePrivmsg && ((!this->nc && Config->DefPrivmsg) || (this->nc && this->nc->HasExt("MSG")));
+ sepstream sep(translated_message, '\n', true);
+ for (Anope::string tok; sep.GetToken(tok);)
+ {
+ if (send_privmsg)
+ IRCD->SendPrivmsgInternal(*source.service, this->GetUID(), tok, tags);
+ else
+ IRCD->SendNoticeInternal(*source.service, this->GetUID(), tok, tags);
+ }
+}
+
void User::Identify(NickAlias *na)
{
if (this->nick.equals_ci(na->nick))