aboutsummaryrefslogtreecommitdiffstats
path: root/plugins/muc/muc.lib.lua
diff options
context:
space:
mode:
authorMatthew Wild <mwild1@gmail.com>2012-11-22 21:57:35 +0000
committerMatthew Wild <mwild1@gmail.com>2012-11-22 21:57:35 +0000
commitfa1aed4db29880ce158b889852899fa45c7dd88b (patch)
tree207e6a96430138d21967717bcc880229b4c5be56 /plugins/muc/muc.lib.lua
parenta6572c9a86d73b2f25a37440f677e90881f1a808 (diff)
parent8b5f7f7eaa9101db392a20590bb53d0abf42ad80 (diff)
downloadprosody-fa1aed4db29880ce158b889852899fa45c7dd88b.tar.gz
prosody-fa1aed4db29880ce158b889852899fa45c7dd88b.zip
Merge 0.9->trunk
Diffstat (limited to 'plugins/muc/muc.lib.lua')
-rw-r--r--plugins/muc/muc.lib.lua12
1 files changed, 8 insertions, 4 deletions
diff --git a/plugins/muc/muc.lib.lua b/plugins/muc/muc.lib.lua
index 6ba7b621..c5be3a91 100644
--- a/plugins/muc/muc.lib.lua
+++ b/plugins/muc/muc.lib.lua
@@ -24,7 +24,7 @@ local base64 = require "util.encodings".base64;
local md5 = require "util.hashes".md5;
local muc_domain = nil; --module:get_host();
-local default_history_length = 20;
+local default_history_length, max_history_length = 20, math.huge;
------------
local function filter_xmlns_from_array(array, filters)
@@ -339,7 +339,7 @@ function room_mt:get_historylength()
return self._data.history_length or default_history_length;
end
function room_mt:set_historylength(length)
- length = math.min(tonumber(length) or default_history_length, self._data_max_history_length or math.huge);
+ length = math.min(tonumber(length) or default_history_length, max_history_length or math.huge);
if length == default_history_length then
length = nil;
end
@@ -1150,13 +1150,17 @@ function _M.new_room(jid, config)
_occupants = {};
_data = {
whois = 'moderators';
- history_length = (config and config.max_history_length) or default_history_length;
- max_history_length = (config and config.max_history_length) or default_history_length;
+ history_length = math.min((config and config.history_length)
+ or default_history_length, max_history_length);
};
_affiliations = {};
}, room_mt);
end
+function _M.set_max_history_length(_max_history_length)
+ max_history_length = _max_history_length or math.huge;
+end
+
_M.room_mt = room_mt;
return _M;