1
0
mirror of https://github.com/anope/anope.git synced 2026-07-07 07:33:13 +02:00

Convert protocol modules over to Uplink::Send.

This commit is contained in:
Sadie Powell
2024-02-21 21:27:20 +00:00
parent aefbb4fbda
commit 82fa7e1467
8 changed files with 259 additions and 253 deletions
+28 -30
View File
@@ -68,45 +68,46 @@ public:
void SendGlobalNotice(BotInfo *bi, const Server *dest, const Anope::string &msg) override void SendGlobalNotice(BotInfo *bi, const Server *dest, const Anope::string &msg) override
{ {
UplinkSocket::Message(bi) << "NOTICE $" << dest->GetName() << " :" << msg; Uplink::Send(bi, "NOTICE", "$" + dest->GetName(), msg);
} }
void SendGlobalPrivmsg(BotInfo *bi, const Server *dest, const Anope::string &msg) override void SendGlobalPrivmsg(BotInfo *bi, const Server *dest, const Anope::string &msg) override
{ {
UplinkSocket::Message(bi) << "PRIVMSG $" << dest->GetName() << " :" << msg; Uplink::Send(bi, "PRIVMSG", "$" + dest->GetName(), msg);
} }
/* SVSHOLD - set */ /* SVSHOLD - set */
void SendSVSHold(const Anope::string &nick, time_t time) override void SendSVSHold(const Anope::string &nick, time_t time) override
{ {
UplinkSocket::Message(Me) << "SVSHOLD " << nick << " " << time << " :Being held for registered user"; Uplink::Send("SVSHOLD", nick, time, "Being held for a registered user");
} }
/* SVSHOLD - release */ /* SVSHOLD - release */
void SendSVSHoldDel(const Anope::string &nick) override void SendSVSHoldDel(const Anope::string &nick) override
{ {
UplinkSocket::Message(Me) << "SVSHOLD " << nick << " 0"; Uplink::Send("SVSHOLD", nick, 0);
} }
/* SQLINE */ /* SQLINE */
void SendSQLine(User *, const XLine *x) override void SendSQLine(User *, const XLine *x) override
{ {
UplinkSocket::Message() << "SQLINE " << x->mask << " :" << x->GetReason(); Uplink::Send("SQLINE", x->mask, x->reason);
} }
/* UNSLINE */ /* UNSLINE */
void SendSGLineDel(const XLine *x) override void SendSGLineDel(const XLine *x) override
{ {
UplinkSocket::Message() << "UNSGLINE 0 :" << x->mask; Uplink::Send("UNSGLINE", 0, x->mask);
} }
/* UNSZLINE */ /* UNSZLINE */
void SendSZLineDel(const XLine *x) override void SendSZLineDel(const XLine *x) override
{ {
/* this will likely fail so its only here for legacy */ /* this will likely fail so its only here for legacy */
UplinkSocket::Message() << "UNSZLINE 0 " << x->GetHost(); Uplink::Send("UNSZLINE", 0, x->GetHost());
/* this is how we are supposed to deal with it */ /* this is how we are supposed to deal with it */
UplinkSocket::Message() << "RAKILL " << x->GetHost() << " *"; Uplink::Send("RAKILL", x->GetHost(), '*');
} }
/* SZLINE */ /* SZLINE */
@@ -116,21 +117,22 @@ public:
time_t timeleft = x->expires ? x->expires - Anope::CurTime : x->expires; time_t timeleft = x->expires ? x->expires - Anope::CurTime : x->expires;
/* this will likely fail so its only here for legacy */ /* this will likely fail so its only here for legacy */
UplinkSocket::Message() << "SZLINE " << x->GetHost() << " :" << x->GetReason(); Uplink::Send("SZLINE", x->GetHost(), x->GetReason());
/* this is how we are supposed to deal with it */ /* this is how we are supposed to deal with it */
UplinkSocket::Message() << "AKILL " << x->GetHost() << " * " << timeleft << " " << x->by << " " << Anope::CurTime << " :" << x->GetReason(); Uplink::Send("AKILL", x->GetHost(), '*', timeleft, x->by, Anope::CurTime, x->GetReason());
} }
/* SVSNOOP */ /* SVSNOOP */
void SendSVSNOOP(const Server *server, bool set) override void SendSVSNOOP(const Server *server, bool set) override
{ {
UplinkSocket::Message() << "SVSNOOP " << server->GetName() << " " << (set ? "+" : "-"); Uplink::Send("SVSNOOP", server->GetName(), set ? '+' : '-');
} }
/* SGLINE */ /* SGLINE */
void SendSGLine(User *, const XLine *x) override void SendSGLine(User *, const XLine *x) override
{ {
UplinkSocket::Message() << "SGLINE " << x->mask.length() << " :" << x->mask << ":" << x->GetReason(); Uplink::Send("SGLINE", x->mask.length(), x->mask, x->GetReason());
} }
/* RAKILL */ /* RAKILL */
@@ -150,25 +152,25 @@ public:
} }
} }
UplinkSocket::Message() << "RAKILL " << x->GetHost() << " " << x->GetUser(); Uplink::Send("RAKILL", x->GetHost(), x->GetUser());
} }
/* TOPIC */ /* TOPIC */
void SendTopic(const MessageSource &source, Channel *c) override void SendTopic(const MessageSource &source, Channel *c) override
{ {
UplinkSocket::Message(source) << "TOPIC " << c->name << " " << c->topic_setter << " " << c->topic_ts << " :" << c->topic; Uplink::Send(source, "TOPIC", c->name, c->topic_setter, c->topic_ts, c->topic);
} }
/* UNSQLINE */ /* UNSQLINE */
void SendSQLineDel(const XLine *x) override void SendSQLineDel(const XLine *x) override
{ {
UplinkSocket::Message() << "UNSQLINE " << x->mask; Uplink::Send("UNSQLINE", x->mask);
} }
/* JOIN - SJOIN */ /* JOIN - SJOIN */
void SendJoin(User *user, Channel *c, const ChannelStatus *status) override void SendJoin(User *user, Channel *c, const ChannelStatus *status) override
{ {
UplinkSocket::Message(user) << "SJOIN " << c->creation_time << " " << c->name; Uplink::Send(user, "SJOIN", c->creation_time, c->name);
if (status) if (status)
{ {
/* First save the channel status incase uc->Status == status */ /* First save the channel status incase uc->Status == status */
@@ -227,7 +229,7 @@ public:
// Calculate the time left before this would expire // Calculate the time left before this would expire
time_t timeleft = x->expires ? x->expires - Anope::CurTime : x->expires; time_t timeleft = x->expires ? x->expires - Anope::CurTime : x->expires;
UplinkSocket::Message() << "AKILL " << x->GetHost() << " " << x->GetUser() << " " << timeleft << " " << x->by << " " << Anope::CurTime << " :" << x->GetReason(); Uplink::Send("AKILL", x->GetHost(), x->GetUser(), timeleft, x->by, Anope::CurTime, x->reason);
} }
/* /*
@@ -235,35 +237,34 @@ public:
*/ */
void SendSVSKillInternal(const MessageSource &source, User *user, const Anope::string &buf) override void SendSVSKillInternal(const MessageSource &source, User *user, const Anope::string &buf) override
{ {
UplinkSocket::Message(source) << "SVSKILL " << user->nick << " :" << buf; Uplink::Send("SVSKILL", user->nick, buf);
} }
void SendBOB() override void SendBOB() override
{ {
UplinkSocket::Message() << "BURST"; Uplink::Send("BURST");
} }
void SendEOB() override void SendEOB() override
{ {
UplinkSocket::Message() << "BURST 0"; Uplink::Send("BURST", 0);
} }
void SendClientIntroduction(User *u) override void SendClientIntroduction(User *u) override
{ {
Anope::string modes = "+" + u->GetModes(); Uplink::Send("NICK", u->nick, 1, u->timestamp, "+" + u->GetModes(), u->GetIdent(), u->host, u->server->GetName(), 0, 0, u->realname);
UplinkSocket::Message() << "NICK " << u->nick << " 1 " << u->timestamp << " " << modes << " " << u->GetIdent() << " " << u->host << " " << u->server->GetName() << " 0 0 :" << u->realname;
} }
/* SERVER */ /* SERVER */
void SendServer(const Server *server) override void SendServer(const Server *server) override
{ {
UplinkSocket::Message() << "SERVER " << server->GetName() << " " << server->GetHops() << " :" << server->GetDescription(); Uplink::Send("SERVER", server->GetName(), server->GetHops(), server->GetDescription());
} }
void SendConnect() override void SendConnect() override
{ {
UplinkSocket::Message() << "PASS " << Config->Uplinks[Anope::CurrentUplink].password << " :TS"; Uplink::Send("PASS", Config->Uplinks[Anope::CurrentUplink].password, "TS");
UplinkSocket::Message() << "CAPAB SSJOIN NOQUIT BURST UNCONNECT NICKIP TSMODE TS3"; Uplink::Send("CAPAB", "SSJOIN", "NOQUIT", "BURST", "UNCONNECT", "NICKIP", "TSMODE", "TS3");
SendServer(Me); SendServer(Me);
/* /*
* SVINFO * SVINFO
@@ -273,16 +274,13 @@ public:
* parv[3] = server is standalone or connected to non-TS only * parv[3] = server is standalone or connected to non-TS only
* parv[4] = server's idea of UTC time * parv[4] = server's idea of UTC time
*/ */
UplinkSocket::Message() << "SVINFO 3 1 0 :" << Anope::CurTime; Uplink::Send("SVINFO", 3, 1, 0, Anope::CurTime);
this->SendBOB(); this->SendBOB();
} }
void SendChannel(Channel *c) override void SendChannel(Channel *c) override
{ {
Anope::string modes = c->GetModes(true, true); Uplink::Send("SJOIN", c->creation_time, c->name, "+" + c->GetModes(true, true), "");
if (modes.empty())
modes = "+";
UplinkSocket::Message() << "SJOIN " << c->creation_time << " " << c->name << " " << modes << " :";
} }
void SendLogin(User *u, NickAlias *) override void SendLogin(User *u, NickAlias *) override
+35 -41
View File
@@ -43,45 +43,44 @@ public:
void SendInvite(const MessageSource &source, const Channel *c, User *u) override void SendInvite(const MessageSource &source, const Channel *c, User *u) override
{ {
UplinkSocket::Message(source) << "INVITE " << u->GetUID() << " " << c->name << " " << c->creation_time; Uplink::Send(source, "INVITE", u->GetUID(), c->name, c->creation_time);
} }
void SendGlobalNotice(BotInfo *bi, const Server *dest, const Anope::string &msg) override void SendGlobalNotice(BotInfo *bi, const Server *dest, const Anope::string &msg) override
{ {
UplinkSocket::Message(bi) << "NOTICE $$" << dest->GetName() << " :" << msg; Uplink::Send(bi, "NOTICE", "$$" + dest->GetName(), msg);
} }
void SendGlobalPrivmsg(BotInfo *bi, const Server *dest, const Anope::string &msg) override void SendGlobalPrivmsg(BotInfo *bi, const Server *dest, const Anope::string &msg) override
{ {
UplinkSocket::Message(bi) << "PRIVMSG $$" << dest->GetName() << " :" << msg; Uplink::Send(bi, "PRIVMSG", "$$" + dest->GetName(), msg);
} }
void SendSQLine(User *, const XLine *x) override void SendSQLine(User *, const XLine *x) override
{ {
UplinkSocket::Message(Me) << "RESV * " << (x->expires ? x->expires - Anope::CurTime : 0) << " " << x->mask << " :" << x->reason; Uplink::Send("RESV", '*', x->expires ? x->expires - Anope::CurTime : 0, x->mask, x->reason);
} }
void SendSGLineDel(const XLine *x) override void SendSGLineDel(const XLine *x) override
{ {
UplinkSocket::Message(Me) << "UNXLINE * " << x->mask; Uplink::Send("UNXLINE", '*', x->mask);
} }
void SendSGLine(User *, const XLine *x) override void SendSGLine(User *, const XLine *x) override
{ {
UplinkSocket::Message(Me) << "XLINE * " << x->mask << " " << (x->expires ? x->expires - Anope::CurTime : 0) << " :" << x->GetReason(); Uplink::Send("XLINE", '*', x->mask, x->expires ? x->expires - Anope::CurTime : 0, x->GetReason());
} }
void SendSZLineDel(const XLine *x) override void SendSZLineDel(const XLine *x) override
{ {
UplinkSocket::Message(Me) << "UNDLINE * " << x->GetHost(); Uplink::Send("UNDLINE", '*', x->GetHost());
} }
void SendSZLine(User *, const XLine *x) override void SendSZLine(User *, const XLine *x) override
{ {
/* Calculate the time left before this would expire */ /* Calculate the time left before this would expire */
time_t timeleft = x->expires ? x->expires - Anope::CurTime : x->expires; time_t timeleft = x->expires ? x->expires - Anope::CurTime : x->expires;
Uplink::Send("DLINE", '*', timeleft, x->GetHost(), x->GetReason());
UplinkSocket::Message(Me) << "DLINE * " << timeleft << " " << x->GetHost() << " :" << x->GetReason();
} }
void SendAkillDel(const XLine *x) override void SendAkillDel(const XLine *x) override
@@ -89,17 +88,17 @@ public:
if (x->IsRegex() || x->HasNickOrReal()) if (x->IsRegex() || x->HasNickOrReal())
return; return;
UplinkSocket::Message(Me) << "UNKLINE * " << x->GetUser() << " " << x->GetHost(); Uplink::Send("UNKLINE", '*', x->GetUser(), x->GetHost());
} }
void SendSQLineDel(const XLine *x) override void SendSQLineDel(const XLine *x) override
{ {
UplinkSocket::Message(Me) << "UNRESV * " << x->mask; Uplink::Send("UNRESV", '*', x->mask);
} }
void SendJoin(User *u, Channel *c, const ChannelStatus *status) override void SendJoin(User *u, Channel *c, const ChannelStatus *status) override
{ {
UplinkSocket::Message(Me) << "SJOIN " << c->creation_time << " " << c->name << " +" << c->GetModes(true, true) << " :" << u->GetUID(); Uplink::Send("SJOIN", c->creation_time, c->name, "+" + c->GetModes(true, true), u->GetUID());
/* /*
* Note that we can send this with the SJOIN but choose not to * Note that we can send this with the SJOIN but choose not to
@@ -162,21 +161,20 @@ public:
/* Calculate the time left before this would expire */ /* Calculate the time left before this would expire */
time_t timeleft = x->expires ? x->expires - Anope::CurTime : x->expires; time_t timeleft = x->expires ? x->expires - Anope::CurTime : x->expires;
Uplink::Send("KLINE", '*', timeleft, x->GetUser(), x->GetHost(), x->GetReason());
UplinkSocket::Message(Me) << "KLINE * " << timeleft << " " << x->GetUser() << " " << x->GetHost() << " :" << x->GetReason();
} }
void SendServer(const Server *server) override void SendServer(const Server *server) override
{ {
if (server == Me) if (server == Me)
UplinkSocket::Message() << "SERVER " << server->GetName() << " " << server->GetHops() + 1 << " " << server->GetSID() << " +" << " :" << server->GetDescription(); Uplink::Send("SERVER", server->GetName(), server->GetHops() + 1, server->GetSID(), '+', server->GetDescription());
else else
UplinkSocket::Message(Me) << "SID " << server->GetName() << " " << server->GetHops() + 1 << " " << server->GetSID() << " +" << " :" << server->GetDescription(); Uplink::Send("SID", server->GetName(), server->GetHops() + 1, server->GetSID(), '+', server->GetDescription());
} }
void SendConnect() override void SendConnect() override
{ {
UplinkSocket::Message() << "PASS " << Config->Uplinks[Anope::CurrentUplink].password; Uplink::Send("PASS", Config->Uplinks[Anope::CurrentUplink].password);
/* /*
* TBURST - Supports topic burst * TBURST - Supports topic burst
@@ -185,24 +183,21 @@ public:
* RHOST - Supports UID message with realhost information * RHOST - Supports UID message with realhost information
* MLOCK - Supports MLOCK * MLOCK - Supports MLOCK
*/ */
UplinkSocket::Message() << "CAPAB :ENCAP TBURST EOB RHOST MLOCK"; Uplink::Send("CAPAB", "ENCAP", "TBURST", "EOB", "RHOST", "MLOCK");
SendServer(Me); SendServer(Me);
UplinkSocket::Message(Me) << "SVINFO 6 6 0 :" << Anope::CurTime; Uplink::Send("SVINFO", 6, 6, 0, Anope::CurTime);
} }
void SendClientIntroduction(User *u) override void SendClientIntroduction(User *u) override
{ {
Anope::string modes = "+" + u->GetModes(); Uplink::Send("UID", u->nick, 1, u->timestamp, "+" + u->GetModes(), u->GetIdent(), u->host, u->host, "0.0.0.0", u->GetUID(), '*', u->realname);
UplinkSocket::Message(Me) << "UID " << u->nick << " 1 " << u->timestamp << " " << modes << " " << u->GetIdent() << " "
<< u->host << " " << u->host << " 0.0.0.0 " << u->GetUID() << " * :" << u->realname;
} }
void SendEOB() override void SendEOB() override
{ {
UplinkSocket::Message(Me) << "EOB"; Uplink::Send("EOB");
} }
void SendModeInternal(const MessageSource &source, User* u, const Anope::string &modes, const std::vector<Anope::string> &values) override void SendModeInternal(const MessageSource &source, User* u, const Anope::string &modes, const std::vector<Anope::string> &values) override
@@ -217,7 +212,7 @@ public:
if (UseSVSAccount == false) if (UseSVSAccount == false)
IRCD->SendMode(Config->GetClient("NickServ"), u, "+d", na->nc->display); IRCD->SendMode(Config->GetClient("NickServ"), u, "+d", na->nc->display);
else else
UplinkSocket::Message(Me) << "SVSACCOUNT " << u->GetUID() << " " << u->timestamp << " " << na->nc->display; Uplink::Send("SVSACCOUNT", u->GetUID(), u->timestamp, na->nc->display);
} }
void SendLogout(User *u) override void SendLogout(User *u) override
@@ -225,41 +220,40 @@ public:
if (UseSVSAccount == false) if (UseSVSAccount == false)
IRCD->SendMode(Config->GetClient("NickServ"), u, "+d", '*'); IRCD->SendMode(Config->GetClient("NickServ"), u, "+d", '*');
else else
UplinkSocket::Message(Me) << "SVSACCOUNT " << u->GetUID() << " " << u->timestamp << " *"; Uplink::Send("SVSACCOUNT", u->GetUID(), u->timestamp, '*');
} }
void SendChannel(Channel *c) override void SendChannel(Channel *c) override
{ {
Anope::string modes = "+" + c->GetModes(true, true); Uplink::Send("SJOIN", c->creation_time, c->name, "+" + c->GetModes(true, true), "");
UplinkSocket::Message(Me) << "SJOIN " << c->creation_time << " " << c->name << " " << modes << " :";
} }
void SendTopic(const MessageSource &source, Channel *c) override void SendTopic(const MessageSource &source, Channel *c) override
{ {
UplinkSocket::Message(source) << "TBURST " << c->creation_time << " " << c->name << " " << c->topic_ts << " " << c->topic_setter << " :" << c->topic; Uplink::Send(source, "TBURST", c->creation_time, c->name, c->topic_ts, c->topic_setter, c->topic);
} }
void SendForceNickChange(User *u, const Anope::string &newnick, time_t when) override void SendForceNickChange(User *u, const Anope::string &newnick, time_t when) override
{ {
UplinkSocket::Message(Me) << "SVSNICK " << u->GetUID() << " " << u->timestamp << " " << newnick << " " << when; Uplink::Send("SVSNICK", u->GetUID(), u->timestamp, newnick, when);
} }
void SendSVSJoin(const MessageSource &source, User *u, const Anope::string &chan, const Anope::string &) override void SendSVSJoin(const MessageSource &source, User *u, const Anope::string &chan, const Anope::string &) override
{ {
UplinkSocket::Message(source) << "SVSJOIN " << u->GetUID() << " " << chan; Uplink::Send(source, "SVSJOIN", u->GetUID(), chan);
} }
void SendSVSPart(const MessageSource &source, User *u, const Anope::string &chan, const Anope::string &param) override void SendSVSPart(const MessageSource &source, User *u, const Anope::string &chan, const Anope::string &param) override
{ {
if (!param.empty()) if (!param.empty())
UplinkSocket::Message(source) << "SVSPART " << u->GetUID() << " " << chan << " :" << param; Uplink::Send("SVSPART", u->GetUID(), chan, param);
else else
UplinkSocket::Message(source) << "SVSPART " << u->GetUID() << " " << chan; Uplink::Send("SVSPART", u->GetUID(), chan);
} }
void SendSVSHold(const Anope::string &nick, time_t t) override void SendSVSHold(const Anope::string &nick, time_t t) override
{ {
XLine x(nick, Me->GetName(), Anope::CurTime + t, "Being held for registered user"); XLine x(nick, Me->GetName(), Anope::CurTime + t, "Being held for a registered user");
this->SendSQLine(NULL, &x); this->SendSQLine(NULL, &x);
} }
@@ -271,12 +265,12 @@ public:
void SendVhost(User *u, const Anope::string &ident, const Anope::string &host) override void SendVhost(User *u, const Anope::string &ident, const Anope::string &host) override
{ {
UplinkSocket::Message(Me) << "SVSHOST " << u->GetUID() << " " << u->timestamp << " " << host; Uplink::Send("SVSHOST", u->GetUID(), u->timestamp, host);
} }
void SendVhostDel(User *u) override void SendVhostDel(User *u) override
{ {
UplinkSocket::Message(Me) << "SVSHOST " << u->GetUID() << " " << u->timestamp << " " << u->host; Uplink::Send("SVSHOST", u->GetUID(), u->timestamp, u->host);
} }
bool IsExtbanValid(const Anope::string &mask) override bool IsExtbanValid(const Anope::string &mask) override
@@ -460,7 +454,7 @@ struct IRCDMessageMLock final
// Mode lock string is not what we say it is? // Mode lock string is not what we say it is?
if (modes != params[3]) if (modes != params[3])
UplinkSocket::Message(Me) << "MLOCK " << c->creation_time << " " << c->name << " " << Anope::CurTime << " :" << modes; Uplink::Send("MLOCK", c->creation_time, c->name, Anope::CurTime, modes);
} }
} }
}; };
@@ -847,14 +841,14 @@ public:
if (use_server_side_mlock && modelocks && Servers::Capab.count("MLOCK")) if (use_server_side_mlock && modelocks && Servers::Capab.count("MLOCK"))
{ {
Anope::string modes = modelocks->GetMLockAsString(false).replace_all_cs("+", "").replace_all_cs("-", ""); Anope::string modes = modelocks->GetMLockAsString(false).replace_all_cs("+", "").replace_all_cs("-", "");
UplinkSocket::Message(Me) << "MLOCK " << c->creation_time << " " << c->ci->name << " " << Anope::CurTime << " :" << modes; Uplink::Send("MLOCK", c->creation_time, c->ci->name, Anope::CurTime, modes);
} }
} }
void OnDelChan(ChannelInfo *ci) override void OnDelChan(ChannelInfo *ci) override
{ {
if (use_server_side_mlock && ci->c && Servers::Capab.count("MLOCK")) if (use_server_side_mlock && ci->c && Servers::Capab.count("MLOCK"))
UplinkSocket::Message(Me) << "MLOCK " << ci->c->creation_time << " " << ci->name << " " << Anope::CurTime << " :"; Uplink::Send("MLOCK", ci->c->creation_time, ci->name, Anope::CurTime, "");
} }
EventReturn OnMLock(ChannelInfo *ci, ModeLock *lock) override EventReturn OnMLock(ChannelInfo *ci, ModeLock *lock) override
@@ -864,7 +858,7 @@ public:
if (use_server_side_mlock && cm && ci->c && modelocks && (cm->type == MODE_REGULAR || cm->type == MODE_PARAM) && Servers::Capab.count("MLOCK")) if (use_server_side_mlock && cm && ci->c && modelocks && (cm->type == MODE_REGULAR || cm->type == MODE_PARAM) && Servers::Capab.count("MLOCK"))
{ {
Anope::string modes = modelocks->GetMLockAsString(false).replace_all_cs("+", "").replace_all_cs("-", "") + cm->mchar; Anope::string modes = modelocks->GetMLockAsString(false).replace_all_cs("+", "").replace_all_cs("-", "") + cm->mchar;
UplinkSocket::Message(Me) << "MLOCK " << ci->c->creation_time << " " << ci->name << " " << Anope::CurTime << " :" << modes; Uplink::Send("MLOCK", ci->c->creation_time, ci->name, Anope::CurTime, modes);
} }
return EVENT_CONTINUE; return EVENT_CONTINUE;
@@ -877,7 +871,7 @@ public:
if (use_server_side_mlock && cm && modelocks && ci->c && (cm->type == MODE_REGULAR || cm->type == MODE_PARAM) && Servers::Capab.count("MLOCK")) if (use_server_side_mlock && cm && modelocks && ci->c && (cm->type == MODE_REGULAR || cm->type == MODE_PARAM) && Servers::Capab.count("MLOCK"))
{ {
Anope::string modes = modelocks->GetMLockAsString(false).replace_all_cs("+", "").replace_all_cs("-", "").replace_all_cs(cm->mchar, ""); Anope::string modes = modelocks->GetMLockAsString(false).replace_all_cs("+", "").replace_all_cs("-", "").replace_all_cs(cm->mchar, "");
UplinkSocket::Message(Me) << "MLOCK " << ci->c->creation_time << " " << ci->name << " " << Anope::CurTime << " :" << modes; Uplink::Send("MLOCK", ci->c->creation_time, ci->name, Anope::CurTime, modes);
} }
return EVENT_CONTINUE; return EVENT_CONTINUE;
+61 -58
View File
@@ -53,7 +53,7 @@ private:
if (!Servers::Capab.count("CHGIDENT")) if (!Servers::Capab.count("CHGIDENT"))
Log() << "CHGIDENT not loaded!"; Log() << "CHGIDENT not loaded!";
else else
UplinkSocket::Message(Me) << "CHGIDENT " << nick << " " << vIdent; Uplink::Send("CHGIDENT", nick, vIdent);
} }
void SendChgHostInternal(const Anope::string &nick, const Anope::string &vhost) void SendChgHostInternal(const Anope::string &nick, const Anope::string &vhost)
@@ -61,23 +61,23 @@ private:
if (!Servers::Capab.count("CHGHOST")) if (!Servers::Capab.count("CHGHOST"))
Log() << "CHGHOST not loaded!"; Log() << "CHGHOST not loaded!";
else else
UplinkSocket::Message(Me) << "CHGHOST " << nick << " " << vhost; Uplink::Send("CHGHOST", nick, vhost);
} }
void SendAddLine(const Anope::string &xtype, const Anope::string &mask, time_t duration, const Anope::string &addedby, const Anope::string &reason) void SendAddLine(const Anope::string &xtype, const Anope::string &mask, time_t duration, const Anope::string &addedby, const Anope::string &reason)
{ {
UplinkSocket::Message(Me) << "ADDLINE " << xtype << " " << mask << " " << addedby << " " << Anope::CurTime << " " << duration << " :" << reason; Uplink::Send("ADDLINE", xtype, mask, addedby, Anope::CurTime, duration, reason);
} }
void SendDelLine(const Anope::string &xtype, const Anope::string &mask) void SendDelLine(const Anope::string &xtype, const Anope::string &mask)
{ {
UplinkSocket::Message(Me) << "DELLINE " << xtype << " " << mask; Uplink::Send("DELLINE", xtype, mask);
} }
void SendAccount(const Anope::string &uid, NickAlias *na) void SendAccount(const Anope::string &uid, NickAlias *na)
{ {
UplinkSocket::Message(Me) << "METADATA " << uid << " accountid :" << (na ? na->nc->GetId() : Anope::string()); Uplink::Send("METADATA", uid, "accountid", na ? na->nc->GetId() : Anope::string());
UplinkSocket::Message(Me) << "METADATA " << uid << " accountname :" << (na ? na->nc->display : Anope::string()); Uplink::Send("METADATA", uid, "accountname", na ? na->nc->display : Anope::string());
} }
public: public:
@@ -118,10 +118,10 @@ public:
void SendConnect() override void SendConnect() override
{ {
UplinkSocket::Message() << "CAPAB START 1205"; Uplink::Send("CAPAB", "START", 1205);
UplinkSocket::Message() << "CAPAB CAPABILITIES :CASEMAPPING=" << Config->GetBlock("options")->Get<const Anope::string>("casemap", "ascii"); Uplink::Send("CAPAB", "CAPABILITIES", "CASEMAPPING=" + Config->GetBlock("options")->Get<const Anope::string>("casemap", "ascii"));
UplinkSocket::Message() << "CAPAB END"; Uplink::Send("CAPAB", "END");
UplinkSocket::Message() << "SERVER " << Me->GetName() << " " << Config->Uplinks[Anope::CurrentUplink].password << " 0 " << Me->GetSID() << " :" << Me->GetDescription(); Uplink::Send("SERVER", Me->GetName(), Config->Uplinks[Anope::CurrentUplink].password, 0, Me->GetSID(), Me->GetDescription());
} }
void SendSASLMechanisms(std::vector<Anope::string> &mechanisms) override void SendSASLMechanisms(std::vector<Anope::string> &mechanisms) override
@@ -130,7 +130,7 @@ public:
for (const auto &mechanism : mechanisms) for (const auto &mechanism : mechanisms)
mechlist += "," + mechanism; mechlist += "," + mechanism;
UplinkSocket::Message(Me) << "METADATA * saslmechlist :" << (mechanisms.empty() ? "" : mechlist.substr(1)); Uplink::Send("METADATA", "*", "saslmechlist", mechanisms.empty() ? "" : mechlist.substr(1));
} }
void SendSVSKillInternal(const MessageSource &source, User *user, const Anope::string &buf) override void SendSVSKillInternal(const MessageSource &source, User *user, const Anope::string &buf) override
@@ -141,17 +141,17 @@ public:
void SendForceNickChange(User *u, const Anope::string &newnick, time_t when) override void SendForceNickChange(User *u, const Anope::string &newnick, time_t when) override
{ {
UplinkSocket::Message() << "SVSNICK " << u->GetUID() << " " << newnick << " " << when << " " << u->timestamp; Uplink::Send("SVSNICK", u->GetUID(), newnick, when, u->timestamp);
} }
void SendGlobalNotice(BotInfo *bi, const Server *dest, const Anope::string &msg) override void SendGlobalNotice(BotInfo *bi, const Server *dest, const Anope::string &msg) override
{ {
UplinkSocket::Message(bi) << "NOTICE $" << dest->GetName() << " :" << msg; Uplink::Send(bi, "NOTICE", "$" + dest->GetName(), msg);
} }
void SendGlobalPrivmsg(BotInfo *bi, const Server *dest, const Anope::string &msg) override void SendGlobalPrivmsg(BotInfo *bi, const Server *dest, const Anope::string &msg) override
{ {
UplinkSocket::Message(bi) << "PRIVMSG $" << dest->GetName() << " :" << msg; Uplink::Send(bi, "PRIVMSG", "$" + dest->GetName(), msg);
} }
void SendPong(const Anope::string &servname, const Anope::string &who) override void SendPong(const Anope::string &servname, const Anope::string &who) override
@@ -160,7 +160,7 @@ public:
if (!serv) if (!serv)
serv = Me; serv = Me;
UplinkSocket::Message(serv) << "PONG " << who; Uplink::Send(serv, "PONG", who);
} }
void SendAkillDel(const XLine *x) override void SendAkillDel(const XLine *x) override
@@ -204,14 +204,14 @@ public:
void SendInvite(const MessageSource &source, const Channel *c, User *u) override void SendInvite(const MessageSource &source, const Channel *c, User *u) override
{ {
UplinkSocket::Message(source) << "INVITE " << u->GetUID() << " " << c->name << " " << c->creation_time; Uplink::Send(source, "INVITE", u->GetUID(), c->name, c->creation_time);
} }
void SendTopic(const MessageSource &source, Channel *c) override void SendTopic(const MessageSource &source, Channel *c) override
{ {
if (Servers::Capab.count("SVSTOPIC")) if (Servers::Capab.count("SVSTOPIC"))
{ {
UplinkSocket::Message(c->WhoSends()) << "SVSTOPIC " << c->name << " " << c->topic_ts << " " << c->topic_setter << " :" << c->topic; Uplink::Send(c->WhoSends(), "SVSTOPIC", c->name, c->topic_ts, c->topic_setter, c->topic);
} }
else else
{ {
@@ -220,7 +220,7 @@ public:
if (c->topic_time > ts) if (c->topic_time > ts)
ts = Anope::CurTime; ts = Anope::CurTime;
/* But don't modify c->topic_ts, it should remain set to the real TS we want as ci->last_topic_time pulls from it */ /* But don't modify c->topic_ts, it should remain set to the real TS we want as ci->last_topic_time pulls from it */
UplinkSocket::Message(source) << "FTOPIC " << c->name << " " << c->creation_time << " " << ts << " " << c->topic_setter << " :" << c->topic; Uplink::Send(source, "FTOPIC", c->name, c->creation_time, ts, c->topic_setter, c->topic);
} }
} }
@@ -312,17 +312,16 @@ public:
void SendClientIntroduction(User *u) override void SendClientIntroduction(User *u) override
{ {
Anope::string modes = "+" + u->GetModes(); Uplink::Send("UID", u->GetUID(), u->timestamp, u->nick, u->host, u->host, u->GetIdent(), "0.0.0.0", u->timestamp, "+" + u->GetModes(), u->realname);
UplinkSocket::Message(Me) << "UID " << u->GetUID() << " " << u->timestamp << " " << u->nick << " " << u->host << " " << u->host << " " << u->GetIdent() << " 0.0.0.0 " << u->timestamp << " " << modes << " :" << u->realname;
if (modes.find('o') != Anope::string::npos) if (u->GetModes().find('o') != Anope::string::npos)
{ {
// Mark as introduced so we can send an oper type. // Mark as introduced so we can send an oper type.
BotInfo *bi = BotInfo::Find(u->nick, true); BotInfo *bi = BotInfo::Find(u->nick, true);
if (bi) if (bi)
bi->introduced = true; bi->introduced = true;
UplinkSocket::Message(u) << "OPERTYPE :service"; Uplink::Send(u, "OPERTYPE", "service");
} }
} }
@@ -330,7 +329,7 @@ public:
{ {
/* if rsquit is set then we are waiting on a squit */ /* if rsquit is set then we are waiting on a squit */
if (rsquit_id.empty() && rsquit_server.empty()) if (rsquit_id.empty() && rsquit_server.empty())
UplinkSocket::Message() << "SERVER " << server->GetName() << " " << server->GetSID() << " :" << server->GetDescription(); Uplink::Send("SERVER", server->GetName(), server->GetSID(), server->GetDescription());
} }
void SendSquit(Server *s, const Anope::string &message) override void SendSquit(Server *s, const Anope::string &message) override
@@ -339,15 +338,15 @@ public:
{ {
rsquit_id = s->GetSID(); rsquit_id = s->GetSID();
rsquit_server = s->GetName(); rsquit_server = s->GetName();
UplinkSocket::Message() << "RSQUIT " << s->GetName() << " :" << message; Uplink::Send("RSQUIT", s->GetName(), message);
} }
else else
UplinkSocket::Message() << "SQUIT " << s->GetName() << " :" << message; Uplink::Send("SQUIT", s->GetName(), message);
} }
void SendJoin(User *user, Channel *c, const ChannelStatus *status) override void SendJoin(User *user, Channel *c, const ChannelStatus *status) override
{ {
UplinkSocket::Message(Me) << "FJOIN " << c->name << " " << c->creation_time << " +" << c->GetModes(true, true) << " :," << user->GetUID(); Uplink::Send("FJOIN", c->name, c->creation_time, "+" + c->GetModes(true, true), "," + user->GetUID());
/* Note that we can send this with the FJOIN but choose not to /* Note that we can send this with the FJOIN but choose not to
* because the mode stacker will handle this and probably will * because the mode stacker will handle this and probably will
* merge these modes with +nrt and other mlocked modes * merge these modes with +nrt and other mlocked modes
@@ -401,12 +400,12 @@ public:
void SendSVSHold(const Anope::string &nick, time_t t) override void SendSVSHold(const Anope::string &nick, time_t t) override
{ {
UplinkSocket::Message(Config->GetClient("NickServ")) << "SVSHOLD " << nick << " " << t << " :Being held for registered user"; Uplink::Send(Config->GetClient("NickServ"), "SVSHOLD", nick, t, "Being held for a registered user");
} }
void SendSVSHoldDel(const Anope::string &nick) override void SendSVSHoldDel(const Anope::string &nick) override
{ {
UplinkSocket::Message(Config->GetClient("NickServ")) << "SVSHOLD " << nick; Uplink::Send(Config->GetClient("NickServ"), "SVSHOLD", nick);
} }
void SendSZLineDel(const XLine *x) override void SendSZLineDel(const XLine *x) override
@@ -424,44 +423,44 @@ public:
void SendSVSJoin(const MessageSource &source, User *u, const Anope::string &chan, const Anope::string &other) override void SendSVSJoin(const MessageSource &source, User *u, const Anope::string &chan, const Anope::string &other) override
{ {
UplinkSocket::Message(source) << "SVSJOIN " << u->GetUID() << " " << chan; Uplink::Send(source, "SVSJOIN", u->GetUID(), chan);
} }
void SendSVSPart(const MessageSource &source, User *u, const Anope::string &chan, const Anope::string &param) override void SendSVSPart(const MessageSource &source, User *u, const Anope::string &chan, const Anope::string &param) override
{ {
if (!param.empty()) if (!param.empty())
UplinkSocket::Message(source) << "SVSPART " << u->GetUID() << " " << chan << " :" << param; Uplink::Send(source, "SVSPART", u->GetUID(), chan, param);
else else
UplinkSocket::Message(source) << "SVSPART " << u->GetUID() << " " << chan; Uplink::Send(source, "SVSPART", u->GetUID(), chan);
} }
void SendSWhois(const MessageSource &bi, const Anope::string &who, const Anope::string &mask) override void SendSWhois(const MessageSource &bi, const Anope::string &who, const Anope::string &mask) override
{ {
User *u = User::Find(who); User *u = User::Find(who);
Uplink::Send("METADATA", u->GetUID(), "swhois", mask);
UplinkSocket::Message(Me) << "METADATA " << u->GetUID() << " swhois :" << mask;
} }
void SendBOB() override void SendBOB() override
{ {
UplinkSocket::Message(Me) << "BURST " << Anope::CurTime; Uplink::Send("BURST", Anope::CurTime);
Module *enc = ModuleManager::FindFirstOf(ENCRYPTION); Module *enc = ModuleManager::FindFirstOf(ENCRYPTION);
UplinkSocket::Message(Me) << "SINFO version :Anope-" << Anope::Version() << " " << Me->GetName() << " :" << IRCD->GetProtocolName() << " - (" << (enc ? enc->name : "none") << ") -- " << Anope::VersionBuildString();
UplinkSocket::Message(Me) << "SINFO fullversion :Anope-" << Anope::Version() << " " << Me->GetName() << " :[" << Me->GetSID() << "] " << IRCD->GetProtocolName() << " - (" << (enc ? enc->name : "none") << ") -- " << Anope::VersionBuildString(); Uplink::Send("SINFO", "version", Anope::printf("Anope-%s %s :%s -- (%s) -- %s", Anope::Version().c_str(), Me->GetName().c_str(), IRCD->GetProtocolName().c_str(), enc ? enc->name.c_str() : "none", Anope::VersionBuildString().c_str()));
UplinkSocket::Message(Me) << "SINFO rawversion :Anope-" << Anope::VersionShort(); Uplink::Send("SINFO", "fullversion", Anope::printf("Anope-%s %s :[%s] %s -- (%s) -- %s", Anope::Version().c_str(), Me->GetName().c_str(), Me->GetSID().c_str(), IRCD->GetProtocolName().c_str(), enc ? enc->name.c_str() : "none", Anope::VersionBuildString().c_str()));
Uplink::Send("SINFO", "rawversion", "Anope-" + Anope::VersionShort());
} }
void SendEOB() override void SendEOB() override
{ {
UplinkSocket::Message(Me) << "ENDBURST"; Uplink::Send("ENDBURST");
} }
void SendGlobopsInternal(const MessageSource &source, const Anope::string &buf) override void SendGlobopsInternal(const MessageSource &source, const Anope::string &buf) override
{ {
if (Servers::Capab.count("GLOBOPS")) if (Servers::Capab.count("GLOBOPS"))
UplinkSocket::Message(source) << "SNONOTICE g :" << buf; Uplink::Send(source, "SNONOTICE", 'g', buf);
else else
UplinkSocket::Message(source) << "SNONOTICE A :" << buf; Uplink::Send(source, "SNONOTICE", "A", buf);
} }
void SendLogin(User *u, NickAlias *na) override void SendLogin(User *u, NickAlias *na) override
@@ -478,12 +477,15 @@ public:
void SendChannel(Channel *c) override void SendChannel(Channel *c) override
{ {
UplinkSocket::Message(Me) << "FJOIN " << c->name << " " << c->creation_time << " +" << c->GetModes(true, true) << " :"; Uplink::Send("FJOIN", c->name, c->creation_time, "+" + c->GetModes(true, true), "");
} }
void SendSASLMessage(const SASL::Message &message) override void SendSASLMessage(const SASL::Message &message) override
{ {
UplinkSocket::Message(Me) << "ENCAP " << message.target.substr(0, 3) << " SASL " << message.source << " " << message.target << " " << message.type << " " << message.data << (message.ext.empty() ? "" : (" " + message.ext)); if (message.ext.empty())
Uplink::Send("ENCAP", message.target.substr(0, 3), "SASL", message.source, message.target, message.type, message.data);
else
Uplink::Send("ENCAP", message.target.substr(0, 3), "SASL", message.source, message.target, message.type, message.data, message.ext);
} }
void SendSVSLogin(const Anope::string &uid, NickAlias *na) override void SendSVSLogin(const Anope::string &uid, NickAlias *na) override
@@ -503,9 +505,10 @@ public:
if (na) if (na)
{ {
if (!na->GetVhostIdent().empty()) if (!na->GetVhostIdent().empty())
UplinkSocket::Message(Me) << "ENCAP " << uid.substr(0, 3) << " CHGIDENT " << uid << " " << na->GetVhostIdent(); Uplink::Send("ENCAP", uid.substr(0, 3), "CHGIDENT", uid, na->GetVhostIdent());
if (!na->GetVhostHost().empty()) if (!na->GetVhostHost().empty())
UplinkSocket::Message(Me) << "ENCAP " << uid.substr(0, 3) << " CHGHOST " << uid << " " << na->GetVhostHost(); Uplink::Send("ENCAP", uid.substr(0, 3), "CHGHOST", uid, na->GetVhostHost());
// Mark this SASL session as pending user introduction. // Mark this SASL session as pending user introduction.
SASLUser su; SASLUser su;
@@ -930,7 +933,7 @@ struct IRCDMessageCapab final
if (spanningtree_proto_ver < 1205) if (spanningtree_proto_ver < 1205)
{ {
UplinkSocket::Message() << "ERROR :Protocol mismatch, no or invalid protocol version given in CAPAB START"; Uplink::Send("ERROR", "Protocol mismatch, no or invalid protocol version given in CAPAB START.");
Anope::QuitReason = "Protocol mismatch, no or invalid protocol version given in CAPAB START"; Anope::QuitReason = "Protocol mismatch, no or invalid protocol version given in CAPAB START";
Anope::Quitting = true; Anope::Quitting = true;
return; return;
@@ -1222,14 +1225,14 @@ struct IRCDMessageCapab final
{ {
if (!Servers::Capab.count("SERVICES")) if (!Servers::Capab.count("SERVICES"))
{ {
UplinkSocket::Message() << "ERROR :The services_account module is not loaded. This is required by Anope"; Uplink::Send("ERROR", "The services_account module is not loaded. This is required by Anope.");
Anope::QuitReason = "ERROR: Remote server does not have the services_account module loaded, and this is required."; Anope::QuitReason = "ERROR: Remote server does not have the services_account module loaded, and this is required.";
Anope::Quitting = true; Anope::Quitting = true;
return; return;
} }
if (!ModeManager::FindUserModeByName("PRIV")) if (!ModeManager::FindUserModeByName("PRIV"))
{ {
UplinkSocket::Message() << "ERROR :The hidechans module is not loaded. This is required by Anope"; Uplink::Send("ERROR", "The hidechans module is not loaded. This is required by Anope.");
Anope::QuitReason = "ERROR: Remote server does not have the hidechans module loaded, and this is required."; Anope::QuitReason = "ERROR: Remote server does not have the hidechans module loaded, and this is required.";
Anope::Quitting = true; Anope::Quitting = true;
return; return;
@@ -1263,7 +1266,7 @@ struct IRCDMessageEncap final
return; return;
u->SetIdent(params[3]); u->SetIdent(params[3]);
UplinkSocket::Message(u) << "FIDENT :" << params[3]; Uplink::Send(u, "FIDENT", params[3]);
} }
else if (params[1] == "CHGHOST") else if (params[1] == "CHGHOST")
{ {
@@ -1272,7 +1275,7 @@ struct IRCDMessageEncap final
return; return;
u->SetDisplayedHost(params[3]); u->SetDisplayedHost(params[3]);
UplinkSocket::Message(u) << "FHOST :" << params[3]; Uplink::Send(u, "FHOST", params[3]);
} }
else if (params[1] == "CHGNAME") else if (params[1] == "CHGNAME")
{ {
@@ -1281,7 +1284,7 @@ struct IRCDMessageEncap final
return; return;
u->SetRealname(params[3]); u->SetRealname(params[3]);
UplinkSocket::Message(u) << "FNAME :" << params[3]; Uplink::Send(u, "FNAME", params[3]);
} }
else if (SASL::sasl && params[1] == "SASL" && params.size() >= 6) else if (SASL::sasl && params[1] == "SASL" && params.size() >= 6)
{ {
@@ -1412,14 +1415,14 @@ public:
// Mode lock string is not what we say it is? // Mode lock string is not what we say it is?
if (modes != params[3]) if (modes != params[3])
UplinkSocket::Message(Me) << "METADATA " << c->name << " " << c->creation_time << " mlock :" << modes; Uplink::Send("METADATA", c->name, c->creation_time, "mlock", modes);
} }
else if ((c->ci) && (do_topiclock) && (params[2] == "topiclock")) else if ((c->ci) && (do_topiclock) && (params[2] == "topiclock"))
{ {
bool mystate = c->ci->HasExt("TOPICLOCK"); bool mystate = c->ci->HasExt("TOPICLOCK");
bool serverstate = (params[3] == "1"); bool serverstate = (params[3] == "1");
if (mystate != serverstate) if (mystate != serverstate)
UplinkSocket::Message(Me) << "METADATA " << c->name << " " << c->creation_time << " topiclock :" << (mystate ? "1" : ""); Uplink::Send("METADATA", c->name, c->creation_time, "topiclock", !!mystate);
} }
else if (params[2] == "maxlist") else if (params[2] == "maxlist")
{ {
@@ -1665,12 +1668,12 @@ struct IRCDMessageIdle final
{ {
BotInfo *bi = BotInfo::Find(params[0]); BotInfo *bi = BotInfo::Find(params[0]);
if (bi) if (bi)
UplinkSocket::Message(bi) << "IDLE " << source.GetSource() << " " << Anope::StartTime << " " << (Anope::CurTime - bi->lastmsg); Uplink::Send(bi, "IDLE", source.GetSource(), Anope::StartTime, Anope::CurTime - bi->lastmsg);
else else
{ {
User *u = User::Find(params[0]); User *u = User::Find(params[0]);
if (u && u->server == Me) if (u && u->server == Me)
UplinkSocket::Message(u) << "IDLE " << source.GetSource() << " " << Anope::StartTime << " 0"; Uplink::Send(u, "IDLE", source.GetSource(), Anope::StartTime, 0);
} }
} }
}; };
@@ -1688,7 +1691,7 @@ struct IRCDMessageIJoin final
{ {
// When receiving an IJOIN, first check if the target channel exists. If it does not exist, // When receiving an IJOIN, first check if the target channel exists. If it does not exist,
// ignore the join (that is, do not create the channel) and send a RESYNC back to the source. // ignore the join (that is, do not create the channel) and send a RESYNC back to the source.
UplinkSocket::Message(Me) << "RESYNC :" << params[0]; Uplink::Send("RESYNC", params[0]);
return; return;
} }
@@ -1793,7 +1796,7 @@ struct IRCDMessageRSQuit final
if (!s) if (!s)
return; return;
UplinkSocket::Message(Me) << "SQUIT " << s->GetSID() << " :" << reason; Uplink::Send("SQUIT", s->GetSID(), reason);
s->Delete(s->GetName() + " " + s->GetUplink()->GetName()); s->Delete(s->GetName() + " " + s->GetUplink()->GetName());
} }
}; };
@@ -1862,7 +1865,7 @@ struct IRCDMessageTime final
void Run(MessageSource &source, const std::vector<Anope::string> &params, const Anope::map<Anope::string> &tags) override void Run(MessageSource &source, const std::vector<Anope::string> &params, const Anope::map<Anope::string> &tags) override
{ {
UplinkSocket::Message(Me) << "TIME " << source.GetSource() << " " << params[1] << " " << Anope::CurTime; Uplink::Send("TIME", source.GetSource(), params[1], Anope::CurTime);
} }
}; };
@@ -1961,7 +1964,7 @@ class ProtoInspIRCd final
void SendChannelMetadata(Channel *c, const Anope::string &metadataname, const Anope::string &value) void SendChannelMetadata(Channel *c, const Anope::string &metadataname, const Anope::string &value)
{ {
UplinkSocket::Message(Me) << "METADATA " << c->name << " " << c->creation_time << " " << metadataname << " :" << value; Uplink::Send("METADATA", c->name, c->creation_time, metadataname, value);
} }
public: public:
+17 -16
View File
@@ -35,58 +35,59 @@ public:
{ {
// Calculate the time left before this would expire // Calculate the time left before this would expire
time_t timeleft = x->expires ? x->expires - Anope::CurTime : x->expires; time_t timeleft = x->expires ? x->expires - Anope::CurTime : x->expires;
UplinkSocket::Message(Me) << "GLINE " << x->mask << " " << timeleft << " :" << x->GetReason() << " (" << x->by << ")"; Uplink::Send("GLINE", x->mask, timeleft, x->GetReason() + " (" + x->by + ")");
} }
void SendAkillDel(const XLine *x) override void SendAkillDel(const XLine *x) override
{ {
UplinkSocket::Message(Me) << "GLINE " << x->mask; Uplink::Send("GLINE", x->mask);
} }
void SendChannel(Channel *c) override void SendChannel(Channel *c) override
{ {
UplinkSocket::Message(Me) << "CHANINFO " << c->name << " +" << c->GetModes(true, true); Uplink::Send("CHANINFO", c->name, "+" + c->GetModes(true, true));
} }
// Received: :dev.anope.de NICK DukeP 1 ~DukePyro p57ABF9C9.dip.t-dialin.net 1 +i :DukePyrolator // Received: :dev.anope.de NICK DukeP 1 ~DukePyro p57ABF9C9.dip.t-dialin.net 1 +i :DukePyrolator
void SendClientIntroduction(User *u) override void SendClientIntroduction(User *u) override
{ {
Anope::string modes = "+" + u->GetModes(); Uplink::Send("NICK", u->nick, 1, u->GetIdent(), u->host, 1, "+" + u->GetModes(), u->realname);
UplinkSocket::Message(Me) << "NICK " << u->nick << " 1 " << u->GetIdent() << " " << u->host << " 1 " << modes << " :" << u->realname;
} }
void SendConnect() override void SendConnect() override
{ {
UplinkSocket::Message() << "PASS " << Config->Uplinks[Anope::CurrentUplink].password << " 0210-IRC+ Anope|" << Anope::VersionShort() << ":CLHMSo P"; Uplink::Send("PASS", Config->Uplinks[Anope::CurrentUplink].password, "0210-IRC+", "Anope|" + Anope::VersionShort(), "CLHMSo P");
/* Make myself known to myself in the serverlist */ /* Make myself known to myself in the serverlist */
SendServer(Me); SendServer(Me);
/* finish the enhanced server handshake and register the connection */ /* finish the enhanced server handshake and register the connection */
this->SendNumeric(376, "*", "End of MOTD command"); this->SendNumeric(376, "*", "End of MOTD command");
} }
void SendForceNickChange(User *u, const Anope::string &newnick, time_t when) override void SendForceNickChange(User *u, const Anope::string &newnick, time_t when) override
{ {
UplinkSocket::Message(Me) << "SVSNICK " << u->nick << " " << newnick; Uplink::Send("SVSNICK", u->nick, newnick);
} }
void SendGlobalNotice(BotInfo *bi, const Server *dest, const Anope::string &msg) override void SendGlobalNotice(BotInfo *bi, const Server *dest, const Anope::string &msg) override
{ {
UplinkSocket::Message(bi) << "NOTICE $" << dest->GetName() << " :" << msg; Uplink::Send(bi, "NOTICE", "$" + dest->GetName(), msg);
} }
void SendGlobalPrivmsg(BotInfo *bi, const Server *dest, const Anope::string &msg) override void SendGlobalPrivmsg(BotInfo *bi, const Server *dest, const Anope::string &msg) override
{ {
UplinkSocket::Message(bi) << "PRIVMSG $" << dest->GetName() << " :" << msg; Uplink::Send(bi, "PRIVMSG", "$" + dest->GetName(), msg);
} }
void SendGlobopsInternal(const MessageSource &source, const Anope::string &buf) override void SendGlobopsInternal(const MessageSource &source, const Anope::string &buf) override
{ {
UplinkSocket::Message(source) << "WALLOPS :" << buf; Uplink::Send(source, "WALLOPS", buf);
} }
void SendJoin(User *user, Channel *c, const ChannelStatus *status) override void SendJoin(User *user, Channel *c, const ChannelStatus *status) override
{ {
UplinkSocket::Message(user) << "JOIN " << c->name; Uplink::Send(user, "JOIN", c->name);
if (status) if (status)
{ {
/* First save the channel status incase uc->Status == status */ /* First save the channel status incase uc->Status == status */
@@ -109,26 +110,26 @@ public:
void SendLogin(User *u, NickAlias *na) override void SendLogin(User *u, NickAlias *na) override
{ {
UplinkSocket::Message(Me) << "METADATA " << u->GetUID() << " accountname :" << na->nc->display; Uplink::Send("METADATA", u->GetUID(), "accountname", na->nc->display);
} }
void SendLogout(User *u) override void SendLogout(User *u) override
{ {
UplinkSocket::Message(Me) << "METADATA " << u->GetUID() << " accountname :"; Uplink::Send("METADATA", u->GetUID(), "accountname", "");
} }
/* SERVER name hop descript */ /* SERVER name hop descript */
void SendServer(const Server *server) override void SendServer(const Server *server) override
{ {
UplinkSocket::Message() << "SERVER " << server->GetName() << " " << server->GetHops() << " :" << server->GetDescription(); Uplink::Send("SERVER", server->GetName(), server->GetHops(), server->GetDescription());
} }
void SendVhost(User *u, const Anope::string &vIdent, const Anope::string &vhost) override void SendVhost(User *u, const Anope::string &vIdent, const Anope::string &vhost) override
{ {
if (!vIdent.empty()) if (!vIdent.empty())
UplinkSocket::Message(Me) << "METADATA " << u->nick << " user :" << vIdent; Uplink::Send("METADATA", u->nick, "user", vIdent);
UplinkSocket::Message(Me) << "METADATA " << u->nick << " cloakhost :" << vhost; Uplink::Send("METADATA", u->nick, "cloakhost", vhost);
if (!u->HasMode("CLOAK")) if (!u->HasMode("CLOAK"))
{ {
u->SetMode(Config->GetClient("HostServ"), "CLOAK"); u->SetMode(Config->GetClient("HostServ"), "CLOAK");
+24 -19
View File
@@ -52,12 +52,12 @@ public:
void SendGlobopsInternal(const MessageSource &source, const Anope::string &buf) override void SendGlobopsInternal(const MessageSource &source, const Anope::string &buf) override
{ {
UplinkSocket::Message(source) << "OPERWALL :" << buf; Uplink::Send(source, "OPERWALL", buf);
} }
void SendJoin(User *user, Channel *c, const ChannelStatus *status) override void SendJoin(User *user, Channel *c, const ChannelStatus *status) override
{ {
UplinkSocket::Message(Me) << "SJOIN " << c->creation_time << " " << c->name << " +" << c->GetModes(true, true) << " :" << user->GetUID(); Uplink::Send("SJOIN", c->creation_time, c->name, "+" + c->GetModes(true, true), user->GetUID());
if (status) if (status)
{ {
/* First save the channel status incase uc->Status == status */ /* First save the channel status incase uc->Status == status */
@@ -80,14 +80,15 @@ public:
void SendForceNickChange(User *u, const Anope::string &newnick, time_t when) override void SendForceNickChange(User *u, const Anope::string &newnick, time_t when) override
{ {
UplinkSocket::Message(Me) << "ENCAP " << u->server->GetName() << " SVSNICK " << u->GetUID() << " " << u->timestamp << " " << newnick << " " << when; Uplink::Send("ENCAP", u->server->GetName(), "SVSNICK", u->GetUID(), u->timestamp, newnick, when);
} }
void SendVhost(User *u, const Anope::string &ident, const Anope::string &host) override void SendVhost(User *u, const Anope::string &ident, const Anope::string &host) override
{ {
if (!ident.empty()) if (!ident.empty())
UplinkSocket::Message(Me) << "ENCAP * CHGIDENT " << u->GetUID() << " " << ident; Uplink::Send("ENCAP", '*', "CHGIDENT", u->GetUID(), ident);
UplinkSocket::Message(Me) << "ENCAP * CHGHOST " << u->GetUID() << " " << host;
Uplink::Send("ENCAP", '*', "CHGHOST", u->GetUID(), host);
u->SetMode(Config->GetClient("HostServ"), "CLOAK"); u->SetMode(Config->GetClient("HostServ"), "CLOAK");
} }
@@ -98,7 +99,8 @@ public:
void SendConnect() override void SendConnect() override
{ {
UplinkSocket::Message() << "PASS " << Config->Uplinks[Anope::CurrentUplink].password << " TS 6 :" << Me->GetSID(); Uplink::Send("PASS", Config->Uplinks[Anope::CurrentUplink].password, "TS", 6, Me->GetSID());
/* CAPAB /* CAPAB
* QS - Can handle quit storm removal * QS - Can handle quit storm removal
* EX - Can do channel +e exemptions * EX - Can do channel +e exemptions
@@ -119,7 +121,8 @@ public:
* ENCAP - Supports encapsulation of protocol messages * ENCAP - Supports encapsulation of protocol messages
* SVS - Supports services protocol extensions * SVS - Supports services protocol extensions
*/ */
UplinkSocket::Message() << "CAPAB :QS EX CHW IE EOB KLN UNKLN GLN HUB KNOCK TBURST PARA ENCAP SVS"; Uplink::Send("CAPAB", "QS EX CHW IE EOB KLN UNKLN GLN HUB KNOCK TBURST PARA ENCAP SVS");
/* Make myself known to myself in the serverlist */ /* Make myself known to myself in the serverlist */
SendServer(Me); SendServer(Me);
/* /*
@@ -130,13 +133,12 @@ public:
* parv[3] = server is standalone or connected to non-TS only * parv[3] = server is standalone or connected to non-TS only
* parv[4] = server's idea of UTC time * parv[4] = server's idea of UTC time
*/ */
UplinkSocket::Message() << "SVINFO 6 5 0 :" << Anope::CurTime; Uplink::Send("SVINFO", 6, 5, 0, Anope::CurTime);
} }
void SendClientIntroduction(User *u) override void SendClientIntroduction(User *u) override
{ {
Anope::string modes = "+" + u->GetModes(); Uplink::Send("UID", u->nick, 1, u->timestamp, "+" + u->GetModes(), u->GetIdent(), u->host, "255.255.255.255", u->GetUID(), 0, u->host, u->realname);
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 &modes, const std::vector<Anope::string> &values) override void SendModeInternal(const MessageSource &source, User* u, const Anope::string &modes, const std::vector<Anope::string> &values) override
@@ -148,45 +150,48 @@ public:
void SendLogin(User *u, NickAlias *na) override void SendLogin(User *u, NickAlias *na) override
{ {
UplinkSocket::Message(Me) << "ENCAP * SU " << u->GetUID() << " " << na->nc->display; Uplink::Send("ENCAP", '*', "SU", u->GetUID(), na->nc->display);
} }
void SendLogout(User *u) override void SendLogout(User *u) override
{ {
UplinkSocket::Message(Me) << "ENCAP * SU " << u->GetUID(); Uplink::Send("ENCAP", '*', "SU", u->GetUID());
} }
void SendTopic(const MessageSource &source, Channel *c) override void SendTopic(const MessageSource &source, Channel *c) override
{ {
UplinkSocket::Message(source) << "ENCAP * TOPIC " << c->name << " " << c->topic_setter << " " << c->topic_ts << " :" << c->topic; Uplink::Send(source, "ENCAP", '*', "TOPIC", c->name, c->topic_setter, c->topic_ts, c->topic);
} }
void SendSVSJoin(const MessageSource &source, User *user, const Anope::string &chan, const Anope::string &param) override void SendSVSJoin(const MessageSource &source, User *user, const Anope::string &chan, const Anope::string &param) override
{ {
UplinkSocket::Message(source) << "ENCAP " << user->server->GetName() << " SVSJOIN " << user->GetUID() << " " << chan; Uplink::Send(source, "ENCAP", '*', "SVSJOIN", user->GetUID(), chan);
} }
void SendSVSPart(const MessageSource &source, User *user, const Anope::string &chan, const Anope::string &param) override void SendSVSPart(const MessageSource &source, User *user, const Anope::string &chan, const Anope::string &param) override
{ {
UplinkSocket::Message(source) << "ENCAP " << user->server->GetName() << " SVSPART " << user->GetUID() << " " << chan; Uplink::Send(source, "ENCAP", '*', "SVSPART", user->GetUID(), chan);
} }
void SendSASLMessage(const SASL::Message &message) override void SendSASLMessage(const SASL::Message &message) override
{ {
Server *s = Server::Find(message.target.substr(0, 3)); Server *s = Server::Find(message.target.substr(0, 3));
UplinkSocket::Message(Me) << "ENCAP " << (s ? s->GetName() : message.target.substr(0, 3)) << " SASL " << message.source << " " << message.target << " " << message.type << " " << message.data << (message.ext.empty() ? "" : (" " + message.ext)); auto target = s ? s->GetName() : message.target.substr(0, 3);
if (message.ext.empty())
Uplink::Send("ENCAP", target, "SASL", message.source, message.target, message.type, message.data);
else
Uplink::Send("ENCAP", target, "SASL", message.source, message.target, message.type, message.data, message.ext);
} }
void SendSVSLogin(const Anope::string &uid, NickAlias *na) override void SendSVSLogin(const Anope::string &uid, NickAlias *na) override
{ {
Server *s = Server::Find(uid.substr(0, 3)); Server *s = Server::Find(uid.substr(0, 3));
UplinkSocket::Message(Me) << "ENCAP " << (s ? s->GetName() : uid.substr(0, 3)) << " SVSLOGIN " << uid << " * * " Uplink::Send("ENCAP", s ? s->GetName() : uid.substr(0, 3), "SVSLOGIN", uid, '*', '*', na->GetVhostHost().empty() ? "*" : na->GetVhostHost(), na->nc->display);
<< (na->GetVhostHost().empty() ? "*" : na->GetVhostHost()) << " " << na->nc->display;
} }
void SendSVSNOOP(const Server *server, bool set) override void SendSVSNOOP(const Server *server, bool set) override
{ {
UplinkSocket::Message() << "ENCAP " << server->GetName() << " SVSNOOP " << (set ? "+" : "-"); Uplink::Send("ENCAP", '*', "SVSNOOP", set ? '+' : '-');
} }
}; };
+12 -11
View File
@@ -59,25 +59,25 @@ public:
void SendGlobopsInternal(const MessageSource &source, const Anope::string &buf) override void SendGlobopsInternal(const MessageSource &source, const Anope::string &buf) override
{ {
UplinkSocket::Message(source) << "OPERWALL :" << buf; Uplink::Send(source, "OPERWALL", buf);
} }
void SendSQLine(User *, const XLine *x) override void SendSQLine(User *, const XLine *x) override
{ {
// Calculate the time left before this would expire // Calculate the time left before this would expire
time_t timeleft = x->expires ? x->expires - Anope::CurTime : x->expires; time_t timeleft = x->expires ? x->expires - Anope::CurTime : x->expires;
Uplink::Send("ENCAP", '*', "RESV", timeleft, x->mask, 0, x->GetReason());
UplinkSocket::Message(FindIntroduced()) << "ENCAP * RESV " << timeleft << " " << x->mask << " 0 :" << x->GetReason();
} }
void SendSQLineDel(const XLine *x) override void SendSQLineDel(const XLine *x) override
{ {
UplinkSocket::Message(Config->GetClient("OperServ")) << "ENCAP * UNRESV " << x->mask; Uplink::Send(Config->GetClient("OperServ"), "ENCAP", '*', "UNRESV", x->mask);
} }
void SendConnect() override void SendConnect() override
{ {
UplinkSocket::Message() << "PASS " << Config->Uplinks[Anope::CurrentUplink].password << " TS 6 :" << Me->GetSID(); Uplink::Send("PASS", Config->Uplinks[Anope::CurrentUplink].password, "TS", 6, Me->GetSID());
/* /*
QS - Can handle quit storm removal QS - Can handle quit storm removal
EX - Can do channel +e exemptions EX - Can do channel +e exemptions
@@ -88,9 +88,11 @@ public:
TB - supports topic burst TB - supports topic burst
ENCAP - supports ENCAP ENCAP - supports ENCAP
*/ */
UplinkSocket::Message() << "CAPAB :QS EX CHW IE GLN TB ENCAP"; Uplink::Send("CAPAB", "QS EX CHW IE GLN TB ENCAP");
/* Make myself known to myself in the serverlist */ /* Make myself known to myself in the serverlist */
SendServer(Me); SendServer(Me);
/* /*
* SVINFO * SVINFO
* parv[0] = sender prefix * parv[0] = sender prefix
@@ -99,13 +101,12 @@ public:
* parv[3] = server is standalone or connected to non-TS only * parv[3] = server is standalone or connected to non-TS only
* parv[4] = server's idea of UTC time * parv[4] = server's idea of UTC time
*/ */
UplinkSocket::Message() << "SVINFO 6 3 0 :" << Anope::CurTime; Uplink::Send("SVINFO", 6, 3, 0, Anope::CurTime);
} }
void SendClientIntroduction(User *u) override void SendClientIntroduction(User *u) override
{ {
Anope::string modes = "+" + u->GetModes(); Uplink::Send("UID", u->nick, 1, u->timestamp, "+" + u->GetModes(), u->GetIdent(), u->host, 0, u->GetUID(), u->realname);
UplinkSocket::Message(Me) << "UID " << u->nick << " 1 " << u->timestamp << " " << modes << " " << u->GetIdent() << " " << u->host << " 0 " << u->GetUID() << " :" << u->realname;
} }
void SendLogin(User *u, NickAlias *na) override void SendLogin(User *u, NickAlias *na) override
@@ -113,12 +114,12 @@ public:
if (na->nc->HasExt("UNCONFIRMED")) if (na->nc->HasExt("UNCONFIRMED"))
return; return;
UplinkSocket::Message(Me) << "ENCAP * SU " << u->GetUID() << " " << na->nc->display; Uplink::Send("ENCAP", '*', "SU", u->GetUID(), na->nc->display);
} }
void SendLogout(User *u) override void SendLogout(User *u) override
{ {
UplinkSocket::Message(Me) << "ENCAP * SU " << u->GetUID(); Uplink::Send("ENCAP", '*', "SU", u->GetUID());
} }
void SendTopic(const MessageSource &source, Channel *c) override void SendTopic(const MessageSource &source, Channel *c) override
+27 -26
View File
@@ -75,12 +75,13 @@ public:
for (const auto &mechanism : mechanisms) for (const auto &mechanism : mechanisms)
mechlist += "," + mechanism; mechlist += "," + mechanism;
UplinkSocket::Message(Me) << "ENCAP * MECHLIST :" << (mechanisms.empty() ? "" : mechlist.substr(1)); Uplink::Send("ENCAP", '*', "MECHLIST", mechanisms.empty() ? "" : mechlist.substr(1));
} }
void SendConnect() override void SendConnect() override
{ {
UplinkSocket::Message() << "PASS " << Config->Uplinks[Anope::CurrentUplink].password << " TS 6 :" << Me->GetSID(); Uplink::Send("PASS", Config->Uplinks[Anope::CurrentUplink].password, "TS", 6, Me->GetSID());
/* /*
* Received: CAPAB :BAN CHW CLUSTER ENCAP EOPMOD EUID EX IE KLN * Received: CAPAB :BAN CHW CLUSTER ENCAP EOPMOD EUID EX IE KLN
* KNOCK MLOCK QS RSFNC SAVE SERVICES TB UNKLN * KNOCK MLOCK QS RSFNC SAVE SERVICES TB UNKLN
@@ -105,7 +106,7 @@ public:
* UNKLN - Can do UNKLINE (encap only) * UNKLN - Can do UNKLINE (encap only)
* QS - Can handle quit storm removal * QS - Can handle quit storm removal
*/ */
UplinkSocket::Message() << "CAPAB :BAN CHW CLUSTER ECHO ENCAP EOPMOD EUID EX IE KLN KNOCK MLOCK QS RSFNC SERVICES TB UNKLN"; Uplink::Send("CAPAB", "BAN CHW CLUSTER ECHO ENCAP EOPMOD EUID EX IE KLN KNOCK MLOCK QS RSFNC SERVICES TB UNKLN");
/* Make myself known to myself in the serverlist */ /* Make myself known to myself in the serverlist */
SendServer(Me); SendServer(Me);
@@ -117,34 +118,32 @@ public:
* arg[2] = '0' * arg[2] = '0'
* arg[3] = server's idea of UTC time * arg[3] = server's idea of UTC time
*/ */
UplinkSocket::Message() << "SVINFO 6 6 0 :" << Anope::CurTime; Uplink::Send("SVINFO", 6, 6, 0, Anope::CurTime);
} }
void SendClientIntroduction(User *u) override void SendClientIntroduction(User *u) override
{ {
Anope::string modes = "+" + u->GetModes(); Uplink::Send("EUID", u->nick, 1, u->timestamp, "+" + u->GetModes(), u->GetIdent(), u->host, 0, u->GetUID(), '*', '*', u->realname);
UplinkSocket::Message(Me) << "EUID " << u->nick << " 1 " << u->timestamp << " " << modes << " " << u->GetIdent() << " " << u->host << " 0 " << u->GetUID() << " * * :" << u->realname;
} }
void SendForceNickChange(User *u, const Anope::string &newnick, time_t when) override void SendForceNickChange(User *u, const Anope::string &newnick, time_t when) override
{ {
UplinkSocket::Message(Me) << "ENCAP " << u->server->GetName() << " RSFNC " << u->GetUID() Uplink::Send("ENCAP", u->server->GetName(), "RSFNC", u->GetUID(), newnick, when, u->timestamp);
<< " " << newnick << " " << when << " " << u->timestamp;
} }
void SendSVSHold(const Anope::string &nick, time_t delay) override void SendSVSHold(const Anope::string &nick, time_t delay) override
{ {
UplinkSocket::Message(Me) << "ENCAP * NICKDELAY " << delay << " " << nick; Uplink::Send("ENCAP", '*', "NICKDELAY", delay, nick);
} }
void SendSVSHoldDel(const Anope::string &nick) override void SendSVSHoldDel(const Anope::string &nick) override
{ {
UplinkSocket::Message(Me) << "ENCAP * NICKDELAY 0 " << nick; Uplink::Send("ENCAP", '*', "NICKDELAY", 0, nick);
} }
void SendVhost(User *u, const Anope::string &ident, const Anope::string &host) override void SendVhost(User *u, const Anope::string &ident, const Anope::string &host) override
{ {
UplinkSocket::Message(Me) << "ENCAP * CHGHOST " << u->GetUID() << " :" << host; Uplink::Send("ENCAP", '*', "CHGHOST", u->GetUID(), host);
} }
void SendVhostDel(User *u) override void SendVhostDel(User *u) override
@@ -155,19 +154,21 @@ public:
void SendSASLMessage(const SASL::Message &message) override void SendSASLMessage(const SASL::Message &message) override
{ {
Server *s = Server::Find(message.target.substr(0, 3)); Server *s = Server::Find(message.target.substr(0, 3));
UplinkSocket::Message(Me) << "ENCAP " << (s ? s->GetName() : message.target.substr(0, 3)) << " SASL " << message.source << " " << message.target << " " << message.type << " " << message.data << (message.ext.empty() ? "" : (" " + message.ext)); auto target = s ? s->GetName() : message.target.substr(0, 3);
if (message.ext.empty())
Uplink::Send("ENCAP", target, "SASL", message.source, message.target, message.type, message.data);
else
Uplink::Send("ENCAP", target, "SASL", message.source, message.target, message.type, message.data, message.ext);
} }
void SendSVSLogin(const Anope::string &uid, NickAlias *na) override void SendSVSLogin(const Anope::string &uid, NickAlias *na) override
{ {
Server *s = Server::Find(uid.substr(0, 3)); Server *s = Server::Find(uid.substr(0, 3));
UplinkSocket::Message(Me) << "ENCAP " << (s ? s->GetName() : uid.substr(0, 3)) << " SVSLOGIN " << uid << " * " Uplink::Send("ENCAP", s ? s->GetName() : uid.substr(0, 3), "SVSLOGIN", uid, '*',
<< (na && !na->GetVhostIdent().empty() ? na->GetVhostIdent() : '*') na && !na->GetVhostIdent().empty() ? na->GetVhostIdent() : '*',
<< " " na && !na->GetVhostHost().empty() ? na->GetVhostHost() : '*',
<< (na && !na->GetVhostHost().empty() ? na->GetVhostHost() : '*') na ? na->nc->display : "0");
<< " "
<< (na ? na->nc->display : "0");
} }
}; };
@@ -295,7 +296,7 @@ struct IRCDMessageNotice final
void Run(MessageSource &source, const std::vector<Anope::string> &params, const Anope::map<Anope::string> &tags) override void Run(MessageSource &source, const std::vector<Anope::string> &params, const Anope::map<Anope::string> &tags) override
{ {
if (Servers::Capab.count("ECHO")) if (Servers::Capab.count("ECHO"))
UplinkSocket::Message(Me) << "ECHO N " << source.GetSource() << " :" << params[1]; Uplink::Send("ECHO", 'N', source.GetSource(), params[1]);
Message::Notice::Run(source, params, tags); Message::Notice::Run(source, params, tags);
} }
@@ -309,7 +310,7 @@ struct IRCDMessagePrivmsg final
void Run(MessageSource &source, const std::vector<Anope::string> &params, const Anope::map<Anope::string> &tags) override void Run(MessageSource &source, const std::vector<Anope::string> &params, const Anope::map<Anope::string> &tags) override
{ {
if (Servers::Capab.count("ECHO")) if (Servers::Capab.count("ECHO"))
UplinkSocket::Message(Me) << "ECHO P " << source.GetSource() << " :" << params[1]; Uplink::Send("ECHO", 'P', source.GetSource(), params[1]);
Message::Privmsg::Run(source, params, tags); Message::Privmsg::Run(source, params, tags);
} }
@@ -424,15 +425,15 @@ public:
// If the user has logged into their current nickname then mark them as such. // If the user has logged into their current nickname then mark them as such.
NickAlias *na = NickAlias::Find(u->nick); NickAlias *na = NickAlias::Find(u->nick);
if (na && na->nc == u->Account()) if (na && na->nc == u->Account())
UplinkSocket::Message(Me) << "ENCAP * IDENTIFIED " << u->GetUID() << " " << u->nick; Uplink::Send("ENCAP", '*', "IDENTIFIED", u->GetUID(), u->nick);
else else
UplinkSocket::Message(Me) << "ENCAP * IDENTIFIED " << u->GetUID() << " " << u->nick << " OFF"; Uplink::Send("ENCAP", '*', "IDENTIFIED", u->GetUID(), u->nick, "OFF");
} }
void OnNickLogout(User *u) override void OnNickLogout(User *u) override
{ {
// We don't know what account the user was logged into so send in all cases. // We don't know what account the user was logged into so send in all cases.
UplinkSocket::Message(Me) << "ENCAP * IDENTIFIED " << u->GetUID() << " " << u->nick << " OFF"; Uplink::Send("ENCAP", '*', "IDENTIFIED", u->GetUID(), u->nick, "OFF");
} }
void OnUserNickChange(User *u, const Anope::string &) override void OnUserNickChange(User *u, const Anope::string &) override
@@ -457,7 +458,7 @@ public:
if (use_server_side_mlock && modelocks && Servers::Capab.count("MLOCK") > 0) if (use_server_side_mlock && modelocks && Servers::Capab.count("MLOCK") > 0)
{ {
Anope::string modes = modelocks->GetMLockAsString(false).replace_all_cs("+", "").replace_all_cs("-", ""); Anope::string modes = modelocks->GetMLockAsString(false).replace_all_cs("+", "").replace_all_cs("-", "");
UplinkSocket::Message(Me) << "MLOCK " << static_cast<long>(c->creation_time) << " " << c->ci->name << " " << modes; Uplink::Send("MLOCK", c->creation_time, c->ci->name, modes);
} }
} }
@@ -468,7 +469,7 @@ public:
if (use_server_side_mlock && cm && ci->c && modelocks && (cm->type == MODE_REGULAR || cm->type == MODE_PARAM) && Servers::Capab.count("MLOCK") > 0) if (use_server_side_mlock && cm && ci->c && modelocks && (cm->type == MODE_REGULAR || cm->type == MODE_PARAM) && Servers::Capab.count("MLOCK") > 0)
{ {
Anope::string modes = modelocks->GetMLockAsString(false).replace_all_cs("+", "").replace_all_cs("-", "") + cm->mchar; Anope::string modes = modelocks->GetMLockAsString(false).replace_all_cs("+", "").replace_all_cs("-", "") + cm->mchar;
UplinkSocket::Message(Me) << "MLOCK " << static_cast<long>(ci->c->creation_time) << " " << ci->name << " " << modes; Uplink::Send("MLOCK", ci->c->creation_time, ci->name, modes);
} }
return EVENT_CONTINUE; return EVENT_CONTINUE;
@@ -481,7 +482,7 @@ public:
if (use_server_side_mlock && cm && modelocks && ci->c && (cm->type == MODE_REGULAR || cm->type == MODE_PARAM) && Servers::Capab.count("MLOCK") > 0) if (use_server_side_mlock && cm && modelocks && ci->c && (cm->type == MODE_REGULAR || cm->type == MODE_PARAM) && Servers::Capab.count("MLOCK") > 0)
{ {
Anope::string modes = modelocks->GetMLockAsString(false).replace_all_cs("+", "").replace_all_cs("-", "").replace_all_cs(cm->mchar, ""); Anope::string modes = modelocks->GetMLockAsString(false).replace_all_cs("+", "").replace_all_cs("-", "").replace_all_cs(cm->mchar, "");
UplinkSocket::Message(Me) << "MLOCK " << static_cast<long>(ci->c->creation_time) << " " << ci->name << " " << modes; Uplink::Send("MLOCK", ci->c->creation_time, ci->name, modes);
} }
return EVENT_CONTINUE; return EVENT_CONTINUE;
+55 -52
View File
@@ -45,7 +45,7 @@ private:
/* SVSNOOP */ /* SVSNOOP */
void SendSVSNOOP(const Server *server, bool set) override void SendSVSNOOP(const Server *server, bool set) override
{ {
UplinkSocket::Message() << "SVSNOOP " << server->GetSID() << " " << (set ? "+" : "-"); Uplink::Send("SVSNOOP", server->GetSID(), set ? '+' : '-');
} }
void SendAkillDel(const XLine *x) override void SendAkillDel(const XLine *x) override
@@ -64,22 +64,22 @@ private:
} }
} }
UplinkSocket::Message() << "TKL - G " << x->GetUser() << " " << x->GetHost() << " " << x->by; Uplink::Send("TKL", '-', 'G', x->GetUser(), x->GetHost(), x->by);
} }
void SendTopic(const MessageSource &source, Channel *c) override void SendTopic(const MessageSource &source, Channel *c) override
{ {
UplinkSocket::Message(source) << "TOPIC " << c->name << " " << c->topic_setter << " " << c->topic_ts << " :" << c->topic; Uplink::Send(source, "TOPIC", c->name, c->topic_setter, c->topic_ts, c->topic);
} }
void SendGlobalNotice(BotInfo *bi, const Server *dest, const Anope::string &msg) override void SendGlobalNotice(BotInfo *bi, const Server *dest, const Anope::string &msg) override
{ {
UplinkSocket::Message(bi) << "NOTICE $" << dest->GetName() << " :" << msg; Uplink::Send(bi, "NOTICE", "$" + dest->GetName(), msg);
} }
void SendGlobalPrivmsg(BotInfo *bi, const Server *dest, const Anope::string &msg) override void SendGlobalPrivmsg(BotInfo *bi, const Server *dest, const Anope::string &msg) override
{ {
UplinkSocket::Message(bi) << "PRIVMSG $" << dest->GetName() << " :" << msg; Uplink::Send(bi, "PRIVMSG", "$" + dest->GetName(), msg);
} }
void SendVhostDel(User *u) override void SendVhostDel(User *u) override
@@ -125,12 +125,12 @@ private:
} }
} }
UplinkSocket::Message() << "TKL + G " << x->GetUser() << " " << x->GetHost() << " " << x->by << " " << x->expires << " " << x->created << " :" << x->GetReason(); Uplink::Send("TKL", '+', 'G', x->GetUser(), x->GetHost(), x->by, x->expires, x->created, x->GetReason());
} }
void SendSVSKillInternal(const MessageSource &source, User *user, const Anope::string &buf) override void SendSVSKillInternal(const MessageSource &source, User *user, const Anope::string &buf) override
{ {
UplinkSocket::Message(source) << "SVSKILL " << user->GetUID() << " :" << buf; Uplink::Send(source, "SVSKILL", user->GetUID(), buf);
user->KillInternal(source, buf); user->KillInternal(source, buf);
} }
@@ -143,25 +143,22 @@ private:
void SendClientIntroduction(User *u) override void SendClientIntroduction(User *u) override
{ {
Anope::string modes = "+" + u->GetModes(); Uplink::Send(u->server, "UID", u->nick, 1, u->timestamp, u->GetIdent(), u->host, u->GetUID(), '*', "+" + u->GetModes(),
UplinkSocket::Message(u->server) << "UID " << u->nick << " 1 " << u->timestamp << " " << u->GetIdent() << " " << u->host << " " u->vhost.empty() ? "*" : u->vhost, u->chost.empty() ? "*" : u->chost, "*", u->realname);
<< u->GetUID() << " * " << modes << " " << (!u->vhost.empty() ? u->vhost : "*") << " "
<< (!u->chost.empty() ? u->chost : "*") << " " << "*" << " :" << u->realname;
} }
void SendServer(const Server *server) override void SendServer(const Server *server) override
{ {
if (server == Me) if (server == Me)
UplinkSocket::Message() << "SERVER " << server->GetName() << " " << server->GetHops() + 1 << " :" << server->GetDescription(); Uplink::Send("SERVER", server->GetName(), server->GetHops() + 1, server->GetDescription());
else else
UplinkSocket::Message(Me) << "SID " << server->GetName() << " " << server->GetHops() + 1 << " " << server->GetSID() << " :" << server->GetDescription(); Uplink::Send("SID", server->GetName(), server->GetHops() + 1, server->GetSID(), server->GetDescription());
} }
/* JOIN */ /* JOIN */
void SendJoin(User *user, Channel *c, const ChannelStatus *status) override void SendJoin(User *user, Channel *c, const ChannelStatus *status) override
{ {
UplinkSocket::Message(Me) << "SJOIN " << c->creation_time << " " << c->name Uplink::Send("SJOIN", c->creation_time, c->name, "+" + c->GetModes(true, true), user->GetUID());
<< " +" << c->GetModes(true, true) << " :" << user->GetUID();
if (status) if (status)
{ {
/* First save the channel status incase uc->Status == status */ /* First save the channel status incase uc->Status == status */
@@ -186,7 +183,7 @@ private:
*/ */
void SendSQLineDel(const XLine *x) override void SendSQLineDel(const XLine *x) override
{ {
UplinkSocket::Message() << "UNSQLINE " << x->mask; Uplink::Send("UNSQLINE", x->mask);
} }
/* SQLINE */ /* SQLINE */
@@ -196,7 +193,7 @@ private:
*/ */
void SendSQLine(User *, const XLine *x) override void SendSQLine(User *, const XLine *x) override
{ {
UplinkSocket::Message() << "SQLINE " << x->mask << " :" << x->GetReason(); Uplink::Send("SQLINE", x->mask, x->GetReason());
} }
/* Functions that use serval cmd functions */ /* Functions that use serval cmd functions */
@@ -204,9 +201,11 @@ private:
void SendVhost(User *u, const Anope::string &vIdent, const Anope::string &vhost) override void SendVhost(User *u, const Anope::string &vIdent, const Anope::string &vhost) override
{ {
if (!vIdent.empty()) if (!vIdent.empty())
UplinkSocket::Message(Me) << "CHGIDENT " << u->GetUID() << " " << vIdent; Uplink::Send("CHGIDENT", u->GetUID(), vIdent);
if (!vhost.empty()) if (!vhost.empty())
UplinkSocket::Message(Me) << "CHGHOST " << u->GetUID() << " " << vhost; Uplink::Send("CHGHOST", u->GetUID(), vhost);
// Internally unreal sets +xt on chghost // Internally unreal sets +xt on chghost
BotInfo *bi = Config->GetClient("HostServ"); BotInfo *bi = Config->GetClient("HostServ");
u->SetMode(bi, "CLOAK"); u->SetMode(bi, "CLOAK");
@@ -227,10 +226,12 @@ private:
VL = Version Info VL = Version Info
SID = SID/UID mode SID = SID/UID mode
*/ */
UplinkSocket::Message() << "PASS :" << Config->Uplinks[Anope::CurrentUplink].password; Uplink::Send("PASS", Config->Uplinks[Anope::CurrentUplink].password);
UplinkSocket::Message() << "PROTOCTL " << "NICKv2 VHP UMODE2 NICKIP SJOIN SJOIN2 SJ3 NOQUIT TKLEXT MLOCK SID MTAGS";
UplinkSocket::Message() << "PROTOCTL " << "EAUTH=" << Me->GetName() << ",,,Anope-" << Anope::VersionShort(); Uplink::Send("PROTOCTL", "NICKv2", "VHP", "UMODE2", "NICKIP", "SJOIN", "SJOIN2", "SJ3", "NOQUIT", "TKLEXT", "MLOCK", "SID", "MTAGS");
UplinkSocket::Message() << "PROTOCTL " << "SID=" << Me->GetSID(); Uplink::Send("PROTOCTL" "EAUTH=" + Me->GetName() + ",,,Anope-" + Anope::VersionShort());
Uplink::Send("PROTOCTL", "SID=" + Me->GetSID());
SendServer(Me); SendServer(Me);
} }
@@ -240,19 +241,19 @@ private:
for (const auto &mechanism : mechanisms) for (const auto &mechanism : mechanisms)
mechlist += "," + mechanism; mechlist += "," + mechanism;
UplinkSocket::Message() << "MD client " << Me->GetName() << " saslmechlist :" << (mechanisms.empty() ? "" : mechlist.substr(1)); Uplink::Send("MD", "client", Me->GetName(), "saslmechlist", mechanisms.empty() ? "" : mechlist.substr(1));
} }
/* SVSHOLD - set */ /* SVSHOLD - set */
void SendSVSHold(const Anope::string &nick, time_t t) override void SendSVSHold(const Anope::string &nick, time_t t) override
{ {
UplinkSocket::Message() << "TKL + Q H " << nick << " " << Me->GetName() << " " << Anope::CurTime + t << " " << Anope::CurTime << " :Being held for registered user"; Uplink::Send("TKL", '+', 'Q', 'H', nick, Me->GetName(), Anope::CurTime + t, Anope::CurTime, "Being held for a registered user");
} }
/* SVSHOLD - release */ /* SVSHOLD - release */
void SendSVSHoldDel(const Anope::string &nick) override void SendSVSHoldDel(const Anope::string &nick) override
{ {
UplinkSocket::Message() << "TKL - Q * " << nick << " " << Me->GetName(); Uplink::Send("TKL", '-', 'Q', '*', nick, Me->GetName());
} }
/* UNSGLINE */ /* UNSGLINE */
@@ -261,19 +262,19 @@ private:
*/ */
void SendSGLineDel(const XLine *x) override void SendSGLineDel(const XLine *x) override
{ {
UplinkSocket::Message() << "SVSNLINE - :" << x->mask; Uplink::Send("SVSNLINE", '-', x->mask);
} }
/* UNSZLINE */ /* UNSZLINE */
void SendSZLineDel(const XLine *x) override void SendSZLineDel(const XLine *x) override
{ {
UplinkSocket::Message() << "TKL - Z * " << x->GetHost() << " " << x->by; Uplink::Send("TKL", '-', 'Z', '*', x->GetHost(), x->by);
} }
/* SZLINE */ /* SZLINE */
void SendSZLine(User *, const XLine *x) override void SendSZLine(User *, const XLine *x) override
{ {
UplinkSocket::Message() << "TKL + Z * " << x->GetHost() << " " << x->by << " " << x->expires << " " << x->created << " :" << x->GetReason(); Uplink::Send("TKL", '+', 'Z', '*', x->GetHost(), x->by, x->expires, x->created, x->GetReason());
} }
/* SGLINE */ /* SGLINE */
@@ -284,7 +285,7 @@ private:
{ {
Anope::string edited_reason = x->GetReason(); Anope::string edited_reason = x->GetReason();
edited_reason = edited_reason.replace_all_cs(" ", "_"); edited_reason = edited_reason.replace_all_cs(" ", "_");
UplinkSocket::Message() << "SVSNLINE + " << edited_reason << " :" << x->mask; Uplink::Send("SVSNLINE", '+', edited_reason, x->mask);
} }
/* svsjoin /* svsjoin
@@ -299,32 +300,32 @@ private:
void SendSVSJoin(const MessageSource &source, User *user, const Anope::string &chan, const Anope::string &param) override void SendSVSJoin(const MessageSource &source, User *user, const Anope::string &chan, const Anope::string &param) override
{ {
if (!param.empty()) if (!param.empty())
UplinkSocket::Message() << "SVSJOIN " << user->GetUID() << " " << chan << " :" << param; Uplink::Send("SVSJOIN", user->GetUID(), chan, param);
else else
UplinkSocket::Message() << "SVSJOIN " << user->GetUID() << " " << chan; Uplink::Send("SVSJOIN", user->GetUID(), chan);
} }
void SendSVSPart(const MessageSource &source, User *user, const Anope::string &chan, const Anope::string &param) override void SendSVSPart(const MessageSource &source, User *user, const Anope::string &chan, const Anope::string &param) override
{ {
if (!param.empty()) if (!param.empty())
UplinkSocket::Message() << "SVSPART " << user->GetUID() << " " << chan << " :" << param; Uplink::Send("SVSPART", user->GetUID(), chan, param);
else else
UplinkSocket::Message() << "SVSPART " << user->GetUID() << " " << chan; Uplink::Send("SVSPART", user->GetUID(), chan);
} }
void SendGlobopsInternal(const MessageSource &source, const Anope::string &buf) override void SendGlobopsInternal(const MessageSource &source, const Anope::string &buf) override
{ {
UplinkSocket::Message(Me) << "SENDUMODE o :from " << source.GetName() << ": " << buf; Uplink::Send("SENDUMODE", 'o', "From " + source.GetName() + ": " < buf);
} }
void SendSWhois(const MessageSource &source, const Anope::string &who, const Anope::string &mask) override void SendSWhois(const MessageSource &source, const Anope::string &who, const Anope::string &mask) override
{ {
UplinkSocket::Message() << "SWHOIS " << who << " :" << mask; Uplink::Send("SWHOIS", who, mask);
} }
void SendEOB() override void SendEOB() override
{ {
UplinkSocket::Message(Me) << "EOS"; Uplink::Send("EOS");
} }
bool IsNickValid(const Anope::string &nick) override bool IsNickValid(const Anope::string &nick) override
@@ -364,8 +365,7 @@ private:
void SendChannel(Channel *c) override void SendChannel(Channel *c) override
{ {
UplinkSocket::Message(Me) << "SJOIN " << c->creation_time << " " << c->name Uplink::Send("SJOIN", c->creation_time, c->name, "+" + c->GetModes(true, true), "");
<< " +" << c->GetModes(true, true) << " :";
} }
void SendSASLMessage(const SASL::Message &message) override void SendSASLMessage(const SASL::Message &message) override
@@ -385,7 +385,10 @@ private:
distmask = message.target.substr(0, p); distmask = message.target.substr(0, p);
} }
UplinkSocket::Message(BotInfo::Find(message.source)) << "SASL " << distmask << " " << message.target << " " << message.type << " " << message.data << (message.ext.empty() ? "" : " " + message.ext); if (message.ext.empty())
Uplink::Send(BotInfo::Find(message.source), "SASL", distmask, message.target, message.type, message.data);
else
Uplink::Send(BotInfo::Find(message.source), "SASL", distmask, message.target, message.type, message.data, message.ext);
} }
void SendSVSLogin(const Anope::string &uid, NickAlias *na) override void SendSVSLogin(const Anope::string &uid, NickAlias *na) override
@@ -408,11 +411,13 @@ private:
if (na) if (na)
{ {
if (!na->GetVhostIdent().empty()) if (!na->GetVhostIdent().empty())
UplinkSocket::Message(Me) << "CHGIDENT " << uid << " " << na->GetVhostIdent(); Uplink::Send("CHGIDENT", uid, na->GetVhostIdent());
if (!na->GetVhostHost().empty()) if (!na->GetVhostHost().empty())
UplinkSocket::Message(Me) << "CHGHOST " << uid << " " << na->GetVhostHost(); Uplink::Send("CHGHOST", uid, na->GetVhostHost());
} }
UplinkSocket::Message(Me) << "SVSLOGIN " << distmask << " " << uid << " " << (na ? na->nc->display : "0");
Uplink::Send("SVSLOGIN", distmask, uid, na ? na->nc->display : "0");
} }
bool IsIdentValid(const Anope::string &ident) override bool IsIdentValid(const Anope::string &ident) override
@@ -1197,7 +1202,7 @@ struct IRCDMessageNetInfo final
void Run(MessageSource &source, const std::vector<Anope::string> &params, const Anope::map<Anope::string> &tags) override void Run(MessageSource &source, const std::vector<Anope::string> &params, const Anope::map<Anope::string> &tags) override
{ {
UplinkSocket::Message() << "NETINFO " << MaxUserCount << " " << Anope::CurTime << " " << convertTo<int>(params[2]) << " " << params[3] << " 0 0 0 :" << params[7]; Uplink::Send("NETINFO", MaxUserCount, Anope::CurTime, convertTo<int>(params[2]), params[3], 0, 0, 0, params[7]);
} }
}; };
@@ -1755,7 +1760,7 @@ public:
if (use_server_side_mlock && Servers::Capab.count("MLOCK") > 0 && modelocks) if (use_server_side_mlock && Servers::Capab.count("MLOCK") > 0 && modelocks)
{ {
Anope::string modes = modelocks->GetMLockAsString(false).replace_all_cs("+", "").replace_all_cs("-", ""); Anope::string modes = modelocks->GetMLockAsString(false).replace_all_cs("+", "").replace_all_cs("-", "");
UplinkSocket::Message(Me) << "MLOCK " << static_cast<long>(c->creation_time) << " " << c->ci->name << " " << modes; Uplink::Send("MLOCK", c->creation_time, c->ci->name, modes);
} }
} }
@@ -1765,14 +1770,14 @@ public:
if (!ci->c || !use_server_side_mlock || !modelocks || !Servers::Capab.count("MLOCK")) if (!ci->c || !use_server_side_mlock || !modelocks || !Servers::Capab.count("MLOCK"))
return; return;
Anope::string modes = modelocks->GetMLockAsString(false).replace_all_cs("+", "").replace_all_cs("-", ""); Anope::string modes = modelocks->GetMLockAsString(false).replace_all_cs("+", "").replace_all_cs("-", "");
UplinkSocket::Message(Me) << "MLOCK " << static_cast<long>(ci->c->creation_time) << " " << ci->name << " " << modes; Uplink::Send("MLOCK", ci->c->creation_time, ci->name, modes);
} }
void OnDelChan(ChannelInfo *ci) override void OnDelChan(ChannelInfo *ci) override
{ {
if (!ci->c || !use_server_side_mlock || !Servers::Capab.count("MLOCK")) if (!ci->c || !use_server_side_mlock || !Servers::Capab.count("MLOCK"))
return; return;
UplinkSocket::Message(Me) << "MLOCK " << static_cast<long>(ci->c->creation_time) << " " << ci->name << " :"; Uplink::Send("MLOCK", ci->c->creation_time, ci->name, "");
} }
EventReturn OnMLock(ChannelInfo *ci, ModeLock *lock) override EventReturn OnMLock(ChannelInfo *ci, ModeLock *lock) override
@@ -1782,7 +1787,7 @@ public:
if (use_server_side_mlock && cm && modelocks && ci->c && (cm->type == MODE_REGULAR || cm->type == MODE_PARAM) && Servers::Capab.count("MLOCK") > 0) if (use_server_side_mlock && cm && modelocks && ci->c && (cm->type == MODE_REGULAR || cm->type == MODE_PARAM) && Servers::Capab.count("MLOCK") > 0)
{ {
Anope::string modes = modelocks->GetMLockAsString(false).replace_all_cs("+", "").replace_all_cs("-", "") + cm->mchar; Anope::string modes = modelocks->GetMLockAsString(false).replace_all_cs("+", "").replace_all_cs("-", "") + cm->mchar;
UplinkSocket::Message(Me) << "MLOCK " << static_cast<long>(ci->c->creation_time) << " " << ci->name << " " << modes; Uplink::Send("MLOCK", ci->c->creation_time, ci->name, modes);
} }
return EVENT_CONTINUE; return EVENT_CONTINUE;
@@ -1795,7 +1800,7 @@ public:
if (use_server_side_mlock && cm && modelocks && ci->c && (cm->type == MODE_REGULAR || cm->type == MODE_PARAM) && Servers::Capab.count("MLOCK") > 0) if (use_server_side_mlock && cm && modelocks && ci->c && (cm->type == MODE_REGULAR || cm->type == MODE_PARAM) && Servers::Capab.count("MLOCK") > 0)
{ {
Anope::string modes = modelocks->GetMLockAsString(false).replace_all_cs("+", "").replace_all_cs("-", "").replace_all_cs(cm->mchar, ""); Anope::string modes = modelocks->GetMLockAsString(false).replace_all_cs("+", "").replace_all_cs("-", "").replace_all_cs(cm->mchar, "");
UplinkSocket::Message(Me) << "MLOCK " << static_cast<long>(ci->c->creation_time) << " " << ci->name << " " << modes; Uplink::Send("MLOCK", ci->c->creation_time, ci->name, modes);
} }
return EVENT_CONTINUE; return EVENT_CONTINUE;
@@ -1803,9 +1808,7 @@ public:
void OnChannelUnban(User *u, ChannelInfo *ci) override void OnChannelUnban(User *u, ChannelInfo *ci) override
{ {
UplinkSocket::Message(ci->WhoSends()) << "SVS2MODE " << ci->c->name << " -b " << u->GetUID(); Uplink::Send(ci->WhoSends(), "SVS2MODE", ci->c->name, "-b", u->GetUID());
/* Unreal will remove all matching bans for us regardless of our internal matching.
Don't use Message(Me) here as certain Unreal versions will always respond with TS-less MODE message. */
} }
}; };