summaryrefslogtreecommitdiff
path: root/modules/protocol/ratbox.cpp
diff options
context:
space:
mode:
authorAdam <Adam@anope.org>2012-02-19 20:54:55 -0500
committerAdam <Adam@anope.org>2012-02-19 20:54:55 -0500
commitb84e0804636d3868684c6ec2670207e7ae1cadeb (patch)
tree059be9a9da7b530970bc44f2c8eee5f61497a82e /modules/protocol/ratbox.cpp
parent0ba58d7d0eea4e2a0e0d18a66880f84af6fea60e (diff)
Made our message sources actual clients/servers, and put in a few more default messages for very standard things (KICK etc)
Diffstat (limited to 'modules/protocol/ratbox.cpp')
-rw-r--r--modules/protocol/ratbox.cpp66
1 files changed, 15 insertions, 51 deletions
diff --git a/modules/protocol/ratbox.cpp b/modules/protocol/ratbox.cpp
index c694b1ddc..eeb0a50ac 100644
--- a/modules/protocol/ratbox.cpp
+++ b/modules/protocol/ratbox.cpp
@@ -13,8 +13,8 @@
static Anope::string TS6UPLINK;
-IRCDVar myIrcd[] = {
- {"Ratbox 2.0+", /* ircd name */
+IRCDVar myIrcd = {
+ "Ratbox 2.0+", /* ircd name */
"+oiS", /* Modes used by pseudoclients */
0, /* SVSNICK */
0, /* Vhost */
@@ -36,44 +36,41 @@ IRCDVar myIrcd[] = {
"$$", /* TLD Prefix for Global */
4, /* Max number of modes we can send per line */
0, /* IRCd sends a SSL users certificate fingerprint */
- }
- ,
- {NULL}
};
class RatboxProto : public IRCDProto
{
void SendGlobopsInternal(const BotInfo *source, const Anope::string &buf) anope_override
{
- UplinkSocket::Message(source ? source->GetUID() : Me->GetSID()) << "OPERWALL :" << buf;
+ UplinkSocket::Message(source) << "OPERWALL :" << buf;
}
void SendSQLine(User *, const XLine *x) anope_override
{
- UplinkSocket::Message(Me->GetSID()) << "RESV * " << x->Mask << " :" << x->Reason;
+ UplinkSocket::Message(Me) << "RESV * " << x->Mask << " :" << x->Reason;
}
void SendSGLineDel(const XLine *x) anope_override
{
BotInfo *bi = findbot(Config->OperServ);
- UplinkSocket::Message(bi ? bi->GetUID() : Config->OperServ) << "UNXLINE * " << x->Mask;
+ UplinkSocket::Message(bi) << "UNXLINE * " << x->Mask;
}
void SendSGLine(User *, const XLine *x) anope_override
{
BotInfo *bi = findbot(Config->OperServ);
- UplinkSocket::Message(bi ? bi->GetUID() : Config->OperServ) << "XLINE * " << x->Mask << " 0 :" << x->Reason;
+ UplinkSocket::Message(bi) << "XLINE * " << x->Mask << " 0 :" << x->Reason;
}
void SendAkillDel(const XLine *x) anope_override
{
BotInfo *bi = findbot(Config->OperServ);
- UplinkSocket::Message(bi ? bi->GetUID() : Config->OperServ) << "UNKLINE * " << x->GetUser() << " " << x->GetHost();
+ UplinkSocket::Message(bi) << "UNKLINE * " << x->GetUser() << " " << x->GetHost();
}
void SendSQLineDel(const XLine *x) anope_override
{
- UplinkSocket::Message(Me->GetSID()) << "UNRESV * " << x->Mask;
+ UplinkSocket::Message(Me) << "UNRESV * " << x->Mask;
}
void SendJoin(User *user, Channel *c, const ChannelStatus *status) anope_override
@@ -99,12 +96,7 @@ class RatboxProto : public IRCDProto
if (timeleft > 172800 || !x->Expires)
timeleft = 172800;
BotInfo *bi = findbot(Config->OperServ);
- UplinkSocket::Message(bi ? bi->GetUID() : Config->OperServ) << "KLINE * " << timeleft << " " << x->GetUser() << " " << x->GetHost() << " :" << x->Reason;
- }
-
- void SendSVSKillInternal(const BotInfo *source, const User *user, const Anope::string &buf) anope_override
- {
- UplinkSocket::Message(source ? source->GetUID() : Me->GetSID()) << "KILL " << user->GetUID() << " :" << buf;
+ UplinkSocket::Message(bi) << "KLINE * " << timeleft << " " << x->GetUser() << " " << x->GetHost() << " :" << x->Reason;
}
/* SERVER name hop descript */
@@ -151,40 +143,12 @@ class RatboxProto : public IRCDProto
void SendClientIntroduction(const User *u) anope_override
{
Anope::string modes = "+" + u->GetModes();
- UplinkSocket::Message(Me->GetSID()) << "UID " << u->nick << " 1 " << u->timestamp << " " << modes << " " << u->GetIdent() << " " << u->host << " 0 " << u->GetUID() << " :" << u->realname;
- }
-
- void SendPartInternal(const BotInfo *bi, const Channel *chan, const Anope::string &buf) anope_override
- {
- if (!buf.empty())
- UplinkSocket::Message(bi->GetUID()) << "PART " << chan->name << " :" << buf;
- else
- UplinkSocket::Message(bi->GetUID()) << "PART " << chan->name;
- }
-
- void SendModeInternal(const BotInfo *bi, const Channel *dest, const Anope::string &buf) anope_override
- {
- UplinkSocket::Message(bi ? bi->GetUID() : Me->GetSID()) << "MODE " << dest->name << " " << buf;
+ UplinkSocket::Message(Me) << "UID " << u->nick << " 1 " << u->timestamp << " " << modes << " " << u->GetIdent() << " " << u->host << " 0 " << u->GetUID() << " :" << u->realname;
}
void SendModeInternal(const BotInfo *bi, const User *u, const Anope::string &buf) anope_override
{
- UplinkSocket::Message(bi ? bi->GetUID() : Me->GetSID()) << "SVSMODE " << u->nick << " " << buf;
- }
-
- void SendKickInternal(const BotInfo *bi, const Channel *chan, const User *user, const Anope::string &buf) anope_override
- {
- if (!buf.empty())
- UplinkSocket::Message(bi->GetUID()) << "KICK " << chan->name << " " << user->GetUID() << " :" << buf;
- else
- UplinkSocket::Message(bi->GetUID()) << "KICK " << chan->name << " " << user->GetUID();
- }
-
- /* INVITE */
- void SendInvite(const BotInfo *source, const Anope::string &chan, const Anope::string &nick) anope_override
- {
- User *u = finduser(nick);
- UplinkSocket::Message(source->GetUID()) << "INVITE " << (u ? u->GetUID() : nick) << " " << chan;
+ UplinkSocket::Message(bi) << "SVSMODE " << u->nick << " " << buf;
}
void SendLogin(User *u) anope_override
@@ -192,12 +156,12 @@ class RatboxProto : public IRCDProto
if (!u->Account())
return;
- UplinkSocket::Message(Me->GetSID()) << "ENCAP * SU " << u->GetUID() << " " << u->Account()->display;
+ UplinkSocket::Message(Me) << "ENCAP * SU " << u->GetUID() << " " << u->Account()->display;
}
void SendLogout(User *u) anope_override
{
- UplinkSocket::Message(Me->GetSID()) << "ENCAP * SU " << u->GetUID();
+ UplinkSocket::Message(Me) << "ENCAP * SU " << u->GetUID();
}
void SendChannel(Channel *c) anope_override
@@ -226,7 +190,7 @@ class RatboxProto : public IRCDProto
status.SetFlag(CMODE_OP);
bi->Join(c, &status);
}
- UplinkSocket::Message(bi->GetUID()) << "TOPIC " << c->name << " :" << c->topic;
+ IRCDProto::SendTopic(bi, c);
if (needjoin)
bi->Part(c);
}
@@ -570,7 +534,7 @@ class ProtoRatbox : public Module
{
this->SetAuthor("Anope");
- pmodule_ircd_var(myIrcd);
+ pmodule_ircd_var(&myIrcd);
pmodule_ircd_proto(&this->ircd_proto);
pmodule_ircd_message(&this->ircd_message);