diff options
Diffstat (limited to 'modules/protocol/plexus.cpp')
-rw-r--r-- | modules/protocol/plexus.cpp | 123 |
1 files changed, 72 insertions, 51 deletions
diff --git a/modules/protocol/plexus.cpp b/modules/protocol/plexus.cpp index 0770d20a4..6e2930757 100644 --- a/modules/protocol/plexus.cpp +++ b/modules/protocol/plexus.cpp @@ -34,26 +34,26 @@ class PlexusProto : public IRCDProto MaxModes = 4; } - void SendSVSKillInternal(const MessageSource &source, User *targ, const Anope::string &reason) anope_override { hybrid->SendSVSKillInternal(source, targ, reason); } - void SendGlobalNotice(BotInfo *bi, const Server *dest, const Anope::string &msg) anope_override { hybrid->SendGlobalNotice(bi, dest, msg); } - void SendGlobalPrivmsg(BotInfo *bi, const Server *dest, const Anope::string &msg) anope_override { hybrid->SendGlobalPrivmsg(bi, dest, msg); } - void SendSQLine(User *u, const XLine *x) anope_override { hybrid->SendSQLine(u, x); } - void SendSQLineDel(const XLine *x) anope_override { hybrid->SendSQLineDel(x); } - void SendSGLineDel(const XLine *x) anope_override { hybrid->SendSGLineDel(x); } - void SendSGLine(User *u, const XLine *x) anope_override { hybrid->SendSGLine(u, x); } - void SendAkillDel(const XLine *x) anope_override { hybrid->SendAkillDel(x); } - void SendAkill(User *u, XLine *x) anope_override { hybrid->SendAkill(u, x); } - void SendServer(const Server *server) anope_override { hybrid->SendServer(server); } - void SendChannel(Channel *c) anope_override { hybrid->SendChannel(c); } - void SendSVSHold(const Anope::string &nick, time_t t) anope_override { hybrid->SendSVSHold(nick, t); } - void SendSVSHoldDel(const Anope::string &nick) anope_override { hybrid->SendSVSHoldDel(nick); } - - void SendGlobopsInternal(const MessageSource &source, const Anope::string &buf) anope_override + void SendSVSKillInternal(const MessageSource &source, User *targ, const Anope::string &reason) override { hybrid->SendSVSKillInternal(source, targ, reason); } + void SendGlobalNotice(BotInfo *bi, const Server *dest, const Anope::string &msg) override { hybrid->SendGlobalNotice(bi, dest, msg); } + void SendGlobalPrivmsg(BotInfo *bi, const Server *dest, const Anope::string &msg) override { hybrid->SendGlobalPrivmsg(bi, dest, msg); } + void SendSQLine(User *u, const XLine *x) override { hybrid->SendSQLine(u, x); } + void SendSQLineDel(const XLine *x) override { hybrid->SendSQLineDel(x); } + void SendSGLineDel(const XLine *x) override { hybrid->SendSGLineDel(x); } + void SendSGLine(User *u, const XLine *x) override { hybrid->SendSGLine(u, x); } + void SendAkillDel(const XLine *x) override { hybrid->SendAkillDel(x); } + void SendAkill(User *u, XLine *x) override { hybrid->SendAkill(u, x); } + void SendServer(const Server *server) override { hybrid->SendServer(server); } + void SendChannel(Channel *c) override { hybrid->SendChannel(c); } + void SendSVSHold(const Anope::string &nick, time_t t) override { hybrid->SendSVSHold(nick, t); } + void SendSVSHoldDel(const Anope::string &nick) override { hybrid->SendSVSHoldDel(nick); } + + void SendGlobopsInternal(const MessageSource &source, const Anope::string &buf) override { UplinkSocket::Message(source) << "OPERWALL :" << buf; } - void SendJoin(User *user, Channel *c, const ChannelStatus *status) anope_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(); if (status) @@ -76,12 +76,12 @@ class PlexusProto : public IRCDProto } } - void SendForceNickChange(User *u, const Anope::string &newnick, time_t when) anope_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; } - void SendVhost(User *u, const Anope::string &ident, const Anope::string &host) anope_override + void SendVhost(User *u, const Anope::string &ident, const Anope::string &host) override { if (!ident.empty()) UplinkSocket::Message(Me) << "ENCAP * CHGIDENT " << u->GetUID() << " " << ident; @@ -89,12 +89,12 @@ class PlexusProto : public IRCDProto u->SetMode(Config->GetClient("HostServ"), "CLOAK"); } - void SendVhostDel(User *u) anope_override + void SendVhostDel(User *u) override { u->RemoveMode(Config->GetClient("HostServ"), "CLOAK"); } - void SendConnect() anope_override + void SendConnect() override { UplinkSocket::Message() << "PASS " << Config->Uplinks[Anope::CurrentUplink].password << " TS 6 :" << Me->GetSID(); /* CAPAB @@ -131,38 +131,38 @@ class PlexusProto : public IRCDProto UplinkSocket::Message() << "SVINFO 6 5 0 :" << Anope::CurTime; } - void SendClientIntroduction(User *u) anope_override + void SendClientIntroduction(User *u) override { Anope::string modes = "+" + u->GetModes(); UplinkSocket::Message(Me) << "UID " << u->nick << " 1 " << u->timestamp << " " << modes << " " << u->GetIdent() << " " << u->host << " 255.255.255.255 " << u->GetUID() << " 0 " << u->host << " :" << u->realname; } - void SendModeInternal(const MessageSource &source, User *u, const Anope::string &buf) anope_override + void SendModeInternal(const MessageSource &source, User *u, const Anope::string &buf) override { UplinkSocket::Message(source) << "ENCAP * SVSMODE " << u->GetUID() << " " << u->timestamp << " " << buf; } - void SendLogin(User *u, NickAlias *na) anope_override + void SendLogin(User *u, NickServ::Nick *na) override { UplinkSocket::Message(Me) << "ENCAP * SU " << u->GetUID() << " " << na->nc->display; } - void SendLogout(User *u) anope_override + void SendLogout(User *u) override { UplinkSocket::Message(Me) << "ENCAP * SU " << u->GetUID(); } - void SendTopic(const MessageSource &source, Channel *c) anope_override + void SendTopic(const MessageSource &source, Channel *c) override { UplinkSocket::Message(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 ¶m) anope_override + void SendSVSJoin(const MessageSource &source, User *user, const Anope::string &chan, const Anope::string ¶m) override { UplinkSocket::Message(source) << "ENCAP " << user->server->GetName() << " SVSJOIN " << user->GetUID() << " " << chan; } - void SendSVSPart(const MessageSource &source, User *user, const Anope::string &chan, const Anope::string ¶m) anope_override + void SendSVSPart(const MessageSource &source, User *user, const Anope::string &chan, const Anope::string ¶m) override { UplinkSocket::Message(source) << "ENCAP " << user->server->GetName() << " SVSPART " << user->GetUID() << " " << chan; } @@ -172,7 +172,7 @@ struct IRCDMessageEncap : IRCDMessage { IRCDMessageEncap(Module *creator) : IRCDMessage(creator, "ENCAP", 4) { SetFlag(IRCDMESSAGE_REQUIRE_SERVER); } - void Run(MessageSource &source, const std::vector<Anope::string> ¶ms) anope_override + void Run(MessageSource &source, const std::vector<Anope::string> ¶ms) override { /* * Received: :dev.anope.de ENCAP * SU DukePyrolator DukePyrolator @@ -184,7 +184,7 @@ struct IRCDMessageEncap : IRCDMessage if (params[1].equals_cs("SU")) { User *u = User::Find(params[2]); - NickCore *nc = NickCore::Find(params[3]); + NickServ::Account *nc = NickServ::FindAccount(params[3]); if (u && nc) { u->Login(nc); @@ -204,7 +204,7 @@ struct IRCDMessageEncap : IRCDMessage if (u) { u->fingerprint = params[3]; - FOREACH_MOD(OnFingerprint, (u)); + Event::OnFingerprint(&Event::Fingerprint::OnFingerprint, u); } } return; @@ -215,7 +215,7 @@ struct IRCDMessagePass : IRCDMessage { IRCDMessagePass(Module *creator) : IRCDMessage(creator, "PASS", 4) { SetFlag(IRCDMESSAGE_REQUIRE_SERVER); } - void Run(MessageSource &source, const std::vector<Anope::string> ¶ms) anope_override + void Run(MessageSource &source, const std::vector<Anope::string> ¶ms) override { UplinkSID = params[3]; } @@ -227,7 +227,7 @@ struct IRCDMessageServer : IRCDMessage /* 0 1 2 */ /* SERVER hades.arpa 1 :ircd-hybrid test server */ - void Run(MessageSource &source, const std::vector<Anope::string> ¶ms) anope_override + void Run(MessageSource &source, const std::vector<Anope::string> ¶ms) override { /* Servers other than our immediate uplink are introduced via SID */ if (params[1] != "1") @@ -255,7 +255,7 @@ struct IRCDMessageUID : IRCDMessage params[10] = info */ // :42X UID Adam 1 1348535644 +aow Adam 192.168.0.5 192.168.0.5 42XAAAAAB 0 192.168.0.5 :Adam - void Run(MessageSource &source, const std::vector<Anope::string> ¶ms) anope_override + void Run(MessageSource &source, const std::vector<Anope::string> ¶ms) override { /* An IP of 0 means the user is spoofed */ Anope::string ip = params[6]; @@ -272,15 +272,15 @@ struct IRCDMessageUID : IRCDMessage ts = Anope::CurTime; } - NickAlias *na = NULL; + NickServ::Nick *na = NULL; try { if (params[8].is_pos_number_only() && convertTo<time_t>(params[8]) == ts) - na = NickAlias::Find(params[0]); + na = NickServ::FindNick(params[0]); } catch (const ConvertException &) { } if (params[8] != "0" && !na) - na = NickAlias::Find(params[8]); + na = NickServ::FindNick(params[8]); User::OnIntroduce(params[0], params[4], params[9], params[5], ip, source.GetServer(), params[10], ts, params[3], params[7], na ? *na->nc : NULL); } @@ -312,7 +312,7 @@ class ProtoPlexus : public Module Message::Topic message_topic; Message::Version message_version; Message::Whois message_whois; - + /* Hybrid message handlers */ ServiceAlias message_bmask, message_eob, message_join, message_nick, message_sid, message_sjoin, message_tburst, message_tmode; @@ -383,20 +383,41 @@ class ProtoPlexus : public Module } public: - ProtoPlexus(const Anope::string &modname, const Anope::string &creator) : Module(modname, creator, PROTOCOL | VENDOR), - ircd_proto(this), - message_away(this), message_capab(this), message_error(this), message_invite(this), message_kick(this), message_kill(this), - message_mode(this), message_motd(this), message_notice(this), message_part(this), message_ping(this), message_privmsg(this), - message_quit(this), message_squit(this), message_stats(this), message_time(this), message_topic(this), message_version(this), - message_whois(this), - - message_bmask("IRCDMessage", "plexus/bmask", "hybrid/bmask"), message_eob("IRCDMessage", "plexus/eob", "hybrid/eob"), - message_join("IRCDMessage", "plexus/join", "hybrid/join"), message_nick("IRCDMessage", "plexus/nick", "hybrid/nick"), - message_sid("IRCDMessage", "plexus/sid", "hybrid/sid"), - message_sjoin("IRCDMessage", "plexus/sjoin", "hybrid/sjoin"), message_tburst("IRCDMessage", "plexus/tburst", "hybrid/tburst"), - message_tmode("IRCDMessage", "plexus/tmode", "hybrid/tmode"), - - message_encap(this), message_pass(this), message_server(this), message_uid(this) + ProtoPlexus(const Anope::string &modname, const Anope::string &creator) : Module(modname, creator, PROTOCOL | VENDOR) + , ircd_proto(this) + , message_away(this) + , message_capab(this) + , message_error(this) + , message_invite(this) + , message_kick(this) + , message_kill(this) + , message_mode(this) + , message_motd(this) + , message_notice(this) + , message_part(this) + , message_ping(this) + , message_privmsg(this) + , message_quit(this) + , message_squit(this) + , message_stats(this) + , message_time(this) + , message_topic(this) + , message_version(this) + , message_whois(this) + + , message_bmask("IRCDMessage", "plexus/bmask", "hybrid/bmask") + , message_eob("IRCDMessage", "plexus/eob", "hybrid/eob") + , message_join("IRCDMessage", "plexus/join", "hybrid/join") + , message_nick("IRCDMessage", "plexus/nick", "hybrid/nick") + , message_sid("IRCDMessage", "plexus/sid", "hybrid/sid") + , message_sjoin("IRCDMessage", "plexus/sjoin", "hybrid/sjoin") + , message_tburst("IRCDMessage", "plexus/tburst", "hybrid/tburst") + , message_tmode("IRCDMessage", "plexus/tmode", "hybrid/tmode") + + , message_encap(this) + , message_pass(this) + , message_server(this) + , message_uid(this) { if (ModuleManager::LoadModule("hybrid", User::Find(creator)) != MOD_ERR_OK) |