Diff

libs/adhoc.lib.lua @ 383:72be3c2cf602

libs.adhoc: Don't set unintentional globals
author Kim Alvefur <zash@zash.se>
date Tue, 05 May 2015 01:10:33 +0200
parent 198:f6702e7ce5f9
child 457:73d4eb93657b
line wrap: on
line diff
--- a/libs/adhoc.lib.lua	Tue May 05 01:08:20 2015 +0200
+++ b/libs/adhoc.lib.lua	Tue May 05 01:10:33 2015 +0200
@@ -12,7 +12,7 @@
 
 local _M = {};
 
-function _cmdtag(desc, status, sessionid, action)
+local function _cmdtag(desc, status, sessionid, action)
 	local cmd = st.stanza("command", { xmlns = xmlns_cmd, node = desc.node, status = status });
 	if sessionid then cmd.attr.sessionid = sessionid; end
 	if action then cmd.attr.action = action; end
@@ -35,6 +35,7 @@
 	local data, state = command:handler(dataIn, states[sessionid]);
 	states[sessionid] = state;
 	local stanza = st.reply(stanza);
+	local cmdtag;
 	if data.status == "completed" then
 		states[sessionid] = nil;
 		cmdtag = command:cmdtag("completed", sessionid);