summaryrefslogtreecommitdiff
path: root/src/protocol.cpp
diff options
context:
space:
mode:
authorSadie Powell <sadie@witchery.services>2024-02-21 20:45:38 +0000
committerSadie Powell <sadie@witchery.services>2024-02-22 00:14:08 +0000
commitaefbb4fbdab80a41c3f88566abcba4b92b2d36d5 (patch)
tree81b6ba768c99606101fbce39d54d9d521d1a1e20 /src/protocol.cpp
parent9b77fdf5b680e4a084effe56345a9d01cfbf6f11 (diff)
Rework SendModeInternal to be usable with Uplink::Send.
Diffstat (limited to 'src/protocol.cpp')
-rw-r--r--src/protocol.cpp32
1 files changed, 8 insertions, 24 deletions
diff --git a/src/protocol.cpp b/src/protocol.cpp
index 41df1dadc..cfa03d3d8 100644
--- a/src/protocol.cpp
+++ b/src/protocol.cpp
@@ -95,14 +95,18 @@ void IRCDProto::SendSVSKillInternal(const MessageSource &source, User *user, con
Uplink::Send(source, "KILL", user->GetUID(), buf);
}
-void IRCDProto::SendModeInternal(const MessageSource &source, const Channel *dest, const Anope::string &buf)
+void IRCDProto::SendModeInternal(const MessageSource &source, Channel *chan, const Anope::string &modes, const std::vector<Anope::string> &values)
{
- UplinkSocket::Message(source) << "MODE " << dest->name << " " << buf;
+ auto params = values;
+ params.insert(params.begin(), { chan->name, modes });
+ Uplink::SendInternal({}, source, "MODE", params);
}
-void IRCDProto::SendModeInternal(const MessageSource &source, User *dest, const Anope::string &buf)
+void IRCDProto::SendModeInternal(const MessageSource &source, User *dest, const Anope::string &modes, const std::vector<Anope::string> &values)
{
- UplinkSocket::Message(source) << "MODE " << dest->GetUID() << " " << buf;
+ auto params = values;
+ params.insert(params.begin(), { dest->GetUID(), modes });
+ Uplink::SendInternal({}, source, "MODE", params);
}
void IRCDProto::SendKickInternal(const MessageSource &source, const Channel *c, User *u, const Anope::string &r)
@@ -181,26 +185,6 @@ void IRCDProto::SendSVSKill(const MessageSource &source, User *user, const char
SendSVSKillInternal(source, user, buf);
}
-void IRCDProto::SendMode(const MessageSource &source, const Channel *dest, const char *fmt, ...)
-{
- va_list args;
- char buf[BUFSIZE] = "";
- va_start(args, fmt);
- vsnprintf(buf, BUFSIZE - 1, fmt, args);
- va_end(args);
- SendModeInternal(source, dest, buf);
-}
-
-void IRCDProto::SendMode(const MessageSource &source, User *u, const char *fmt, ...)
-{
- va_list args;
- char buf[BUFSIZE] = "";
- va_start(args, fmt);
- vsnprintf(buf, BUFSIZE - 1, fmt, args);
- va_end(args);
- SendModeInternal(source, u, buf);
-}
-
void IRCDProto::SendKick(const MessageSource &source, const Channel *chan, User *user, const char *fmt, ...)
{
if (!chan || !user)