comparison mod_cloud_notify/mod_cloud_notify.lua @ 2642:0f1421af7f6a

mod_cloud_notify: Move declarations of handle_push_success/error to fix referencing undefined variables (introduced in 6ab46ff685d0)
author Matthew Wild <mwild1@gmail.com>
date Thu, 23 Mar 2017 09:17:56 +0000
parents 8c6562f16496
children 777d07e0cd73
comparison
equal deleted inserted replaced
2641:2d83e6c8160b 2642:0f1421af7f6a
53 return self:set(user, services); 53 return self:set(user, services);
54 end 54 end
55 return api; 55 return api;
56 end)(); 56 end)();
57 57
58 local function handle_push_error(event) 58 -- Forward declarations, as both functions need to reference each other
59 local handle_push_success, handle_push_error;
60
61 function handle_push_error(event)
59 local stanza = event.stanza; 62 local stanza = event.stanza;
60 local error_type, condition = stanza:get_error(); 63 local error_type, condition = stanza:get_error();
61 local node = jid.split(stanza.attr.to); 64 local node = jid.split(stanza.attr.to);
62 local from = stanza.attr.from; 65 local from = stanza.attr.from;
63 local user_push_services = push_store:get(node); 66 local user_push_services = push_store:get(node);
92 end 95 end
93 end 96 end
94 return true; 97 return true;
95 end 98 end
96 99
97 local function handle_push_success(event) 100 function handle_push_success(event)
98 local stanza = event.stanza; 101 local stanza = event.stanza;
99 local node = jid.split(stanza.attr.to); 102 local node = jid.split(stanza.attr.to);
100 local from = stanza.attr.from; 103 local from = stanza.attr.from;
101 local user_push_services = push_store:get(node); 104 local user_push_services = push_store:get(node);
102 105