summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSadie Powell <sadie@witchery.services>2024-02-22 12:00:40 +0000
committerSadie Powell <sadie@witchery.services>2024-02-22 13:03:53 +0000
commit7423fa9998d7e7082cac63eda18ae785091ea1b0 (patch)
treeceda569b8b0148c7cbfca25c71e7e5a0a0d45710
parent7cba665270958b6e25add883df73df4976259e54 (diff)
Route message tags into more message functions.
-rw-r--r--include/bots.h3
-rw-r--r--include/modules.h9
-rw-r--r--include/protocol.h4
-rw-r--r--modules/botserv/bs_kick.cpp2
-rw-r--r--modules/chanserv/chanserv.cpp2
-rw-r--r--modules/chanstats.cpp2
-rw-r--r--modules/fantasy.cpp2
-rw-r--r--modules/irc2sql/irc2sql.cpp2
-rw-r--r--modules/irc2sql/irc2sql.h2
-rw-r--r--modules/operserv/operserv.cpp2
-rw-r--r--modules/operserv/os_ignore.cpp2
-rw-r--r--modules/xmlrpc_main.cpp2
-rw-r--r--src/bots.cpp2
-rw-r--r--src/messages.cpp8
-rw-r--r--src/protocol.cpp8
-rw-r--r--src/users.cpp4
16 files changed, 30 insertions, 26 deletions
diff --git a/include/bots.h b/include/bots.h
index 87a074058..8917621d6 100644
--- a/include/bots.h
+++ b/include/bots.h
@@ -108,8 +108,9 @@ public:
/** Called when a user messages this bot
* @param u The user
* @param message The users' message
+ * @params tags Message tags
*/
- virtual void OnMessage(User *u, const Anope::string &message);
+ virtual void OnMessage(User *u, const Anope::string &message, const Anope::map<Anope::string> &tags);
/** Link a command name to a command in services
* @param cname The command name
diff --git a/include/modules.h b/include/modules.h
index a50ef54a9..048e28f9f 100644
--- a/include/modules.h
+++ b/include/modules.h
@@ -964,23 +964,26 @@ public:
* @param u The user sending the PRIVMSG
* @param bi The target of the PRIVMSG
* @param message The message
+ * @param tags Message tags
* @return EVENT_STOP to halt processing
*/
- virtual EventReturn OnBotPrivmsg(User *u, BotInfo *bi, Anope::string &message) { throw NotImplementedException(); }
+ virtual EventReturn OnBotPrivmsg(User *u, BotInfo *bi, Anope::string &message, const Anope::map<Anope::string> &tags) { throw NotImplementedException(); }
/** Called when we receive a NOTICE for one of our clients
* @param u The user sending the NOTICE
* @param bi The target of the NOTICE
+ * @param tags Message tags
* @param message The message
*/
- virtual void OnBotNotice(User *u, BotInfo *bi, Anope::string &message) { throw NotImplementedException(); }
+ virtual void OnBotNotice(User *u, BotInfo *bi, Anope::string &message, const Anope::map<Anope::string> &tags) { throw NotImplementedException(); }
/** Called when we receive a PRIVMSG for a registered channel we are in
* @param u The source of the message
* @param c The channel
* @param msg The message
+ * @param tags Message tags
*/
- virtual void OnPrivmsg(User *u, Channel *c, Anope::string &msg) { throw NotImplementedException(); }
+ virtual void OnPrivmsg(User *u, Channel *c, Anope::string &msg, const Anope::map<Anope::string> &tags) { throw NotImplementedException(); }
/** Called when a message is logged
* @param l The log message
diff --git a/include/protocol.h b/include/protocol.h
index bb0577332..08924a092 100644
--- a/include/protocol.h
+++ b/include/protocol.h
@@ -32,8 +32,8 @@ public:
virtual void SendSVSKillInternal(const MessageSource &, User *, const Anope::string &);
virtual void SendKickInternal(const MessageSource &, const Channel *, User *, const Anope::string &);
- virtual void SendNoticeInternal(const MessageSource &, const Anope::string &dest, const Anope::string &msg);
- virtual void SendPrivmsgInternal(const MessageSource &, const Anope::string &dest, const Anope::string &buf);
+ virtual void SendNoticeInternal(const MessageSource &, const Anope::string &dest, const Anope::string &msg, const Anope::map<Anope::string> &tags = {});
+ virtual void SendPrivmsgInternal(const MessageSource &, const Anope::string &dest, const Anope::string &msg, const Anope::map<Anope::string> &tags = {});
virtual void SendQuitInternal(User *, const Anope::string &buf);
virtual void SendPartInternal(User *, const Channel *chan, const Anope::string &buf);
virtual void SendGlobopsInternal(const MessageSource &, const Anope::string &buf);
diff --git a/modules/botserv/bs_kick.cpp b/modules/botserv/bs_kick.cpp
index bdd1a4fff..fc8696410 100644
--- a/modules/botserv/bs_kick.cpp
+++ b/modules/botserv/bs_kick.cpp
@@ -1241,7 +1241,7 @@ public:
info.AddOption(_("Voices protection"));
}
- void OnPrivmsg(User *u, Channel *c, Anope::string &msg) override
+ void OnPrivmsg(User *u, Channel *c, Anope::string &msg, const Anope::map<Anope::string> &tags) override
{
/* Now we can make kicker stuff. We try to order the checks
* from the fastest one to the slowest one, since there's
diff --git a/modules/chanserv/chanserv.cpp b/modules/chanserv/chanserv.cpp
index d2667432c..3b1351c25 100644
--- a/modules/chanserv/chanserv.cpp
+++ b/modules/chanserv/chanserv.cpp
@@ -137,7 +137,7 @@ public:
ChanServ = NULL;
}
- EventReturn OnBotPrivmsg(User *u, BotInfo *bi, Anope::string &message) override
+ EventReturn OnBotPrivmsg(User *u, BotInfo *bi, Anope::string &message, const Anope::map<Anope::string> &tags) override
{
if (bi == ChanServ && Config->GetModule(this)->Get<bool>("opersonly") && !u->HasMode("OPER"))
{
diff --git a/modules/chanstats.cpp b/modules/chanstats.cpp
index db92689d7..06e457f21 100644
--- a/modules/chanstats.cpp
+++ b/modules/chanstats.cpp
@@ -581,7 +581,7 @@ public:
this->RunQuery(query);
}
- void OnPrivmsg(User *u, Channel *c, Anope::string &msg) override
+ void OnPrivmsg(User *u, Channel *c, Anope::string &msg, const Anope::map<Anope::string> &tags) override
{
if (!c->ci || !cs_stats.HasExt(c->ci))
return;
diff --git a/modules/fantasy.cpp b/modules/fantasy.cpp
index ead43152f..3930b0218 100644
--- a/modules/fantasy.cpp
+++ b/modules/fantasy.cpp
@@ -94,7 +94,7 @@ public:
{
}
- void OnPrivmsg(User *u, Channel *c, Anope::string &msg) override
+ void OnPrivmsg(User *u, Channel *c, Anope::string &msg, const Anope::map<Anope::string> &tags) override
{
if (!u || !c || !c->ci || !c->ci->bi || msg.empty() || msg[0] == '\1')
return;
diff --git a/modules/irc2sql/irc2sql.cpp b/modules/irc2sql/irc2sql.cpp
index ed83001c3..fdd80cdf9 100644
--- a/modules/irc2sql/irc2sql.cpp
+++ b/modules/irc2sql/irc2sql.cpp
@@ -297,7 +297,7 @@ void IRC2SQL::OnTopicUpdated(User *source, Channel *c, const Anope::string &user
this->RunQuery(query);
}
-void IRC2SQL::OnBotNotice(User *u, BotInfo *bi, Anope::string &message)
+void IRC2SQL::OnBotNotice(User *u, BotInfo *bi, Anope::string &message, const Anope::map<Anope::string> &tags)
{
Anope::string versionstr;
if (bi != StatServ)
diff --git a/modules/irc2sql/irc2sql.h b/modules/irc2sql/irc2sql.h
index e08f39a34..00c6f033b 100644
--- a/modules/irc2sql/irc2sql.h
+++ b/modules/irc2sql/irc2sql.h
@@ -84,5 +84,5 @@ public:
void OnTopicUpdated(User *source, Channel *c, const Anope::string &user, const Anope::string &topic) override;
- void OnBotNotice(User *u, BotInfo *bi, Anope::string &message) override;
+ void OnBotNotice(User *u, BotInfo *bi, Anope::string &message, const Anope::map<Anope::string> &tags) override;
};
diff --git a/modules/operserv/operserv.cpp b/modules/operserv/operserv.cpp
index 2bda06206..02866109c 100644
--- a/modules/operserv/operserv.cpp
+++ b/modules/operserv/operserv.cpp
@@ -227,7 +227,7 @@ public:
OperServ = bi;
}
- EventReturn OnBotPrivmsg(User *u, BotInfo *bi, Anope::string &message) override
+ EventReturn OnBotPrivmsg(User *u, BotInfo *bi, Anope::string &message, const Anope::map<Anope::string> &tags) override
{
if (bi == OperServ && !u->HasMode("OPER") && Config->GetModule(this)->Get<bool>("opersonly"))
{
diff --git a/modules/operserv/os_ignore.cpp b/modules/operserv/os_ignore.cpp
index 013d874b0..94cb807a1 100644
--- a/modules/operserv/os_ignore.cpp
+++ b/modules/operserv/os_ignore.cpp
@@ -409,7 +409,7 @@ public:
}
- EventReturn OnBotPrivmsg(User *u, BotInfo *bi, Anope::string &message) override
+ EventReturn OnBotPrivmsg(User *u, BotInfo *bi, Anope::string &message, const Anope::map<Anope::string> &tags) override
{
if (!u->HasMode("OPER") && this->osignoreservice.Find(u->nick))
return EVENT_STOP;
diff --git a/modules/xmlrpc_main.cpp b/modules/xmlrpc_main.cpp
index 23ea1fb0b..9ac8ad8d1 100644
--- a/modules/xmlrpc_main.cpp
+++ b/modules/xmlrpc_main.cpp
@@ -104,7 +104,7 @@ private:
XMLRPCommandReply(Anope::string &s) : str(s) { }
- void SendMessage(BotInfo *, const Anope::string &msg) override
+ void SendMessage(BotInfo *source, const Anope::string &msg) override
{
str += msg + "\n";
};
diff --git a/src/bots.cpp b/src/bots.cpp
index 9036250ed..f468ff59f 100644
--- a/src/bots.cpp
+++ b/src/bots.cpp
@@ -223,7 +223,7 @@ void BotInfo::Part(Channel *c, const Anope::string &reason)
FOREACH_MOD(OnPartChannel, (this, c, c->name, reason));
}
-void BotInfo::OnMessage(User *u, const Anope::string &message)
+void BotInfo::OnMessage(User *u, const Anope::string &message, const Anope::map<Anope::string> &tags)
{
if (this->commands.empty())
return;
diff --git a/src/messages.cpp b/src/messages.cpp
index 5e96fee0f..1d2d28a89 100644
--- a/src/messages.cpp
+++ b/src/messages.cpp
@@ -269,7 +269,7 @@ void Notice::Run(MessageSource &source, const std::vector<Anope::string> &params
BotInfo *bi = BotInfo::Find(params[0]);
if (!bi)
return;
- FOREACH_MOD(OnBotNotice, (u, bi, message));
+ FOREACH_MOD(OnBotNotice, (u, bi, message, tags));
}
}
@@ -312,7 +312,7 @@ void Privmsg::Run(MessageSource &source, const std::vector<Anope::string> &param
Channel *c = Channel::Find(receiver);
if (c)
{
- FOREACH_MOD(OnPrivmsg, (u, c, message));
+ FOREACH_MOD(OnPrivmsg, (u, c, message, tags));
}
}
else
@@ -362,11 +362,11 @@ void Privmsg::Run(MessageSource &source, const std::vector<Anope::string> &param
}
EventReturn MOD_RESULT;
- FOREACH_RESULT(OnBotPrivmsg, MOD_RESULT, (u, bi, message));
+ FOREACH_RESULT(OnBotPrivmsg, MOD_RESULT, (u, bi, message, tags));
if (MOD_RESULT == EVENT_STOP)
return;
- bi->OnMessage(u, message);
+ bi->OnMessage(u, message, tags);
}
}
diff --git a/src/protocol.cpp b/src/protocol.cpp
index cfa03d3d8..bf7d1bc28 100644
--- a/src/protocol.cpp
+++ b/src/protocol.cpp
@@ -117,14 +117,14 @@ void IRCDProto::SendKickInternal(const MessageSource &source, const Channel *c,
Uplink::Send(source, "KICK", c->name, u->GetUID());
}
-void IRCDProto::SendNoticeInternal(const MessageSource &source, const Anope::string &dest, const Anope::string &msg)
+void IRCDProto::SendNoticeInternal(const MessageSource &source, const Anope::string &dest, const Anope::string &msg, const Anope::map<Anope::string> &tags)
{
- Uplink::Send(source, "NOTICE", dest, msg);
+ Uplink::Send(tags, source, "NOTICE", dest, msg);
}
-void IRCDProto::SendPrivmsgInternal(const MessageSource &source, const Anope::string &dest, const Anope::string &buf)
+void IRCDProto::SendPrivmsgInternal(const MessageSource &source, const Anope::string &dest, const Anope::string &msg, const Anope::map<Anope::string> &tags)
{
- Uplink::Send(source, "PRIVMSG", dest, buf);
+ Uplink::Send(tags, source, "PRIVMSG", dest, msg);
}
void IRCDProto::SendQuitInternal(User *u, const Anope::string &buf)
diff --git a/src/users.cpp b/src/users.cpp
index fc509ee0a..452d84706 100644
--- a/src/users.cpp
+++ b/src/users.cpp
@@ -346,9 +346,9 @@ void User::SendMessage(BotInfo *source, const Anope::string &msg)
for (Anope::string tok; sep.GetToken(tok);)
{
if (send_privmsg)
- IRCD->SendPrivmsg(source, this->GetUID(), "%s", tok.c_str());
+ IRCD->SendPrivmsgInternal(source, this->GetUID(), tok);
else
- IRCD->SendNotice(source, this->GetUID(), "%s", tok.c_str());
+ IRCD->SendNoticeInternal(source, this->GetUID(), tok);
}
}