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

Remove the formatting overloads of SendNotice/SendPrivmsg.

This commit is contained in:
Sadie Powell
2024-06-24 13:29:41 +01:00
parent 249ad3dfea
commit 6e5713d64a
9 changed files with 20 additions and 40 deletions
+2 -4
View File
@@ -41,8 +41,8 @@ public:
virtual ~IRCDProto();
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 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.
@@ -213,8 +213,6 @@ public:
virtual void SendKick(const MessageSource &source, const Channel *chan, User *user, const Anope::string &msg);
virtual void SendNotice(const MessageSource &source, const Anope::string &dest, const char *fmt, ...) ATTR_FORMAT(4, 5);
virtual void SendPrivmsg(const MessageSource &source, const Anope::string &dest, const char *fmt, ...) ATTR_FORMAT(4, 5);
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);
+2 -1
View File
@@ -75,7 +75,8 @@ public:
{
ChannelMode *cm = ModeManager::FindChannelModeByName("OP");
char symbol = cm ? anope_dynamic_static_cast<ChannelModeStatus *>(cm)->symbol : 0;
IRCD->SendNotice(bi, (symbol ? Anope::string(symbol) : "") + c->name, "%s invited %s into the channel.", user->nick.c_str(), user->nick.c_str());
const auto message = Anope::printf("%s invited %s into the channel.", user->nick.c_str(), user->nick.c_str());
IRCD->SendNotice(bi, (symbol ? Anope::string(symbol) : "") + c->name, message);
}
ModeManager::ProcessModes();
+1 -1
View File
@@ -56,7 +56,7 @@ public:
return;
}
IRCD->SendPrivmsg(*ci->bi, ci->name, "%s", text.c_str());
IRCD->SendPrivmsg(*ci->bi, ci->name, text);
ci->bi->lastmsg = Anope::CurTime;
bool override = !source.AccessFor(ci).HasPriv("SAY");
+2 -2
View File
@@ -391,11 +391,11 @@ public:
/* Sending a channel message or notice in response to a fantasy command */;
else if (log->method.equals_ci("MESSAGE") && l->ci->c)
{
IRCD->SendPrivmsg(l->ci->WhoSends(), log->extra + l->ci->c->name, "%s", buffer.c_str());
IRCD->SendPrivmsg(l->ci->WhoSends(), log->extra + l->ci->c->name, buffer);
l->ci->WhoSends()->lastmsg = Anope::CurTime;
}
else if (log->method.equals_ci("NOTICE") && l->ci->c)
IRCD->SendNotice(l->ci->WhoSends(), log->extra + l->ci->c->name, "%s", buffer.c_str());
IRCD->SendNotice(l->ci->WhoSends(), log->extra + l->ci->c->name, buffer);
}
}
}
+2 -1
View File
@@ -198,7 +198,8 @@ public:
Anope::string *greet = ns_greet.Get(user->Account());
if (bs_greet.HasExt(c->ci) && greet != NULL && !greet->empty() && c->FindUser(c->ci->bi) && c->ci->AccessFor(user).HasPriv("GREET"))
{
IRCD->SendPrivmsg(*c->ci->bi, c->name, "[%s] %s", user->Account()->display.c_str(), greet->c_str());
const auto message = Anope::printf("[%s] %s", user->Account()->display.c_str(), greet->c_str());
IRCD->SendPrivmsg(*c->ci->bi, c->name, message);
c->ci->bi->lastmsg = Anope::CurTime;
}
}
+2 -2
View File
@@ -207,7 +207,7 @@ public:
{
if (spanningtree_proto_ver >= 1206)
{
IRCD->SendNoticeInternal(bi, target->GetUID(), msg, {
IRCD->SendNotice(bi, target->GetUID(), msg, {
{ "~context", context->name },
});
return;
@@ -219,7 +219,7 @@ public:
{
if (spanningtree_proto_ver >= 1206)
{
IRCD->SendPrivmsgInternal(bi, target->GetUID(), msg, {
IRCD->SendPrivmsg(bi, target->GetUID(), msg, {
{ "~context", context->name },
});
return;
+1 -1
View File
@@ -364,7 +364,7 @@ void LogInfo::ProcessMessage(const Log *l)
if (!bi)
bi = c->WhoSends();
if (bi)
IRCD->SendPrivmsg(bi, c->name, "%s", buffer.c_str());
IRCD->SendPrivmsg(bi, c->name, buffer);
}
}
else if (target == "globops")
+6 -26
View File
@@ -135,12 +135,12 @@ void IRCDProto::SendKick(const MessageSource &source, const Channel *c, User *u,
Uplink::Send(source, "KICK", c->name, u->GetUID());
}
void IRCDProto::SendNoticeInternal(const MessageSource &source, const Anope::string &dest, const Anope::string &msg, const Anope::map<Anope::string> &tags)
void IRCDProto::SendNotice(const MessageSource &source, const Anope::string &dest, const Anope::string &msg, const Anope::map<Anope::string> &tags)
{
Uplink::Send(tags, source, "NOTICE", dest, msg.empty() ? " " : msg);
}
void IRCDProto::SendPrivmsgInternal(const MessageSource &source, const Anope::string &dest, const Anope::string &msg, const Anope::map<Anope::string> &tags)
void IRCDProto::SendPrivmsg(const MessageSource &source, const Anope::string &dest, const Anope::string &msg, const Anope::map<Anope::string> &tags)
{
Uplink::Send(tags, source, "PRIVMSG", dest, msg.empty() ? " " : msg);
}
@@ -169,7 +169,7 @@ void IRCDProto::SendGlobops(const MessageSource &source, const Anope::string &me
void IRCDProto::SendCTCPInternal(const MessageSource &source, const Anope::string &dest, const Anope::string &buf)
{
Anope::string s = Anope::NormalizeBuffer(buf);
this->SendNoticeInternal(source, dest, "\1" + s + "\1");
this->SendNotice(source, dest, "\1" + s + "\1");
}
void IRCDProto::SendNumericInternal(int numeric, const Anope::string &dest, const std::vector<Anope::string> &params)
@@ -190,16 +190,6 @@ void IRCDProto::SendTopic(const MessageSource &source, Channel *c)
Uplink::Send(source, "TOPIC", c->name, c->topic);
}
void IRCDProto::SendNotice(const MessageSource &source, const Anope::string &dest, const char *fmt, ...)
{
va_list args;
char buf[BUFSIZE] = "";
va_start(args, fmt);
vsnprintf(buf, BUFSIZE - 1, fmt, args);
va_end(args);
SendNoticeInternal(source, dest, buf);
}
void IRCDProto::SendAction(const MessageSource &source, const Anope::string &dest, const char *fmt, ...)
{
va_list args;
@@ -208,17 +198,7 @@ void IRCDProto::SendAction(const MessageSource &source, const Anope::string &des
vsnprintf(buf, BUFSIZE - 1, fmt, args);
va_end(args);
Anope::string actionbuf = Anope::string("\1ACTION ") + buf + '\1';
SendPrivmsgInternal(source, dest, actionbuf);
}
void IRCDProto::SendPrivmsg(const MessageSource &source, const Anope::string &dest, const char *fmt, ...)
{
va_list args;
char buf[BUFSIZE] = "";
va_start(args, fmt);
vsnprintf(buf, BUFSIZE - 1, fmt, args);
va_end(args);
SendPrivmsgInternal(source, dest, buf);
SendPrivmsg(source, dest, actionbuf);
}
void IRCDProto::SendPing(const Anope::string &servname, const Anope::string &who)
@@ -370,14 +350,14 @@ Anope::string IRCDProto::NormalizeMask(const Anope::string &mask)
void IRCDProto::SendContextNotice(BotInfo *bi, User *target, Channel *context, const Anope::string &msg)
{
IRCD->SendNoticeInternal(bi, target->GetUID(), Anope::printf("[%s] %s", context->name.c_str(), msg.c_str()), {
IRCD->SendNotice(bi, target->GetUID(), Anope::printf("[%s] %s", context->name.c_str(), msg.c_str()), {
{ "+draft/channel-context", context->name },
});
}
void IRCDProto::SendContextPrivmsg(BotInfo *bi, User *target, Channel *context, const Anope::string &msg)
{
IRCD->SendPrivmsgInternal(bi, target->GetUID(), Anope::printf("[%s] %s", context->name.c_str(), msg.c_str()), {
IRCD->SendPrivmsg(bi, target->GetUID(), Anope::printf("[%s] %s", context->name.c_str(), msg.c_str()), {
{ "+draft/channel-context", context->name },
});
}
+2 -2
View File
@@ -337,9 +337,9 @@ namespace
for (Anope::string tok; sep.GetToken(tok);)
{
if (target->ShouldPrivmsg())
IRCD->SendPrivmsgInternal(source, target->GetUID(), tok, tags);
IRCD->SendPrivmsg(source, target->GetUID(), tok, tags);
else
IRCD->SendNoticeInternal(source, target->GetUID(), tok, tags);
IRCD->SendNotice(source, target->GetUID(), tok, tags);
}
}
}