mod_muc: Added unload, save and restore callbacks to allow reloading code while preserving state

Tue, 13 Jan 2009 22:38:20 +0500

author
Waqas Hussain <waqas20@gmail.com>
date
Tue, 13 Jan 2009 22:38:20 +0500
changeset 711
7653519ec4f2
parent 710
56f6c115bc69
child 712
56410c0cd846

mod_muc: Added unload, save and restore callbacks to allow reloading code while preserving state

plugins/mod_muc.lua file | annotate | diff | comparison | revisions
--- a/plugins/mod_muc.lua	Tue Jan 13 22:37:07 2009 +0500
+++ b/plugins/mod_muc.lua	Tue Jan 13 22:38:20 2009 +0500
@@ -274,7 +274,13 @@
 	end
 end);
 
-function unload()
+module.unload = function()
 	deregister_component(muc_domain);
 end
-
+module.save = function()
+	return {rooms = rooms.data; jid_nick = jid_nick.data; rooms_info = rooms_info.data; persist_list = persist_list};
+end
+module.restore = function(data)
+	rooms.data, jid_nick.data, rooms_info.data, persist_list =
+	data.rooms or {}, data.jid_nick or {}, data.rooms_info or {}, data.persist_list or {};
+end

mercurial