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; |