mod_mam: Log error message if unable to open archive storage
authorKim Alvefur <zash@zash.se>
Thu, 05 Sep 2013 15:22:31 +0200
changeset 1185 30b681898c2d
parent 1184 0d3d15586d7e
child 1186 a172e7389cf6
mod_mam: Log error message if unable to open archive storage
mod_mam/mod_mam.lua
--- a/mod_mam/mod_mam.lua	Thu Sep 05 01:02:01 2013 +0200
+++ b/mod_mam/mod_mam.lua	Thu Sep 05 15:22:31 2013 +0200
@@ -34,6 +34,13 @@
 
 local archive_store = "archive2";
 local archive = module:open_store(archive_store, "archive");
+if not archive then
+	module:log("error", "Could not open archive storage");
+	return
+elseif not archive.find then
+	module:log("error", "mod_%s does not support archiving, switch to mod_storage_sql2", archive._provided_by);
+	return
+end
 
 -- Handle prefs.
 module:hook("iq/self/"..xmlns_mam..":prefs", function(event)