From 51f7f168c1e2e90b67ce0c2d0c610ac57127d38c Mon Sep 17 00:00:00 2001 From: Matthew Wild Date: Sun, 13 May 2012 22:58:25 +0100 Subject: muc.lib: room:set_historylength(): Condense code, and don't store length when equal to default --- plugins/muc/muc.lib.lua | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) (limited to 'plugins/muc') diff --git a/plugins/muc/muc.lib.lua b/plugins/muc/muc.lib.lua index 31e6809f..5178cb1e 100644 --- a/plugins/muc/muc.lib.lua +++ b/plugins/muc/muc.lib.lua @@ -339,13 +339,9 @@ function room_mt:get_historylength() 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 -- cgit v1.2.3