Fix empty channel issue
This commit is contained in:
parent
07819f0b14
commit
bd5e11c46a
|
@ -466,6 +466,14 @@ Channel.prototype.getIPRank = function (ip, callback) {
|
|||
*/
|
||||
Channel.prototype.preJoin = function (user, password) {
|
||||
var self = this;
|
||||
|
||||
// Allow channel to unload if the only user disconnects without finishing a join
|
||||
user.socket.on("disconnect", function () {
|
||||
if (!user.inChannel() && self.users.length === 0) {
|
||||
self.emit("empty");
|
||||
}
|
||||
});
|
||||
|
||||
self.whenReady(function () {
|
||||
if (self.dead) {
|
||||
return;
|
||||
|
|
Loading…
Reference in a new issue