aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authordaurnimator <quae@daurnimator.com>2014-10-17 16:35:46 -0400
committerdaurnimator <quae@daurnimator.com>2014-10-17 16:35:46 -0400
commit52b5ba3232fd540d6a672d5e7991f9cb64b60780 (patch)
treea60ddad78c37d6710a7050a8d2c94f856a68e520
parent786ea875b2758d1b5cd9bf6b54f5f83037695c8f (diff)
downloadprosody-52b5ba3232fd540d6a672d5e7991f9cb64b60780.tar.gz
prosody-52b5ba3232fd540d6a672d5e7991f9cb64b60780.zip
plugins/muc/mod_muc: Add 'local_only' flag to mod_muc, so rooms don't get restored on shutdown
-rw-r--r--plugins/muc/mod_muc.lua16
1 files changed, 9 insertions, 7 deletions
diff --git a/plugins/muc/mod_muc.lua b/plugins/muc/mod_muc.lua
index 5428d270..db85a73f 100644
--- a/plugins/muc/mod_muc.lua
+++ b/plugins/muc/mod_muc.lua
@@ -122,12 +122,14 @@ function get_room_from_jid(room_jid)
return room
end
-function each_room()
- for room_jid in pairs(persistent_rooms_storage:get(nil) or {}) do
- if rooms[room_jid] == nil then -- Don't restore rooms that already exist
- local room = restore_room(room_jid);
- if room == nil then
- module:log("error", "Missing data for room '%s', omitting from iteration", room_jid);
+function each_room(local_only)
+ if not local_only then
+ for room_jid in pairs(persistent_rooms_storage:get(nil) or {}) do
+ if rooms[room_jid] == nil then -- Don't restore rooms that already exist
+ local room = restore_room(room_jid);
+ if room == nil then
+ module:log("error", "Missing data for room '%s', omitting from iteration", room_jid);
+ end
end
end
end
@@ -217,7 +219,7 @@ end
function shutdown_component()
local x = st.stanza("x", {xmlns = "http://jabber.org/protocol/muc#user"})
:tag("status", { code = "332"}):up();
- for room in each_room() do
+ for room in each_room(true) do
room:clear(x);
end
end