mod_mam_muc: Warn if the storage driver is missing the deletion API (instead of a traceback) (thanks asterix)
--- a/mod_mam_muc/mod_mam_muc.lua Sat Nov 18 01:01:59 2017 +0100
+++ b/mod_mam_muc/mod_mam_muc.lua Sat Nov 18 13:55:47 2017 +0100
@@ -439,10 +439,15 @@
end);
end
-module:hook("muc-room-destroyed", function(event)
- local room_node = jid_split(event.room.jid);
- archive:delete(room_node);
-end);
+if not archive.delete then
+ module:log("warn", "Storage driver %s does not support deletion", archive._provided_by);
+ module:log("warn", "Archived message will persist after a room has been destroyed");
+else
+ module:hook("muc-room-destroyed", function(event)
+ local room_node = jid_split(event.room.jid);
+ archive:delete(room_node);
+ end);
+end
-- And role/affiliation changes?