diff --git a/src/channel/channel.js b/src/channel/channel.js index 519458fc..64f49b9c 100644 --- a/src/channel/channel.js +++ b/src/channel/channel.js @@ -417,6 +417,10 @@ Channel.prototype.acceptUser = function (user) { if (!this.is(Flags.C_REGISTERED)) { user.socket.emit("channelNotRegistered"); } + + user.on('afk', function(){ + self.sendUserMeta(self.users, user, -1); + }) }; Channel.prototype.partUser = function (user) { diff --git a/src/user.js b/src/user.js index ebe71d67..75d65c93 100644 --- a/src/user.js +++ b/src/user.js @@ -226,10 +226,7 @@ User.prototype.setAFK = function (afk) { this.channel.modules.voteskip.update(); } - this.channel.broadcastAll("setAFK", { - name: this.getName(), - afk: afk - }); + this.emit('afk', afk); }; /* Automatically tag a user as AFK after a period of inactivity */ @@ -424,7 +421,7 @@ User.prototype.getFirstSeenTime = function getFirstSeenTime() { return this.socket.ipSessionFirstSeen.getTime(); } else { LOGGER.error(`User "${this.getName()}" (IP: ${this.realip}) has neither ` + - "an IP sesion first seen time nor a registered account."); + "an IP session first seen time nor a registered account."); return Date.now(); } };