aboutsummaryrefslogtreecommitdiffstats
path: root/plugins/muc
diff options
context:
space:
mode:
authorKim Alvefur <zash@zash.se>2016-04-17 22:09:44 +0200
committerKim Alvefur <zash@zash.se>2016-04-17 22:09:44 +0200
commit0c5c1f5d0e105eea950e5fba1ea1a3a30f9ab1e9 (patch)
treef4da662947e7ae0a5aa9fd715382a142608b96db /plugins/muc
parentcac82fda13e1b5fabda5314c5d986220af8ac5cc (diff)
downloadprosody-0c5c1f5d0e105eea950e5fba1ea1a3a30f9ab1e9.tar.gz
prosody-0c5c1f5d0e105eea950e5fba1ea1a3a30f9ab1e9.zip
MUC: Move 'preserialization' step to muc.lib
Diffstat (limited to 'plugins/muc')
-rw-r--r--plugins/muc/mod_muc.lua6
-rw-r--r--plugins/muc/muc.lib.lua8
2 files changed, 9 insertions, 5 deletions
diff --git a/plugins/muc/mod_muc.lua b/plugins/muc/mod_muc.lua
index 871b90b4..354ab1d1 100644
--- a/plugins/muc/mod_muc.lua
+++ b/plugins/muc/mod_muc.lua
@@ -102,11 +102,7 @@ local function room_save(room, forced)
local is_persistent = persistent.get(room);
persistent_rooms:set(nil, room.jid, is_persistent);
if is_persistent then
- local data = {
- jid = room.jid;
- _data = room._data;
- _affiliations = room._affiliations;
- };
+ local data = room:freeze();
room_configs:set(node, data);
elseif forced then
room_configs:set(node, nil);
diff --git a/plugins/muc/muc.lib.lua b/plugins/muc/muc.lib.lua
index 42a0af25..2026bc47 100644
--- a/plugins/muc/muc.lib.lua
+++ b/plugins/muc/muc.lib.lua
@@ -1235,6 +1235,14 @@ function _M.new_room(jid, config) -- luacheck: ignore 212
}, room_mt);
end
+function room_mt:freeze()
+ return {
+ jid = self.jid;
+ _data = self._data;
+ _affiliations = self._affiliations;
+ }
+end
+
_M.room_mt = room_mt;
return _M;