diff mod_mam_muc/mod_mam_muc.lua @ 2835:b69ef062806e

mod_mam_muc: Warn if the storage driver is missing the deletion API (instead of a traceback) (thanks asterix)
author Kim Alvefur <zash@zash.se>
date Sat, 18 Nov 2017 13:55:47 +0100
parents 4f9466be7b46
children 39994c6bb314
line wrap: on
line diff
--- 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?