changeset 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 2d83e6c8160b
children 777d07e0cd73
files mod_cloud_notify/mod_cloud_notify.lua
diffstat 1 files changed, 5 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/mod_cloud_notify/mod_cloud_notify.lua	Wed Mar 22 19:47:52 2017 +0100
+++ b/mod_cloud_notify/mod_cloud_notify.lua	Thu Mar 23 09:17:56 2017 +0000
@@ -55,7 +55,10 @@
 	return api;
 end)();
 
-local function handle_push_error(event)
+-- Forward declarations, as both functions need to reference each other
+local handle_push_success, handle_push_error;
+
+function handle_push_error(event)
 	local stanza = event.stanza;
 	local error_type, condition = stanza:get_error();
 	local node = jid.split(stanza.attr.to);
@@ -94,7 +97,7 @@
 	return true;
 end
 
-local function handle_push_success(event)
+function handle_push_success(event)
 	local stanza = event.stanza;
 	local node = jid.split(stanza.attr.to);
 	local from = stanza.attr.from;