diff options
author | Sadie Powell <sadie@witchery.services> | 2024-02-26 16:33:48 +0000 |
---|---|---|
committer | Sadie Powell <sadie@witchery.services> | 2024-02-26 16:45:28 +0000 |
commit | 6be4df3b395bd11ee1d936f6f1c9b63553441d38 (patch) | |
tree | ff004a247f7f77d719ba775ed6e4f7e3de5e6798 /src | |
parent | 4789751e5002a0667ca9080bcb461b0817db31b2 (diff) |
Remove several string format IRCDProto function overloads.
Diffstat (limited to 'src')
-rw-r--r-- | src/bots.cpp | 2 | ||||
-rw-r--r-- | src/channels.cpp | 2 | ||||
-rw-r--r-- | src/logger.cpp | 2 | ||||
-rw-r--r-- | src/protocol.cpp | 71 | ||||
-rw-r--r-- | src/users.cpp | 4 |
5 files changed, 10 insertions, 71 deletions
diff --git a/src/bots.cpp b/src/bots.cpp index ecccafe16..32b0546e6 100644 --- a/src/bots.cpp +++ b/src/bots.cpp @@ -216,7 +216,7 @@ void BotInfo::Part(Channel *c, const Anope::string &reason) FOREACH_MOD(OnPrePartChannel, (this, c)); - IRCD->SendPart(this, c, "%s", !reason.empty() ? reason.c_str() : ""); + IRCD->SendPart(this, c, reason); c->DeleteUser(this); diff --git a/src/channels.cpp b/src/channels.cpp index 8a3248183..babe5c69c 100644 --- a/src/channels.cpp +++ b/src/channels.cpp @@ -799,7 +799,7 @@ bool Channel::Kick(BotInfo *bi, User *u, const Anope::string &reason) FOREACH_RESULT(OnBotKick, MOD_RESULT, (bi, this, u, reason)); if (MOD_RESULT == EVENT_STOP) return false; - IRCD->SendKick(bi, this, u, "%s", reason.c_str()); + IRCD->SendKick(bi, this, u, reason); this->KickInternal(bi, u->nick, reason); return true; } diff --git a/src/logger.cpp b/src/logger.cpp index ebd14c0eb..1b8fe04f4 100644 --- a/src/logger.cpp +++ b/src/logger.cpp @@ -380,7 +380,7 @@ void LogInfo::ProcessMessage(const Log *l) if (!bi) bi = this->bot; if (bi) - IRCD->SendGlobops(bi, "%s", buffer.c_str()); + IRCD->SendGlobops(bi, buffer); } } } diff --git a/src/protocol.cpp b/src/protocol.cpp index 920e0662b..091157d8e 100644 --- a/src/protocol.cpp +++ b/src/protocol.cpp @@ -90,7 +90,7 @@ void IRCDProto::SendKill(const MessageSource &source, const Anope::string &targe Uplink::Send(source, "KILL", target, reason); } -void IRCDProto::SendSVSKillInternal(const MessageSource &source, User *user, const Anope::string &buf) +void IRCDProto::SendSVSKill(const MessageSource &source, User *user, const Anope::string &buf) { Uplink::Send(source, "KILL", user->GetUID(), buf); } @@ -109,7 +109,7 @@ void IRCDProto::SendModeInternal(const MessageSource &source, User *dest, const Uplink::SendInternal({}, source, "MODE", params); } -void IRCDProto::SendKickInternal(const MessageSource &source, const Channel *c, User *u, const Anope::string &r) +void IRCDProto::SendKick(const MessageSource &source, const Channel *c, User *u, const Anope::string &r) { if (!r.empty()) Uplink::Send(source, "KICK", c->name, u->GetUID(), r); @@ -127,7 +127,7 @@ void IRCDProto::SendPrivmsgInternal(const MessageSource &source, const Anope::st Uplink::Send(tags, source, "PRIVMSG", dest, msg); } -void IRCDProto::SendQuitInternal(User *u, const Anope::string &buf) +void IRCDProto::SendQuit(User *u, const Anope::string &buf) { if (!buf.empty()) Uplink::Send(u, "QUIT", buf); @@ -135,7 +135,7 @@ void IRCDProto::SendQuitInternal(User *u, const Anope::string &buf) Uplink::Send(u, "QUIT"); } -void IRCDProto::SendPartInternal(User *u, const Channel *chan, const Anope::string &buf) +void IRCDProto::SendPart(User *u, const Channel *chan, const Anope::string &buf) { if (!buf.empty()) Uplink::Send(u, "PART", chan->name, buf); @@ -143,7 +143,7 @@ void IRCDProto::SendPartInternal(User *u, const Channel *chan, const Anope::stri Uplink::Send(u, "PART", chan->name); } -void IRCDProto::SendGlobopsInternal(const MessageSource &source, const Anope::string &message) +void IRCDProto::SendGlobops(const MessageSource &source, const Anope::string &message) { Uplink::Send(source, "GLOBOPS", message); } @@ -172,32 +172,6 @@ void IRCDProto::SendTopic(const MessageSource &source, Channel *c) Uplink::Send(source, "TOPIC", c->name, c->topic); } -void IRCDProto::SendSVSKill(const MessageSource &source, User *user, const char *fmt, ...) -{ - if (!user || !fmt) - return; - - va_list args; - char buf[BUFSIZE] = ""; - va_start(args, fmt); - vsnprintf(buf, BUFSIZE - 1, fmt, args); - va_end(args); - SendSVSKillInternal(source, user, buf); -} - -void IRCDProto::SendKick(const MessageSource &source, const Channel *chan, User *user, const char *fmt, ...) -{ - if (!chan || !user) - return; - - va_list args; - char buf[BUFSIZE] = ""; - va_start(args, fmt); - vsnprintf(buf, BUFSIZE - 1, fmt, args); - va_end(args); - SendKickInternal(source, chan, user, buf); -} - void IRCDProto::SendNotice(const MessageSource &source, const Anope::string &dest, const char *fmt, ...) { va_list args; @@ -229,16 +203,6 @@ void IRCDProto::SendPrivmsg(const MessageSource &source, const Anope::string &de SendPrivmsgInternal(source, dest, buf); } -void IRCDProto::SendQuit(User *u, const char *fmt, ...) -{ - va_list args; - char buf[BUFSIZE] = ""; - va_start(args, fmt); - vsnprintf(buf, BUFSIZE - 1, fmt, args); - va_end(args); - SendQuitInternal(u, buf); -} - void IRCDProto::SendPing(const Anope::string &servname, const Anope::string &who) { if (servname.empty()) @@ -266,31 +230,6 @@ void IRCDProto::SendInvite(const MessageSource &source, const Channel *c, User * Uplink::Send(source, "INVITE", u->GetUID(), c->name); } -void IRCDProto::SendPart(User *user, const Channel *chan, const char *fmt, ...) -{ - if (fmt) - { - va_list args; - char buf[BUFSIZE] = ""; - va_start(args, fmt); - vsnprintf(buf, BUFSIZE - 1, fmt, args); - va_end(args); - SendPartInternal(user, chan, buf); - } - else - SendPartInternal(user, chan, ""); -} - -void IRCDProto::SendGlobops(const MessageSource &source, const char *fmt, ...) -{ - va_list args; - char buf[BUFSIZE] = ""; - va_start(args, fmt); - vsnprintf(buf, BUFSIZE - 1, fmt, args); - va_end(args); - SendGlobopsInternal(source, buf); -} - void IRCDProto::SendSquit(Server *s, const Anope::string &message) { Uplink::Send("SQUIT", s->GetSID(), message); diff --git a/src/users.cpp b/src/users.cpp index f2bf55e88..7761cb5c7 100644 --- a/src/users.cpp +++ b/src/users.cpp @@ -93,7 +93,7 @@ static void CollideKill(User *target, const Anope::string &reason) else { // Be sure my user is really dead - IRCD->SendQuit(target, "%s", reason.c_str()); + IRCD->SendQuit(target, reason); // Reintroduce my client if (BotInfo *bi = dynamic_cast<BotInfo *>(target)) @@ -770,7 +770,7 @@ void User::Kill(const MessageSource &source, const Anope::string &reason) { Anope::string real_reason = source.GetName() + " (" + reason + ")"; - IRCD->SendSVSKill(source, this, "%s", real_reason.c_str()); + IRCD->SendSVSKill(source, this, real_reason); } void User::KillInternal(const MessageSource &source, const Anope::string &reason) |