1
0
mirror of https://github.com/anope/anope.git synced 2026-06-12 19:14:47 +02:00

Route message tags into more message functions.

This commit is contained in:
Sadie Powell
2024-02-22 12:00:40 +00:00
parent 7cba665270
commit 7423fa9998
16 changed files with 30 additions and 26 deletions
+2 -1
View File
@@ -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
+6 -3
View File
@@ -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
+2 -2
View File
@@ -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);
+1 -1
View File
@@ -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
+1 -1
View File
@@ -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"))
{
+1 -1
View File
@@ -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;
+1 -1
View File
@@ -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;
+1 -1
View File
@@ -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)
+1 -1
View File
@@ -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;
};
+1 -1
View File
@@ -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"))
{
+1 -1
View File
@@ -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;
+1 -1
View File
@@ -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";
};
+1 -1
View File
@@ -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;
+4 -4
View File
@@ -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);
}
}
+4 -4
View File
@@ -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)
+2 -2
View File
@@ -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);
}
}