Merge pull request #1474 from thelounge/xpaw/fix-user-remove

Deleting a user should log them out
This commit is contained in:
Jérémie Astori 2017-08-29 21:27:06 -04:00 committed by GitHub
commit 2920f5f24a

View File

@ -491,14 +491,20 @@ Client.prototype.names = function(data) {
};
Client.prototype.quit = function() {
var sockets = this.sockets.sockets;
var room = sockets.adapter.rooms[this.id] || [];
for (var user in room) {
var socket = sockets.adapter.nsp.connected[user];
if (socket) {
socket.disconnect();
const sockets = this.sockets.sockets;
const room = sockets.adapter.rooms[this.id];
if (room && room.sockets) {
for (const user in room.sockets) {
const socket = sockets.connected[user];
if (socket) {
socket.emit("sign-out");
socket.disconnect();
}
}
}
this.networks.forEach((network) => {
if (network.irc) {
network.irc.quit(Helper.config.leaveMessage);