Comparison

plugins/muc/mod_muc.lua @ 1748:f4c50c75af6f

MUC: Fixed stanza routing for reloaded rooms.
author Waqas Hussain <waqas20@gmail.com>
date Mon, 07 Sep 2009 20:39:05 +0500
parent 1747:28e5f6b535a8
child 1754:67b66eec9777
comparison
equal deleted inserted replaced
1747:28e5f6b535a8 1748:f4c50c75af6f
87 module.save = function() 87 module.save = function()
88 return {rooms = rooms}; 88 return {rooms = rooms};
89 end 89 end
90 module.restore = function(data) 90 module.restore = function(data)
91 rooms = {}; 91 rooms = {};
92 for jid, oldroom in pairs(data.rooms) do 92 for jid, oldroom in pairs(data.rooms or {}) do
93 local room = muc_new_room(jid); 93 local room = muc_new_room(jid);
94 room._jid_nick = oldroom._jid_nick; 94 room._jid_nick = oldroom._jid_nick;
95 room._occupants = oldroom._occupants; 95 room._occupants = oldroom._occupants;
96 room._data = oldroom._data; 96 room._data = oldroom._data;
97 room._affiliations = oldroom._affiliations; 97 room._affiliations = oldroom._affiliations;
98 room.route_stanza = function(room, stanza) core_post_stanza(component, stanza); end;
98 rooms[jid] = room; 99 rooms[jid] = room;
99 end 100 end
100 prosody.hosts[module:get_host()].muc = { rooms = rooms }; 101 prosody.hosts[module:get_host()].muc = { rooms = rooms };
101 end 102 end