fix quit for clients that dont send quit before disconnect

This commit is contained in:
zefie
2025-06-25 17:31:11 -04:00
parent 6fbf5402de
commit 3ce9d0d50c

View File

@@ -2971,9 +2971,6 @@ class WTVIRC {
// Cleans up the user session and removes them from all channels // Cleans up the user session and removes them from all channels
const nickname = this.nicknames.get(socket); const nickname = this.nicknames.get(socket);
if (nickname) { if (nickname) {
this.cleanupUserSession(nickname);
this.nicknames.delete(socket);
}
if (!socket.signedoff) { if (!socket.signedoff) {
var serverSocket = null; var serverSocket = null;
for (const [srvSocket, users] of this.serverusers.entries()) { for (const [srvSocket, users] of this.serverusers.entries()) {
@@ -2983,9 +2980,13 @@ class WTVIRC {
continue; continue;
} }
} }
await this.broadcastUser(nickname, `:${nickname}!${socket.username}@${socket.host} QUIT :Client disconnected\r\n`, socket);
await this.broadcastToAllServers(`:${socket.uniqueId} QUIT :Client disconnected\r\n`, serverSocket); await this.broadcastToAllServers(`:${socket.uniqueId} QUIT :Client disconnected\r\n`, serverSocket);
socket.signedoff = true; // Just in case socket.signedoff = true; // Just in case
} }
this.cleanupUserSession(nickname);
this.nicknames.delete(socket);
}
if (socket.isserver) { if (socket.isserver) {
const srvUsers = this.serverusers.get(socket) || []; const srvUsers = this.serverusers.get(socket) || [];
for (const nickname of srvUsers) { for (const nickname of srvUsers) {