Fix #331
This commit is contained in:
parent
2211e4da9c
commit
5e152c8310
|
|
@ -2691,7 +2691,7 @@ Channel.prototype.handleUpdateOptions = function (user, data) {
|
||||||
}
|
}
|
||||||
|
|
||||||
if ("maxlength" in data) {
|
if ("maxlength" in data) {
|
||||||
var ml = parseInt(data.maxlength);
|
var ml = util.parseTime(data.maxlength);
|
||||||
if (isNaN(ml) || ml < 0) {
|
if (isNaN(ml) || ml < 0) {
|
||||||
ml = 0;
|
ml = 0;
|
||||||
}
|
}
|
||||||
|
|
@ -2723,7 +2723,7 @@ Channel.prototype.handleUpdateOptions = function (user, data) {
|
||||||
b = 1;
|
b = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
var s = parseInt(data.chat_antiflood_params.sustained);
|
var s = parseFloat(data.chat_antiflood_params.sustained);
|
||||||
if (isNaN(s) || s <= 0) {
|
if (isNaN(s) || s <= 0) {
|
||||||
s = 1;
|
s = 1;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -10,7 +10,7 @@
|
||||||
if (typeof require === "function") {
|
if (typeof require === "function") {
|
||||||
crypto = require("crypto");
|
crypto = require("crypto");
|
||||||
}
|
}
|
||||||
|
|
||||||
var Set = function (items) {
|
var Set = function (items) {
|
||||||
this._items = {};
|
this._items = {};
|
||||||
var self = this;
|
var self = this;
|
||||||
|
|
@ -115,6 +115,23 @@
|
||||||
return [h, m, s].join(":");
|
return [h, m, s].join(":");
|
||||||
},
|
},
|
||||||
|
|
||||||
|
root.parseTime = function (time) {
|
||||||
|
var parts = time.split(":");
|
||||||
|
var seconds = 0;
|
||||||
|
switch (parts.length) {
|
||||||
|
case 3:
|
||||||
|
seconds += parseInt(parts[2]) * 3600;
|
||||||
|
case 2:
|
||||||
|
seconds += parseInt(parts[1]) * 60;
|
||||||
|
case 1:
|
||||||
|
seconds += parseInt(parts[0]);
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
return seconds;
|
||||||
|
},
|
||||||
|
|
||||||
root.newRateLimiter = function () {
|
root.newRateLimiter = function () {
|
||||||
return {
|
return {
|
||||||
count: 0,
|
count: 0,
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue