comparison mod_mam_muc/mod_mam_muc.lua @ 2031:f21147d56bc4

mod_mam_muc: Yell loudly when archive store can't be opened
author Kim Alvefur <zash@zash.se>
date Fri, 22 Jan 2016 16:05:22 +0100
parents 9329a11c03a6
children 530feb0e23ff
comparison
equal deleted inserted replaced
2030:66156e4d5274 2031:f21147d56bc4
48 local log_all_rooms = module:get_option_boolean("muc_log_all_rooms", false); 48 local log_all_rooms = module:get_option_boolean("muc_log_all_rooms", false);
49 local log_by_default = module:get_option_boolean("muc_log_by_default", true); 49 local log_by_default = module:get_option_boolean("muc_log_by_default", true);
50 50
51 local archive_store = "muc_log"; 51 local archive_store = "muc_log";
52 local archive = module:open_store(archive_store, "archive"); 52 local archive = module:open_store(archive_store, "archive");
53 if not archive or archive.name == "null" then 53
54 module:log("error", "Could not open archive storage"); 54 if archive.name == "null" or not archive.find then
55 return 55 if not archive.find then
56 elseif not archive.find then 56 module:log("error", "Attempt to open archive storage returned a valid driver but it does not seem to implement the storage API");
57 module:log("error", "mod_%s does not support archiving, switch to mod_storage_sql2", archive._provided_by); 57 module:log("error", "mod_%s does not support archiving", archive._provided_by or archive.name and "storage_"..archive.name.."(?)" or "<unknown>");
58 return 58 else
59 module:log("error", "Attempt to open archive storage returned null driver");
60 end
61 module:log("info", "See https://prosody.im/doc/storage and https://prosody.im/doc/archiving for more information");
62 return false;
59 end 63 end
60 64
61 local function logging_enabled(room) 65 local function logging_enabled(room)
62 if log_all_rooms then 66 if log_all_rooms then
63 return true; 67 return true;