Fix #316
This commit is contained in:
parent
c00ce26d57
commit
fb355272fc
16
lib/user.js
16
lib/user.js
|
@ -36,6 +36,7 @@ var User = function (socket) {
|
||||||
};
|
};
|
||||||
this.queueLimiter = $util.newRateLimiter();
|
this.queueLimiter = $util.newRateLimiter();
|
||||||
this.chatLimiter = $util.newRateLimiter();
|
this.chatLimiter = $util.newRateLimiter();
|
||||||
|
this.rankListLimiter = $util.newRateLimiter();
|
||||||
this.profile = {
|
this.profile = {
|
||||||
image: "",
|
image: "",
|
||||||
text: ""
|
text: ""
|
||||||
|
@ -460,9 +461,18 @@ User.prototype.initCallbacks = function () {
|
||||||
|
|
||||||
self.socket.on("requestChannelRanks", function () {
|
self.socket.on("requestChannelRanks", function () {
|
||||||
if (self.inChannel()) {
|
if (self.inChannel()) {
|
||||||
if (self.noflood("requestChannelRanks", 0.25))
|
if (self.rankListLimiter.throttle({
|
||||||
return;
|
burst: 0,
|
||||||
self.channel.sendChannelRanks(self);
|
sustained: 0.1,
|
||||||
|
cooldown: 10
|
||||||
|
})) {
|
||||||
|
self.socket.emit("noflood", {
|
||||||
|
action: "channel ranks",
|
||||||
|
msg: "You may only refresh channel ranks once every 10 seconds"
|
||||||
|
});
|
||||||
|
} else {
|
||||||
|
self.channel.sendChannelRanks(self);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue