diff options
author | Kim Alvefur <zash@zash.se> | 2021-12-05 14:49:06 +0100 |
---|---|---|
committer | Kim Alvefur <zash@zash.se> | 2021-12-05 14:49:06 +0100 |
commit | 2807299fba66bf468dd5c534c63081f9b6ac4ce2 (patch) | |
tree | 57cc1819335d2db374ff1c543f9452797202f217 /plugins/muc/mod_muc.lua | |
parent | d48fa1de17cf1435ae733053b8e65e295f2b622f (diff) | |
download | prosody-2807299fba66bf468dd5c534c63081f9b6ac4ce2.tar.gz prosody-2807299fba66bf468dd5c534c63081f9b6ac4ce2.zip |
MUC: Allow modules a chance to act prior to room destruction
Diffstat (limited to 'plugins/muc/mod_muc.lua')
-rw-r--r-- | plugins/muc/mod_muc.lua | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/plugins/muc/mod_muc.lua b/plugins/muc/mod_muc.lua index 04846359..3b0d62ab 100644 --- a/plugins/muc/mod_muc.lua +++ b/plugins/muc/mod_muc.lua @@ -538,10 +538,14 @@ do -- Ad-hoc commands end return { status = "completed", error = { message = t_concat(errmsg, "\n") } }; end - for _, room in ipairs(fields.rooms) do - get_room_from_jid(room):destroy(); + local destroyed = array(); + for _, room_jid in ipairs(fields.rooms) do + local room = get_room_from_jid(room_jid); + if room and room:destroy() then + destroyed:push(room.jid); + end end - return { status = "completed", info = "The following rooms were destroyed:\n"..t_concat(fields.rooms, "\n") }; + return { status = "completed", info = "The following rooms were destroyed:\n"..t_concat(destroyed, "\n") }; end); local destroy_rooms_desc = adhoc_new("Destroy Rooms", "http://prosody.im/protocol/muc#destroy", destroy_rooms_handler, "admin"); |