summaryrefslogtreecommitdiff
path: root/modules/protocol/plexus.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/plexus.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/plexus.cpp')
-rw-r--r--modules/protocol/plexus.cpp78
1 files changed, 21 insertions, 57 deletions
diff --git a/modules/protocol/plexus.cpp b/modules/protocol/plexus.cpp
index 0755ac327..3d28f9b7e 100644
--- a/modules/protocol/plexus.cpp
+++ b/modules/protocol/plexus.cpp
@@ -13,8 +13,8 @@
static Anope::string TS6UPLINK;
-IRCDVar myIrcd[] = {
- {"hybrid-7.2.3+plexus-3.0.1", /* ircd name */
+IRCDVar myIrcd = {
+ "hybrid-7.2.3+plexus-3.0.1", /* ircd name */
"+oi", /* Modes used by pseudoclients */
1, /* SVSNICK */
1, /* Vhost */
@@ -36,49 +36,46 @@ IRCDVar myIrcd[] = {
"$$", /* TLD Prefix for Global */
4, /* Max number of modes we can send per line */
1, /* IRCd sends a SSL users certificate fingerprint */
- }
- ,
- {NULL}
};
class PlexusProto : 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
{
- UplinkSocket::Message(Me->GetSID()) << "SJOIN " << c->creation_time << " " << c->name << " +" << c->GetModes(true, true) << " :" << user->GetUID();
+ UplinkSocket::Message(Me) << "SJOIN " << c->creation_time << " " << c->name << " +" << c->GetModes(true, true) << " :" << user->GetUID();
if (status)
{
/* First save the channel status incase uc->Status == status */
@@ -104,12 +101,7 @@ class PlexusProto : 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;
}
void SendServer(const Server *server) anope_override
@@ -117,12 +109,12 @@ class PlexusProto : public IRCDProto
if (server == Me)
UplinkSocket::Message() << "SERVER " << server->GetName() << " " << server->GetHops() << " :" << server->GetDescription();
else
- UplinkSocket::Message(Me->GetSID()) << "SID " << server->GetName() << " " << server->GetHops() << " " << server->GetSID() << " :" << server->GetDescription();
+ UplinkSocket::Message(Me) << "SID " << server->GetName() << " " << server->GetHops() << " " << server->GetSID() << " :" << server->GetDescription();
}
void SendForceNickChange(const User *u, const Anope::string &newnick, time_t when) anope_override
{
- UplinkSocket::Message(Me->GetSID()) << "ENCAP " << u->server->GetName() << " SVSNICK " << u->GetUID() << " " << u->timestamp << " " << newnick << " " << when;
+ UplinkSocket::Message(Me) << "ENCAP " << u->server->GetName() << " SVSNICK " << u->GetUID() << " " << u->timestamp << " " << newnick << " " << when;
}
void SendVhostDel(User *u) anope_override
@@ -137,8 +129,8 @@ class PlexusProto : public IRCDProto
void SendVhost(User *u, const Anope::string &ident, const Anope::string &host) anope_override
{
if (!ident.empty())
- UplinkSocket::Message(Me->GetSID()) << "ENCAP * CHGIDENT " << u->GetUID() << " " << ident;
- UplinkSocket::Message(Me->GetSID()) << "ENCAP * CHGHOST " << u->GetUID() << " " << host;
+ UplinkSocket::Message(Me) << "ENCAP * CHGIDENT " << u->GetUID() << " " << ident;
+ UplinkSocket::Message(Me) << "ENCAP * CHGHOST " << u->GetUID() << " " << host;
}
void SendConnect() anope_override
@@ -181,40 +173,12 @@ class PlexusProto : 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 << " 255.255.255.255 " << u->GetUID() << " 0 " << u->host << " :" << 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 << " 255.255.255.255 " << u->GetUID() << " 0 " << u->host << " :" << u->realname;
}
void SendModeInternal(const BotInfo *bi, const User *u, const Anope::string &buf) anope_override
{
- UplinkSocket::Message(bi ? bi->GetUID() : Me->GetSID()) << "ENCAP * SVSMODE " << u->GetUID() << " " << u->timestamp << " " << 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) << "ENCAP * SVSMODE " << u->GetUID() << " " << u->timestamp << " " << buf;
}
void SendLogin(User *u) anope_override
@@ -222,17 +186,17 @@ class PlexusProto : 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 SendTopic(BotInfo *bi, Channel *c) anope_override
{
- UplinkSocket::Message(bi->GetUID()) << "ENCAP * TOPIC " << c->name << " " << c->topic_setter << " " << c->topic_time + 1 << " :" << c->topic;
+ UplinkSocket::Message(bi) << "ENCAP * TOPIC " << c->name << " " << c->topic_setter << " " << c->topic_time + 1 << " :" << c->topic;
}
void SendChannel(Channel *c) anope_override
@@ -240,7 +204,7 @@ class PlexusProto : public IRCDProto
Anope::string modes = c->GetModes(true, true);
if (modes.empty())
modes = "+";
- UplinkSocket::Message(Me->GetSID()) << "SJOIN " << c->creation_time << " " << c->name << " " << modes << "%s :";
+ UplinkSocket::Message(Me) << "SJOIN " << c->creation_time << " " << c->name << " " << modes << " :";
}
};
@@ -656,7 +620,7 @@ class ProtoPlexus : 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);