Changeset

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 2834:3fb5f173f213
children 2836:52a7c0f6aea1
files mod_mam_muc/mod_mam_muc.lua
diffstat 1 files changed, 9 insertions(+), 4 deletions(-) [+]
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?