Changeset

7360:7a37fade5380

MUC: Move 'preserialization' step to muc.lib
author Kim Alvefur <zash@zash.se>
date Sun, 17 Apr 2016 22:09:44 +0200
parents 7357:d69521003e91
children 7361:3409773ca19a
files plugins/muc/mod_muc.lua plugins/muc/muc.lib.lua
diffstat 2 files changed, 9 insertions(+), 5 deletions(-) [+]
line wrap: on
line diff
--- a/plugins/muc/mod_muc.lua	Fri Apr 15 18:03:55 2016 +0200
+++ b/plugins/muc/mod_muc.lua	Sun Apr 17 22:09:44 2016 +0200
@@ -102,11 +102,7 @@
 	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);
--- a/plugins/muc/muc.lib.lua	Fri Apr 15 18:03:55 2016 +0200
+++ b/plugins/muc/muc.lib.lua	Sun Apr 17 22:09:44 2016 +0200
@@ -1235,6 +1235,14 @@
 	}, 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;