summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--include/protocol.h6
-rw-r--r--modules/botserv/botserv.cpp3
-rw-r--r--modules/botserv/bs_control.cpp2
-rw-r--r--modules/chanserv/cs_log.cpp4
-rw-r--r--modules/greet.cpp3
-rw-r--r--modules/protocol/inspircd.cpp4
-rw-r--r--src/logger.cpp2
-rw-r--r--src/protocol.cpp32
-rw-r--r--src/users.cpp4
9 files changed, 20 insertions, 40 deletions
diff --git a/include/protocol.h b/include/protocol.h
index 97eb772b5..d69fa66fc 100644
--- a/include/protocol.h
+++ b/include/protocol.h
@@ -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);
diff --git a/modules/botserv/botserv.cpp b/modules/botserv/botserv.cpp
index 706865522..c9172ba0e 100644
--- a/modules/botserv/botserv.cpp
+++ b/modules/botserv/botserv.cpp
@@ -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();
diff --git a/modules/botserv/bs_control.cpp b/modules/botserv/bs_control.cpp
index 32101be6e..1784914b6 100644
--- a/modules/botserv/bs_control.cpp
+++ b/modules/botserv/bs_control.cpp
@@ -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");
diff --git a/modules/chanserv/cs_log.cpp b/modules/chanserv/cs_log.cpp
index 8c1004eeb..defd38287 100644
--- a/modules/chanserv/cs_log.cpp
+++ b/modules/chanserv/cs_log.cpp
@@ -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);
}
}
}
diff --git a/modules/greet.cpp b/modules/greet.cpp
index 1260b3a28..670ff37ba 100644
--- a/modules/greet.cpp
+++ b/modules/greet.cpp
@@ -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;
}
}
diff --git a/modules/protocol/inspircd.cpp b/modules/protocol/inspircd.cpp
index 3dd26931b..e3cf294f4 100644
--- a/modules/protocol/inspircd.cpp
+++ b/modules/protocol/inspircd.cpp
@@ -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;
diff --git a/src/logger.cpp b/src/logger.cpp
index 6290831be..677258009 100644
--- a/src/logger.cpp
+++ b/src/logger.cpp
@@ -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")
diff --git a/src/protocol.cpp b/src/protocol.cpp
index c1685eb27..275721634 100644
--- a/src/protocol.cpp
+++ b/src/protocol.cpp
@@ -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 },
});
}
diff --git a/src/users.cpp b/src/users.cpp
index 9462881f1..9b370ea06 100644
--- a/src/users.cpp
+++ b/src/users.cpp
@@ -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);
}
}
}