Mercurial > prosody-modules
comparison mod_mam_muc/mod_mam_muc.lua @ 1311:27b2a357c73c
mod_mam_muc: porting archive checks from mod_mam (to avoid tracebacks about calling null functions)
author | Vadim Misbakh-Soloviov <mva@mva.name> |
---|---|
date | Wed, 19 Feb 2014 18:03:39 +0700 |
parents | 2118a2eeb1d5 |
children | a48cf3ccdf9c |
comparison
equal
deleted
inserted
replaced
1310:2df312eb816d | 1311:27b2a357c73c |
---|---|
28 | 28 |
29 local log_all_rooms = module:get_option_boolean("muc_log_all_rooms", false); | 29 local log_all_rooms = module:get_option_boolean("muc_log_all_rooms", false); |
30 local log_by_default = module:get_option_boolean("muc_log_by_default", true); | 30 local log_by_default = module:get_option_boolean("muc_log_by_default", true); |
31 local advertise_archive = module:get_option_boolean("muc_log_advertise", true); | 31 local advertise_archive = module:get_option_boolean("muc_log_advertise", true); |
32 | 32 |
33 local archive = module:open_store("archive2", "archive"); | 33 local archive_store = "archive2"; |
34 local archive = module:open_store(archive_store, "archive"); | |
35 if not archive then | |
36 module:log("error", "Could not open archive storage"); | |
37 return | |
38 elseif not archive.find then | |
39 module:log("error", "mod_%s does not support archiving, switch to mod_storage_sql2", archive._provided_by); | |
40 return | |
41 end | |
42 | |
34 local rooms = hosts[module.host].modules.muc.rooms; | 43 local rooms = hosts[module.host].modules.muc.rooms; |
35 | 44 |
36 if not log_all_rooms then | 45 if not log_all_rooms then |
37 module:hook("muc-config-form", function(event) | 46 module:hook("muc-config-form", function(event) |
38 local room, form = event.room, event.form; | 47 local room, form = event.room, event.form; |