summaryrefslogtreecommitdiff
path: root/modules
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 /modules
parent9b77fdf5b680e4a084effe56345a9d01cfbf6f11 (diff)
Rework SendModeInternal to be usable with Uplink::Send.
Diffstat (limited to 'modules')
-rw-r--r--modules/protocol/bahamut.cpp18
-rw-r--r--modules/protocol/hybrid.cpp10
-rw-r--r--modules/protocol/inspircd.cpp8
-rw-r--r--modules/protocol/plexus.cpp6
-rw-r--r--modules/protocol/ratbox.cpp2
-rw-r--r--modules/protocol/unrealircd.cpp14
6 files changed, 35 insertions, 23 deletions
diff --git a/modules/protocol/bahamut.cpp b/modules/protocol/bahamut.cpp
index 56efb5ce4..a82f63bd8 100644
--- a/modules/protocol/bahamut.cpp
+++ b/modules/protocol/bahamut.cpp
@@ -47,19 +47,23 @@ public:
MaxModes = 60;
}
- void SendModeInternal(const MessageSource &source, const Channel *dest, const Anope::string &buf) override
+ void SendModeInternal(const MessageSource &source, Channel *chan, const Anope::string &modes, const std::vector<Anope::string> &values) override
{
if (Servers::Capab.count("TSMODE") > 0)
{
- UplinkSocket::Message(source) << "MODE " << dest->name << " " << dest->creation_time << " " << buf;
+ auto params = values;
+ params.insert(params.begin(), { chan->name, stringify(chan->creation_time), modes });
+ Uplink::SendInternal({}, source, "MODE", params);
}
else
- IRCDProto::SendModeInternal(source, dest, buf);
+ IRCDProto::SendModeInternal(source, chan, modes, values);
}
- void SendModeInternal(const MessageSource &source, User *u, const Anope::string &buf) override
+ void SendModeInternal(const MessageSource &source, User* u, const Anope::string &modes, const std::vector<Anope::string> &values) override
{
- UplinkSocket::Message(source) << "SVSMODE " << u->nick << " " << u->timestamp << " " << buf;
+ auto params = values;
+ params.insert(params.begin(), { u->nick, stringify(u->timestamp), modes });
+ Uplink::SendInternal({}, source, "SVSMODE", params);
}
void SendGlobalNotice(BotInfo *bi, const Server *dest, const Anope::string &msg) override
@@ -283,12 +287,12 @@ public:
void SendLogin(User *u, NickAlias *) override
{
- IRCD->SendMode(Config->GetClient("NickServ"), u, "+d %ld", (unsigned long)u->signon);
+ IRCD->SendMode(Config->GetClient("NickServ"), u, "+d", u->signon);
}
void SendLogout(User *u) override
{
- IRCD->SendMode(Config->GetClient("NickServ"), u, "+d 1");
+ IRCD->SendMode(Config->GetClient("NickServ"), u, "+d", 1);
}
};
diff --git a/modules/protocol/hybrid.cpp b/modules/protocol/hybrid.cpp
index f67f72d24..cbb4270b4 100644
--- a/modules/protocol/hybrid.cpp
+++ b/modules/protocol/hybrid.cpp
@@ -205,15 +205,17 @@ public:
UplinkSocket::Message(Me) << "EOB";
}
- void SendModeInternal(const MessageSource &source, User *u, const Anope::string &buf) override
+ void SendModeInternal(const MessageSource &source, User* u, const Anope::string &modes, const std::vector<Anope::string> &values) override
{
- UplinkSocket::Message(source) << "SVSMODE " << u->GetUID() << " " << u->timestamp << " " << buf;
+ auto params = values;
+ params.insert(params.begin(), { u->GetUID(), stringify(u->timestamp), modes });
+ Uplink::SendInternal({}, source, "SVSMODE", params);
}
void SendLogin(User *u, NickAlias *na) override
{
if (UseSVSAccount == false)
- IRCD->SendMode(Config->GetClient("NickServ"), u, "+d %s", na->nc->display.c_str());
+ IRCD->SendMode(Config->GetClient("NickServ"), u, "+d", na->nc->display);
else
UplinkSocket::Message(Me) << "SVSACCOUNT " << u->GetUID() << " " << u->timestamp << " " << na->nc->display;
}
@@ -221,7 +223,7 @@ public:
void SendLogout(User *u) override
{
if (UseSVSAccount == false)
- IRCD->SendMode(Config->GetClient("NickServ"), u, "+d *");
+ IRCD->SendMode(Config->GetClient("NickServ"), u, "+d", '*');
else
UplinkSocket::Message(Me) << "SVSACCOUNT " << u->GetUID() << " " << u->timestamp << " *";
}
diff --git a/modules/protocol/inspircd.cpp b/modules/protocol/inspircd.cpp
index cef005f83..fd4771a7d 100644
--- a/modules/protocol/inspircd.cpp
+++ b/modules/protocol/inspircd.cpp
@@ -299,13 +299,15 @@ public:
void SendNumericInternal(int numeric, const Anope::string &dest, const std::vector<Anope::string> &params) override
{
auto newparams = params;
- newparams.insert(newparams.begin(), { Me->GetSID(), dest, numeric });
+ newparams.insert(newparams.begin(), { Me->GetSID(), dest, stringify(numeric) });
Uplink::SendInternal({}, Me, numeric, newparams);
}
- void SendModeInternal(const MessageSource &source, const Channel *dest, const Anope::string &buf) override
+ void SendModeInternal(const MessageSource &source, Channel *chan, const Anope::string &modes, const std::vector<Anope::string> &values) override
{
- UplinkSocket::Message(source) << "FMODE " << dest->name << " " << dest->creation_time << " " << buf;
+ auto params = values;
+ params.insert(params.begin(), { chan->name, stringify(chan->creation_time), modes });
+ Uplink::SendInternal({}, source, "FMODE", params);
}
void SendClientIntroduction(User *u) override
diff --git a/modules/protocol/plexus.cpp b/modules/protocol/plexus.cpp
index f68cb8072..bcf31155c 100644
--- a/modules/protocol/plexus.cpp
+++ b/modules/protocol/plexus.cpp
@@ -139,9 +139,11 @@ public:
UplinkSocket::Message(Me) << "UID " << u->nick << " 1 " << u->timestamp << " " << modes << " " << u->GetIdent() << " " << u->host << " 255.255.255.255 " << u->GetUID() << " 0 " << u->host << " :" << u->realname;
}
- void SendModeInternal(const MessageSource &source, User *u, const Anope::string &buf) override
+ void SendModeInternal(const MessageSource &source, User* u, const Anope::string &modes, const std::vector<Anope::string> &values) override
{
- UplinkSocket::Message(source) << "ENCAP * SVSMODE " << u->GetUID() << " " << u->timestamp << " " << buf;
+ auto params = values;
+ params.insert(params.begin(), { "*", "SVSMODE", u->GetUID(), stringify(u->timestamp), modes });
+ Uplink::SendInternal({}, source, "ENCAP", params);
}
void SendLogin(User *u, NickAlias *na) override
diff --git a/modules/protocol/ratbox.cpp b/modules/protocol/ratbox.cpp
index 361acb007..d76ad9c15 100644
--- a/modules/protocol/ratbox.cpp
+++ b/modules/protocol/ratbox.cpp
@@ -53,7 +53,7 @@ public:
void SendAkillDel(const XLine *x) override { hybrid->SendAkillDel(x); }
void SendJoin(User *user, Channel *c, const ChannelStatus *status) override { hybrid->SendJoin(user, c, status); }
void SendServer(const Server *server) override { hybrid->SendServer(server); }
- void SendModeInternal(const MessageSource &source, User *u, const Anope::string &buf) override { hybrid->SendModeInternal(source, u, buf); }
+ void SendModeInternal(const MessageSource &source, User *u, const Anope::string &modes, const std::vector<Anope::string> &values) override { hybrid->SendModeInternal(source, u, modes, values); }
void SendChannel(Channel *c) override { hybrid->SendChannel(c); }
bool IsIdentValid(const Anope::string &ident) override { return hybrid->IsIdentValid(ident); }
diff --git a/modules/protocol/unrealircd.cpp b/modules/protocol/unrealircd.cpp
index 0da73d441..0a3d2d094 100644
--- a/modules/protocol/unrealircd.cpp
+++ b/modules/protocol/unrealircd.cpp
@@ -134,10 +134,12 @@ private:
user->KillInternal(source, buf);
}
- void SendModeInternal(const MessageSource &source, User *u, const Anope::string &buf) override
+ void SendModeInternal(const MessageSource &source, User *u, const Anope::string &modes, const std::vector<Anope::string> &values) override
{
- UplinkSocket::Message(source) << "SVS2MODE " << u->GetUID() <<" " << buf;
- }
+ auto params = values;
+ params.insert(params.begin(), { u->GetUID(), modes });
+ Uplink::SendInternal({}, source, "SVS2MODE", params);
+}
void SendClientIntroduction(User *u) override
{
@@ -350,14 +352,14 @@ private:
{
/* 3.2.10.4+ treats users logged in with accounts as fully registered, even if -r, so we can not set this here. Just use the timestamp. */
if (Servers::Capab.count("ESVID") > 0 && !na->nc->HasExt("UNCONFIRMED"))
- IRCD->SendMode(Config->GetClient("NickServ"), u, "+d %s", na->nc->display.c_str());
+ IRCD->SendMode(Config->GetClient("NickServ"), u, "+d", na->nc->display);
else
- IRCD->SendMode(Config->GetClient("NickServ"), u, "+d %ld", (unsigned long)u->signon);
+ IRCD->SendMode(Config->GetClient("NickServ"), u, "+d", u->signon);
}
void SendLogout(User *u) override
{
- IRCD->SendMode(Config->GetClient("NickServ"), u, "+d 0");
+ IRCD->SendMode(Config->GetClient("NickServ"), u, "+d", 0);
}
void SendChannel(Channel *c) override