diff options
author | Matthew Wild <mwild1@gmail.com> | 2012-11-22 21:57:06 +0000 |
---|---|---|
committer | Matthew Wild <mwild1@gmail.com> | 2012-11-22 21:57:06 +0000 |
commit | 8b5f7f7eaa9101db392a20590bb53d0abf42ad80 (patch) | |
tree | 207e6a96430138d21967717bcc880229b4c5be56 /plugins/muc/mod_muc.lua | |
parent | 6dd4e27995c619fd3a7a0d80c279ceabbcb220d6 (diff) | |
download | prosody-8b5f7f7eaa9101db392a20590bb53d0abf42ad80.tar.gz prosody-8b5f7f7eaa9101db392a20590bb53d0abf42ad80.zip |
muc: Make max_history_messages simply a service-wide config option, and don't store it per-room (rooms still have their own history_message, but this is a global limit)
Diffstat (limited to 'plugins/muc/mod_muc.lua')
-rw-r--r-- | plugins/muc/mod_muc.lua | 15 |
1 files changed, 4 insertions, 11 deletions
diff --git a/plugins/muc/mod_muc.lua b/plugins/muc/mod_muc.lua index 0f275196..bf29d1ca 100644 --- a/plugins/muc/mod_muc.lua +++ b/plugins/muc/mod_muc.lua @@ -37,7 +37,7 @@ local rooms = rooms; local persistent_rooms = datamanager.load(nil, muc_host, "persistent") or {}; -- Configurable options -local max_history_messages = module:get_option_number("max_history_messages"); +muclib.set_max_history_length(module:get_option_number("max_history_messages")); local function is_admin(jid) return um_is_admin(jid, module.host); @@ -82,11 +82,8 @@ for jid in pairs(persistent_rooms) do local node = jid_split(jid); local data = datamanager.load(node, muc_host, "config"); if data then - local room = muc_new_room(jid, { - max_history_length = max_history_messages; - }); + local room = muc_new_room(jid); room._data = data._data; - room._data.max_history_length = max_history_messages; -- Overwrite old max_history_length in data with current settings room._affiliations = data._affiliations; room.route_stanza = room_route_stanza; room.save = room_save; @@ -99,9 +96,7 @@ for jid in pairs(persistent_rooms) do end if persistent_errors then datamanager.store(nil, muc_host, "persistent", persistent_rooms); end -local host_room = muc_new_room(muc_host, { - max_history_length = max_history_messages; -}); +local host_room = muc_new_room(muc_host); host_room.route_stanza = room_route_stanza; host_room.save = room_save; @@ -154,9 +149,7 @@ function stanza_handler(event) if not(restrict_room_creation) or (restrict_room_creation == "admin" and is_admin(stanza.attr.from)) or (restrict_room_creation == "local" and select(2, jid_split(stanza.attr.from)) == module.host:gsub("^[^%.]+%.", "")) then - room = muc_new_room(bare, { - max_history_length = max_history_messages; - }); + room = muc_new_room(bare); room.route_stanza = room_route_stanza; room.save = room_save; rooms[bare] = room; |