diff --git a/lib/channel/opts.js b/lib/channel/opts.js index 7590972d..9c7450f7 100644 --- a/lib/channel/opts.js +++ b/lib/channel/opts.js @@ -1,5 +1,6 @@ var ChannelModule = require("./module"); var Config = require("../config"); +var Utilities = require ("../utilities"); function OptionsModule(channel) { ChannelModule.apply(this, arguments); @@ -120,7 +121,13 @@ OptionsModule.prototype.handleSetOptions = function (user, data) { } if ("maxlength" in data) { - var ml = parseInt(data.maxlength); + var ml = 0; + if (typeof data.maxlength !== "number") { + ml = Utilities.parseTime(data.maxlength); + } else { + ml = parseInt(data.maxlength); + } + if (isNaN(ml) || ml < 0) { ml = 0; } diff --git a/lib/utilities.js b/lib/utilities.js index 6aa03738..81848173 100644 --- a/lib/utilities.js +++ b/lib/utilities.js @@ -176,7 +176,7 @@ }, root.parseTime = function (time) { - var parts = time.split(":"); + var parts = time.split(":").reverse(); var seconds = 0; switch (parts.length) { case 3: