diff options
author | Matthew Wild <mwild1@gmail.com> | 2012-05-13 22:58:25 +0100 |
---|---|---|
committer | Matthew Wild <mwild1@gmail.com> | 2012-05-13 22:58:25 +0100 |
commit | 51f7f168c1e2e90b67ce0c2d0c610ac57127d38c (patch) | |
tree | 7124bbc3175226eb53c31344193c5fa8401901c4 /plugins | |
parent | d6b67f7c9e2ae14014d3b039f65a8636af2a9649 (diff) | |
download | prosody-51f7f168c1e2e90b67ce0c2d0c610ac57127d38c.tar.gz prosody-51f7f168c1e2e90b67ce0c2d0c610ac57127d38c.zip |
muc.lib: room:set_historylength(): Condense code, and don't store length when equal to default
Diffstat (limited to 'plugins')
-rw-r--r-- | plugins/muc/muc.lib.lua | 10 |
1 files changed, 3 insertions, 7 deletions
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 |