comparison 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
comparison
equal deleted inserted replaced
2023:98b4794b72e4 2024:6f4dcc723a60
36 end 36 end
37 37
38 local archive_store = "archive2"; 38 local archive_store = "archive2";
39 local archive = assert(module:open_store(archive_store, "archive")); 39 local archive = assert(module:open_store(archive_store, "archive"));
40 40
41 if archive.name == "null" then 41 if archive.name == "null" or not archive.find then
42 if not archive.find then
43 module:log("debug", "Attempt to open archive storage returned a valid driver but it does not seem to implement the storage API");
44 module:log("debug", "mod_%s does not support archiving", archive._provided_by or archive.name and "storage_"..archive.name.."(?)" or "<unknown>");
45 else
46 module:log("debug", "Attempt to open archive storage returned null driver");
47 end
48 module:log("info", "See https://prosody.im/doc/storage and https://prosody.im/doc/archiving for more information");
42 module:log("info", "Using in-memory fallback archive driver"); 49 module:log("info", "Using in-memory fallback archive driver");
43 archive = module:require "fallback_archive"; 50 archive = module:require "fallback_archive";
44 elseif not archive.find then
45 module:log("debug", "Attempt to open archive storage returned a valid driver but it does not seem to implement the storage API");
46 module:log("error", "mod_%s does not support archiving", archive._provided_by or archive.name and "storage_"..archive.name.."(?)" or "<unknown>");
47 module:log("info", "See https://prosody.im/doc/storage and https://prosody.im/doc/archiving for more information");
48 return;
49 end 51 end
50 52
51 local cleanup; 53 local cleanup;
52 54
53 -- Handle prefs. 55 -- Handle prefs.