aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMatthew Wild <mwild1@gmail.com>2018-08-03 13:44:30 +0100
committerMatthew Wild <mwild1@gmail.com>2018-08-03 13:44:30 +0100
commitc2842236ae8cfde61a7346fed4a74232ad63238d (patch)
treea7188eebd1711362a6e63a6b56ac05f0d771132c
parentf9aaa8ce3d5631fb64449fccaacaf65718130f3a (diff)
downloadprosody-c2842236ae8cfde61a7346fed4a74232ad63238d.tar.gz
prosody-c2842236ae8cfde61a7346fed4a74232ad63238d.zip
mod_muc: Fire event when room is (and about to be) restored
-rw-r--r--plugins/muc/mod_muc.lua4
1 files changed, 4 insertions, 0 deletions
diff --git a/plugins/muc/mod_muc.lua b/plugins/muc/mod_muc.lua
index 9a7081bd..825dcdcb 100644
--- a/plugins/muc/mod_muc.lua
+++ b/plugins/muc/mod_muc.lua
@@ -188,6 +188,9 @@ local function restore_room(jid)
local data, err = room_configs:get(node);
if data then
module:log("debug", "Restoring room %s from storage", jid);
+ if module:fire_event("muc-room-pre-restore", { jid = jid, data = data }) == false then
+ return false;
+ end
local state, s_err = room_state:get(node);
if not state and s_err then
module:log("debug", "Could not restore state of room %s: %s", jid, s_err);
@@ -195,6 +198,7 @@ local function restore_room(jid)
local room = muclib.restore_room(data, state);
if track_room(room) then
room_state:set(node, nil);
+ module:fire_event("muc-room-restored", { jid = jid, room = room });
return room;
else
return false;