diff options
author | Sadie Powell <sadie@witchery.services> | 2023-10-19 23:22:31 +0100 |
---|---|---|
committer | Sadie Powell <sadie@witchery.services> | 2023-10-19 23:22:31 +0100 |
commit | 38d5b93e4af1babc7ec23a61aea8ba91b4fa9a57 (patch) | |
tree | 4891e2d88a0405adf38027237dcf48d2a192b09c /modules/protocol/unrealircd.cpp | |
parent | 78398a44816fdb5cc6d674edaf11e2665a181ce2 (diff) |
Add support for server-initiated logins and logouts on UnrealIRCd.
Diffstat (limited to 'modules/protocol/unrealircd.cpp')
-rw-r--r-- | modules/protocol/unrealircd.cpp | 32 |
1 files changed, 31 insertions, 1 deletions
diff --git a/modules/protocol/unrealircd.cpp b/modules/protocol/unrealircd.cpp index 0195f8861..ddc714841 100644 --- a/modules/protocol/unrealircd.cpp +++ b/modules/protocol/unrealircd.cpp @@ -1489,6 +1489,35 @@ struct IRCDMessageSJoin : IRCDMessage } }; +class IRCDMessageSVSLogin : IRCDMessage +{ + public: + IRCDMessageSVSLogin(Module *creator) : IRCDMessage(creator, "SVSLOGIN", 3) { SetFlag(IRCDMESSAGE_REQUIRE_SERVER); } + + void Run(MessageSource &source, const std::vector<Anope::string> ¶ms, const Anope::map<Anope::string> &tags) override + { + // :irc.example.com SVSLOGIN <mask> <nick> <account> + // :irc.example.com SVSLOGIN <mask> <nick> 0 + User *u = User::Find(params[1]); + if (!u) + return; // Should never happen. + + if (params[2] == "0") + { + // The user has been logged out by the IRC server. + u->Logout(); + } + else + { + // If we're bursting then then the user was probably logged + // in during a previous connection. + NickCore *nc = NickCore::Find(params[2]); + if (nc) + u->Login(nc); + } + } +}; + struct IRCDMessageTopic : IRCDMessage { IRCDMessageTopic(Module *creator) : IRCDMessage(creator, "TOPIC", 4) { } @@ -1642,6 +1671,7 @@ class ProtoUnreal : public Module IRCDMessageServer message_server; IRCDMessageSID message_sid; IRCDMessageSJoin message_sjoin; + IRCDMessageSVSLogin message_svslogin; IRCDMessageTopic message_topic; IRCDMessageUID message_uid; IRCDMessageUmode2 message_umode2; @@ -1660,7 +1690,7 @@ class ProtoUnreal : public Module message_md(this, ircd_proto.ClientModData, ircd_proto.ChannelModData),message_mode(this, "MODE"), message_svsmode(this, "SVSMODE"), message_svs2mode(this, "SVS2MODE"), message_netinfo(this), message_nick(this), message_pong(this), message_sasl(this), message_sdesc(this), message_sethost(this), message_setident(this), message_setname(this), message_server(this), - message_sid(this), message_sjoin(this), message_topic(this), message_uid(this), message_umode2(this) + message_sid(this), message_sjoin(this), message_svslogin(this), message_topic(this), message_uid(this), message_umode2(this) { } |