diff mod_mam/mod_mam.lua @ 2024:6f4dcc723a60

mod_mam: Use the fallback driver if either the null driver or a driver that does not implement the archive api is returned
author Kim Alvefur <zash@zash.se>
date Tue, 19 Jan 2016 17:59:05 +0100
parents 98b4794b72e4
children ae98bb884110
line wrap: on
line diff
--- a/mod_mam/mod_mam.lua	Tue Jan 19 17:47:47 2016 +0100
+++ b/mod_mam/mod_mam.lua	Tue Jan 19 17:59:05 2016 +0100
@@ -38,14 +38,16 @@
 local archive_store = "archive2";
 local archive = assert(module:open_store(archive_store, "archive"));
 
-if archive.name == "null" then
+if archive.name == "null" or not archive.find then
+	if not archive.find then
+		module:log("debug", "Attempt to open archive storage returned a valid driver but it does not seem to implement the storage API");
+		module:log("debug", "mod_%s does not support archiving", archive._provided_by or archive.name and "storage_"..archive.name.."(?)" or "<unknown>");
+	else
+		module:log("debug", "Attempt to open archive storage returned null driver");
+	end
+	module:log("info", "See https://prosody.im/doc/storage and https://prosody.im/doc/archiving for more information");
 	module:log("info", "Using in-memory fallback archive driver");
 	archive = module:require "fallback_archive";
-elseif not archive.find then
-	module:log("debug", "Attempt to open archive storage returned a valid driver but it does not seem to implement the storage API");
-	module:log("error", "mod_%s does not support archiving", archive._provided_by or archive.name and "storage_"..archive.name.."(?)" or "<unknown>");
-	module:log("info", "See https://prosody.im/doc/storage and https://prosody.im/doc/archiving for more information");
-	return;
 end
 
 local cleanup;