From 78398a44816fdb5cc6d674edaf11e2665a181ce2 Mon Sep 17 00:00:00 2001 From: Sadie Powell Date: Thu, 19 Oct 2023 22:52:05 +0100 Subject: [PATCH] Add support for server-initiated logouts on InspIRCd. --- modules/protocol/inspircd.cpp | 19 ++++++++++++++++--- 1 file changed, 16 insertions(+), 3 deletions(-) diff --git a/modules/protocol/inspircd.cpp b/modules/protocol/inspircd.cpp index e91e54b57..8e0581b13 100644 --- a/modules/protocol/inspircd.cpp +++ b/modules/protocol/inspircd.cpp @@ -1395,9 +1395,22 @@ class IRCDMessageMetadata : IRCDMessage if (params[1].equals_cs("accountname")) { User *u = User::Find(params[0]); - NickCore *nc = NickCore::Find(params[2]); - if (u && nc) - u->Login(nc); + if (!u) + return; // Should never happen. + + if (params[2].empty()) + { + // 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); + } } /*