# HG changeset patch # User Matthew Wild # Date 1336946305 -3600 # Node ID fa41d05ee7efe5ce70d69ab2c946cad5ed5c510e # Parent f9fe284611016b57f6ad2ac3ab8a6296a4db0061 muc.lib: room:set_historylength(): Condense code, and don't store length when equal to default diff -r f9fe28461101 -r fa41d05ee7ef plugins/muc/muc.lib.lua --- a/plugins/muc/muc.lib.lua Mon May 14 02:42:42 2012 +0500 +++ b/plugins/muc/muc.lib.lua Sun May 13 22:58:25 2012 +0100 @@ -339,13 +339,9 @@ return self._data.history_length or default_history_length; end function room_mt:set_historylength(length) - if tonumber(length) == nil then - return - end - length = tonumber(length); - log("debug", "max_history_length %s", self._data.max_history_length or "nil"); - if self._data.max_history_length and length > self._data.max_history_length then - length = self._data.max_history_length + length = math.min(tonumber(length) or default_history_length, self._data_max_history_length or math.huge); + if length == default_history_length then + length = nil; end self._data.history_length = length; end