Diff

plugins/muc/mod_muc.lua @ 1747:28e5f6b535a8

MUC: Added support for reloading MUC library code.
author Waqas Hussain <waqas20@gmail.com>
date Mon, 07 Sep 2009 20:38:20 +0500
parent 1741:2919f3b985fc
child 1748:f4c50c75af6f
line wrap: on
line diff
--- a/plugins/muc/mod_muc.lua	Mon Sep 07 20:36:29 2009 +0500
+++ b/plugins/muc/mod_muc.lua	Mon Sep 07 20:38:20 2009 +0500
@@ -88,6 +88,14 @@
 	return {rooms = rooms};
 end
 module.restore = function(data)
-	rooms = data.rooms or {};
+	rooms = {};
+	for jid, oldroom in pairs(data.rooms) do
+		local room = muc_new_room(jid);
+		room._jid_nick = oldroom._jid_nick;
+		room._occupants = oldroom._occupants;
+		room._data = oldroom._data;
+		room._affiliations = oldroom._affiliations;
+		rooms[jid] = room;
+	end
 	prosody.hosts[module:get_host()].muc = { rooms = rooms };
 end