Comparison

mod_mam/mod_mam.lua @ 1185:30b681898c2d

mod_mam: Log error message if unable to open archive storage
author Kim Alvefur <zash@zash.se>
date Thu, 05 Sep 2013 15:22:31 +0200
parent 1152:01fa82074b62
child 1186:a172e7389cf6
comparison
equal deleted inserted replaced
1184:0d3d15586d7e 1185:30b681898c2d
32 local default_max_items, max_max_items = 20, module:get_option_number("max_archive_query_results", 50); 32 local default_max_items, max_max_items = 20, module:get_option_number("max_archive_query_results", 50);
33 local global_default_policy = module:get_option("default_archive_policy", false); 33 local global_default_policy = module:get_option("default_archive_policy", false);
34 34
35 local archive_store = "archive2"; 35 local archive_store = "archive2";
36 local archive = module:open_store(archive_store, "archive"); 36 local archive = module:open_store(archive_store, "archive");
37 if not archive then
38 module:log("error", "Could not open archive storage");
39 return
40 elseif not archive.find then
41 module:log("error", "mod_%s does not support archiving, switch to mod_storage_sql2", archive._provided_by);
42 return
43 end
37 44
38 -- Handle prefs. 45 -- Handle prefs.
39 module:hook("iq/self/"..xmlns_mam..":prefs", function(event) 46 module:hook("iq/self/"..xmlns_mam..":prefs", function(event)
40 local origin, stanza = event.origin, event.stanza; 47 local origin, stanza = event.origin, event.stanza;
41 local user = origin.username; 48 local user = origin.username;