aboutsummaryrefslogtreecommitdiffstats
path: root/plugins/muc
diff options
context:
space:
mode:
authorMatthew Wild <mwild1@gmail.com>2012-05-13 22:58:25 +0100
committerMatthew Wild <mwild1@gmail.com>2012-05-13 22:58:25 +0100
commit17729a0e3b03482231f09164ce9ac1fe4984715b (patch)
tree7124bbc3175226eb53c31344193c5fa8401901c4 /plugins/muc
parent4341ffc0b6295a325cfe426d0f892011288c3b9e (diff)
downloadprosody-17729a0e3b03482231f09164ce9ac1fe4984715b.tar.gz
prosody-17729a0e3b03482231f09164ce9ac1fe4984715b.zip
muc.lib: room:set_historylength(): Condense code, and don't store length when equal to default
Diffstat (limited to 'plugins/muc')
-rw-r--r--plugins/muc/muc.lib.lua10
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