Software /
code /
prosody
Comparison
plugins/muc/mod_muc.lua @ 6479:d016437e01bf
plugins/muc/mod_muc: Add 'local_only' flag to mod_muc, so rooms don't get restored on shutdown
author | daurnimator <quae@daurnimator.com> |
---|---|
date | Fri, 17 Oct 2014 16:35:46 -0400 |
parent | 6372:305226a9e581 |
child | 6745:6728ad041761 |
comparison
equal
deleted
inserted
replaced
6478:413923bbd1a0 | 6479:d016437e01bf |
---|---|
120 end | 120 end |
121 end | 121 end |
122 return room | 122 return room |
123 end | 123 end |
124 | 124 |
125 function each_room() | 125 function each_room(local_only) |
126 for room_jid in pairs(persistent_rooms_storage:get(nil) or {}) do | 126 if not local_only then |
127 if rooms[room_jid] == nil then -- Don't restore rooms that already exist | 127 for room_jid in pairs(persistent_rooms_storage:get(nil) or {}) do |
128 local room = restore_room(room_jid); | 128 if rooms[room_jid] == nil then -- Don't restore rooms that already exist |
129 if room == nil then | 129 local room = restore_room(room_jid); |
130 module:log("error", "Missing data for room '%s', omitting from iteration", room_jid); | 130 if room == nil then |
131 module:log("error", "Missing data for room '%s', omitting from iteration", room_jid); | |
132 end | |
131 end | 133 end |
132 end | 134 end |
133 end | 135 end |
134 return iterators.values(rooms); | 136 return iterators.values(rooms); |
135 end | 137 end |
215 end | 217 end |
216 | 218 |
217 function shutdown_component() | 219 function shutdown_component() |
218 local x = st.stanza("x", {xmlns = "http://jabber.org/protocol/muc#user"}) | 220 local x = st.stanza("x", {xmlns = "http://jabber.org/protocol/muc#user"}) |
219 :tag("status", { code = "332"}):up(); | 221 :tag("status", { code = "332"}):up(); |
220 for room in each_room() do | 222 for room in each_room(true) do |
221 room:clear(x); | 223 room:clear(x); |
222 end | 224 end |
223 end | 225 end |
224 module:hook_global("server-stopping", shutdown_component); | 226 module:hook_global("server-stopping", shutdown_component); |
225 | 227 |