comparison mod_cloud_notify/mod_cloud_notify.lua @ 2259:e0808be13d77

mod_cloud_notify: Abort and return error if unable to read storage to prevent loss of existing but unreachable data
author Kim Alvefur <zash@zash.se>
date Thu, 28 Jul 2016 12:36:59 +0200
parents 3abc51faf945
children 8cc8e964812b
comparison
equal deleted inserted replaced
2258:3abc51faf945 2259:e0808be13d77
40 local publish_options = enable:get_child("x", "jabber:x:data"); 40 local publish_options = enable:get_child("x", "jabber:x:data");
41 if not publish_options then 41 if not publish_options then
42 -- Could be intentional 42 -- Could be intentional
43 origin.log("debug", "No publish options in request"); 43 origin.log("debug", "No publish options in request");
44 end 44 end
45 local user_push_services = push_enabled:get(origin.username); 45 local user_push_services, rerr = push_enabled:get(origin.username);
46 if not user_push_services then 46 if not user_push_services then
47 if rerr then
48 module:log("warn", "Error reading push notification storage: %s", rerr);
49 origin.send(st.error_reply(stanza, "wait", "internal-server-error"));
50 return true;
51 end
47 user_push_services = {}; 52 user_push_services = {};
48 end 53 end
49 user_push_services[push_jid .. "<" .. (push_node or "")] = { 54 user_push_services[push_jid .. "<" .. (push_node or "")] = {
50 jid = push_jid; 55 jid = push_jid;
51 node = push_node; 56 node = push_node;