Software /
code /
prosody
Diff
plugins/muc/mod_muc.lua @ 12010:f995d62044fa
MUC: Allow modules a chance to act prior to room destruction
author | Kim Alvefur <zash@zash.se> |
---|---|
date | Sun, 05 Dec 2021 14:49:06 +0100 |
parent | 11492:6da8d9cb355d |
child | 12108:e9882c4c397f |
line wrap: on
line diff
--- a/plugins/muc/mod_muc.lua Sat Dec 04 17:46:37 2021 +0100 +++ b/plugins/muc/mod_muc.lua Sun Dec 05 14:49:06 2021 +0100 @@ -538,10 +538,14 @@ 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");