summaryrefslogtreecommitdiff
path: root/modules/protocol/bahamut.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'modules/protocol/bahamut.cpp')
-rw-r--r--modules/protocol/bahamut.cpp58
1 files changed, 28 insertions, 30 deletions
diff --git a/modules/protocol/bahamut.cpp b/modules/protocol/bahamut.cpp
index a82f63bd8..7a0c357ca 100644
--- a/modules/protocol/bahamut.cpp
+++ b/modules/protocol/bahamut.cpp
@@ -68,45 +68,46 @@ public:
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
{
- UplinkSocket::Message(bi) << "PRIVMSG $" << dest->GetName() << " :" << msg;
+ Uplink::Send(bi, "PRIVMSG", "$" + dest->GetName(), msg);
}
/* SVSHOLD - set */
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 */
void SendSVSHoldDel(const Anope::string &nick) override
{
- UplinkSocket::Message(Me) << "SVSHOLD " << nick << " 0";
+ Uplink::Send("SVSHOLD", nick, 0);
}
/* SQLINE */
void SendSQLine(User *, const XLine *x) override
{
- UplinkSocket::Message() << "SQLINE " << x->mask << " :" << x->GetReason();
+ Uplink::Send("SQLINE", x->mask, x->reason);
}
/* UNSLINE */
void SendSGLineDel(const XLine *x) override
{
- UplinkSocket::Message() << "UNSGLINE 0 :" << x->mask;
+ Uplink::Send("UNSGLINE", 0, x->mask);
}
/* UNSZLINE */
void SendSZLineDel(const XLine *x) override
{
/* 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 */
- UplinkSocket::Message() << "RAKILL " << x->GetHost() << " *";
+ Uplink::Send("RAKILL", x->GetHost(), '*');
}
/* SZLINE */
@@ -116,21 +117,22 @@ public:
time_t timeleft = x->expires ? x->expires - Anope::CurTime : x->expires;
/* 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 */
- 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 */
void SendSVSNOOP(const Server *server, bool set) override
{
- UplinkSocket::Message() << "SVSNOOP " << server->GetName() << " " << (set ? "+" : "-");
+ Uplink::Send("SVSNOOP", server->GetName(), set ? '+' : '-');
}
/* SGLINE */
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 */
@@ -150,25 +152,25 @@ public:
}
}
- UplinkSocket::Message() << "RAKILL " << x->GetHost() << " " << x->GetUser();
+ Uplink::Send("RAKILL", x->GetHost(), x->GetUser());
}
/* TOPIC */
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 */
void SendSQLineDel(const XLine *x) override
{
- UplinkSocket::Message() << "UNSQLINE " << x->mask;
+ Uplink::Send("UNSQLINE", x->mask);
}
/* JOIN - SJOIN */
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)
{
/* First save the channel status incase uc->Status == status */
@@ -227,7 +229,7 @@ public:
// Calculate the time left before this would expire
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
{
- UplinkSocket::Message(source) << "SVSKILL " << user->nick << " :" << buf;
+ Uplink::Send("SVSKILL", user->nick, buf);
}
void SendBOB() override
{
- UplinkSocket::Message() << "BURST";
+ Uplink::Send("BURST");
}
void SendEOB() override
{
- UplinkSocket::Message() << "BURST 0";
+ Uplink::Send("BURST", 0);
}
void SendClientIntroduction(User *u) override
{
- Anope::string modes = "+" + u->GetModes();
- UplinkSocket::Message() << "NICK " << u->nick << " 1 " << u->timestamp << " " << modes << " " << u->GetIdent() << " " << u->host << " " << u->server->GetName() << " 0 0 :" << u->realname;
+ Uplink::Send("NICK", u->nick, 1, u->timestamp, "+" + u->GetModes(), u->GetIdent(), u->host, u->server->GetName(), 0, 0, u->realname);
}
/* SERVER */
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
{
- UplinkSocket::Message() << "PASS " << Config->Uplinks[Anope::CurrentUplink].password << " :TS";
- UplinkSocket::Message() << "CAPAB SSJOIN NOQUIT BURST UNCONNECT NICKIP TSMODE TS3";
+ Uplink::Send("PASS", Config->Uplinks[Anope::CurrentUplink].password, "TS");
+ Uplink::Send("CAPAB", "SSJOIN", "NOQUIT", "BURST", "UNCONNECT", "NICKIP", "TSMODE", "TS3");
SendServer(Me);
/*
* SVINFO
@@ -273,16 +274,13 @@ public:
* parv[3] = server is standalone or connected to non-TS only
* 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();
}
void SendChannel(Channel *c) override
{
- Anope::string modes = c->GetModes(true, true);
- if (modes.empty())
- modes = "+";
- UplinkSocket::Message() << "SJOIN " << c->creation_time << " " << c->name << " " << modes << " :";
+ Uplink::Send("SJOIN", c->creation_time, c->name, "+" + c->GetModes(true, true), "");
}
void SendLogin(User *u, NickAlias *) override