mirror of https://github.com/calzoneman/sync.git
Only change afkcount if afk state changes
This commit is contained in:
parent
36d3232d9f
commit
5a91a7ce21
11
user.js
11
user.js
|
@ -83,14 +83,17 @@ User.prototype.noflood = function(name, hz) {
|
||||||
User.prototype.setAFK = function (afk) {
|
User.prototype.setAFK = function (afk) {
|
||||||
if(this.channel === null)
|
if(this.channel === null)
|
||||||
return;
|
return;
|
||||||
|
var changed = this.meta.afk != afk;
|
||||||
var chan = this.channel;
|
var chan = this.channel;
|
||||||
this.meta.afk = afk;
|
this.meta.afk = afk;
|
||||||
if(!afk)
|
if(!afk)
|
||||||
this.autoAFK();
|
this.autoAFK();
|
||||||
if(this.meta.afk)
|
if(changed) {
|
||||||
chan.afkcount++;
|
if(this.meta.afk)
|
||||||
else
|
chan.afkcount++;
|
||||||
chan.afkcount--;
|
else
|
||||||
|
chan.afkcount--;
|
||||||
|
}
|
||||||
if(chan.voteskip) {
|
if(chan.voteskip) {
|
||||||
chan.voteskip.unvote(this.ip);
|
chan.voteskip.unvote(this.ip);
|
||||||
var need = parseInt(chan.users.length * chan.opts.voteskip_ratio);
|
var need = parseInt(chan.users.length * chan.opts.voteskip_ratio);
|
||||||
|
|
Loading…
Reference in New Issue