This commit is contained in:
calzoneman 2013-12-06 15:21:32 -06:00
parent c00ce26d57
commit fb355272fc
1 changed files with 13 additions and 3 deletions

View File

@ -36,6 +36,7 @@ var User = function (socket) {
};
this.queueLimiter = $util.newRateLimiter();
this.chatLimiter = $util.newRateLimiter();
this.rankListLimiter = $util.newRateLimiter();
this.profile = {
image: "",
text: ""
@ -460,9 +461,18 @@ User.prototype.initCallbacks = function () {
self.socket.on("requestChannelRanks", function () {
if (self.inChannel()) {
if (self.noflood("requestChannelRanks", 0.25))
return;
self.channel.sendChannelRanks(self);
if (self.rankListLimiter.throttle({
burst: 0,
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);
}
}
});