Merge pull request #684 from Xaekai/afk.meta
Single source of truth for AFK
This commit is contained in:
commit
33f632036e
4 changed files with 28 additions and 23 deletions
|
|
@ -417,6 +417,12 @@ Channel.prototype.acceptUser = function (user) {
|
|||
if (!this.is(Flags.C_REGISTERED)) {
|
||||
user.socket.emit("channelNotRegistered");
|
||||
}
|
||||
|
||||
user.on('afk', function(afk){
|
||||
self.sendUserMeta(self.users, user, -1);
|
||||
// TODO: Drop legacy setAFK frame after a few months
|
||||
self.broadcastAll("setAFK", { name: user.getName(), afk: afk });
|
||||
})
|
||||
};
|
||||
|
||||
Channel.prototype.partUser = function (user) {
|
||||
|
|
|
|||
|
|
@ -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();
|
||||
}
|
||||
};
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue