# HG changeset patch # User Matthew Wild # Date 1533300270 -3600 # Node ID c040c358d6c037616b95c4197c06c8de87b51558 # Parent 9e339197c7243f76424af52d399f3fd59846c2e2 mod_muc: Fire event when room is (and about to be) restored diff -r 9e339197c724 -r c040c358d6c0 plugins/muc/mod_muc.lua --- a/plugins/muc/mod_muc.lua Fri Aug 03 13:43:47 2018 +0100 +++ b/plugins/muc/mod_muc.lua Fri Aug 03 13:44:30 2018 +0100 @@ -188,6 +188,9 @@ 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 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;