Mercurial > prosody-modules
comparison mod_groups_internal/mod_groups_internal.lua @ 4423:ca821df93cb9
mod_groups_internal: correctly destroy MUC associated with group
Turns out, delete does not do what I think it does. destroy does
what I think it does.
author | Jonas Schäfer <jonas@wielicki.name> |
---|---|
date | Tue, 02 Feb 2021 22:28:09 +0100 |
parents | 1185acb2ab91 |
children | 679be18e6a5e |
comparison
equal
deleted
inserted
replaced
4422:2047dd56cc40 | 4423:ca821df93cb9 |
---|---|
120 name = group_info.name; | 120 name = group_info.name; |
121 muc_jid = muc_jid; | 121 muc_jid = muc_jid; |
122 }); | 122 }); |
123 if not ok then | 123 if not ok then |
124 if room then | 124 if room then |
125 muc_host:delete_room(room) | 125 room:destroy() |
126 end | 126 end |
127 return nil, "internal-server-error"; | 127 return nil, "internal-server-error"; |
128 end | 128 end |
129 | 129 |
130 return group_id; | 130 return group_id; |
180 | 180 |
181 function delete(group_id) | 181 function delete(group_id) |
182 if group_members_store:set(group_id, nil) then | 182 if group_members_store:set(group_id, nil) then |
183 local group_info = get_info(group_id); | 183 local group_info = get_info(group_id); |
184 if group_info and group_info.muc_jid then | 184 if group_info and group_info.muc_jid then |
185 muc_host.delete_room(muc_host.get_room_from_jid(group_info.muc_jid)); | 185 local room = muc_host.get_room_from_jid(group_info.muc_jid) |
186 if room then | |
187 room:destroy() | |
188 end | |
186 end | 189 end |
187 return group_info_store:set(group_id, nil); | 190 return group_info_store:set(group_id, nil); |
188 end | 191 end |
189 return nil, "internal-server-error"; | 192 return nil, "internal-server-error"; |
190 end | 193 end |