From 5a91a7ce217e0bce01dd62c3f3ae79f3db6228ab Mon Sep 17 00:00:00 2001 From: calzoneman Date: Tue, 30 Jul 2013 18:24:09 -0400 Subject: [PATCH] Only change afkcount if afk state changes --- user.js | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/user.js b/user.js index e886d63b..80d76f1c 100644 --- a/user.js +++ b/user.js @@ -83,14 +83,17 @@ User.prototype.noflood = function(name, hz) { User.prototype.setAFK = function (afk) { if(this.channel === null) return; + var changed = this.meta.afk != afk; var chan = this.channel; this.meta.afk = afk; if(!afk) this.autoAFK(); - if(this.meta.afk) - chan.afkcount++; - else - chan.afkcount--; + if(changed) { + if(this.meta.afk) + chan.afkcount++; + else + chan.afkcount--; + } if(chan.voteskip) { chan.voteskip.unvote(this.ip); var need = parseInt(chan.users.length * chan.opts.voteskip_ratio);