Software /
code /
prosody
Comparison
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 |
comparison
equal
deleted
inserted
replaced
12009:f6fff0658108 | 12010:f995d62044fa |
---|---|
536 for field, err in pairs(errors) do | 536 for field, err in pairs(errors) do |
537 errmsg[#errmsg + 1] = field .. ": " .. err; | 537 errmsg[#errmsg + 1] = field .. ": " .. err; |
538 end | 538 end |
539 return { status = "completed", error = { message = t_concat(errmsg, "\n") } }; | 539 return { status = "completed", error = { message = t_concat(errmsg, "\n") } }; |
540 end | 540 end |
541 for _, room in ipairs(fields.rooms) do | 541 local destroyed = array(); |
542 get_room_from_jid(room):destroy(); | 542 for _, room_jid in ipairs(fields.rooms) do |
543 end | 543 local room = get_room_from_jid(room_jid); |
544 return { status = "completed", info = "The following rooms were destroyed:\n"..t_concat(fields.rooms, "\n") }; | 544 if room and room:destroy() then |
545 destroyed:push(room.jid); | |
546 end | |
547 end | |
548 return { status = "completed", info = "The following rooms were destroyed:\n"..t_concat(destroyed, "\n") }; | |
545 end); | 549 end); |
546 local destroy_rooms_desc = adhoc_new("Destroy Rooms", | 550 local destroy_rooms_desc = adhoc_new("Destroy Rooms", |
547 "http://prosody.im/protocol/muc#destroy", destroy_rooms_handler, "admin"); | 551 "http://prosody.im/protocol/muc#destroy", destroy_rooms_handler, "admin"); |
548 | 552 |
549 module:provides("adhoc", destroy_rooms_desc); | 553 module:provides("adhoc", destroy_rooms_desc); |