From 9947b537b6f25b28cdfd969d5de987a4fa8a1acc Mon Sep 17 00:00:00 2001 From: Mattias Erming Date: Mon, 29 Sep 2014 08:49:38 -0700 Subject: [PATCH] Fix bug causing users to disconnect --- package.json | 2 +- src/client.js | 11 ++++++++--- 2 files changed, 9 insertions(+), 4 deletions(-) diff --git a/package.json b/package.json index 31add91..c650901 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "shout", "description": "The self-hosted web IRC client", - "version": "0.38.6", + "version": "0.38.7", "author": "Mattias Erming", "preferGlobal": true, "bin": { diff --git a/src/client.js b/src/client.js index 67f1104..7cc339c 100644 --- a/src/client.js +++ b/src/client.js @@ -283,9 +283,14 @@ Client.prototype.sort = function(data) { }; Client.prototype.quit = function() { - this.sockets.in(this.id).sockets.forEach(function(socket) { - socket.disconnect(true); - }); + 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(); + } + } this.networks.forEach(function(network) { var irc = network.irc; if (network.connected) {