Changeset

5758:ebc074918173

adhoc.lib: Don't build error reply from reply stanza
author Kim Alvefur <zash@zash.se>
date Wed, 24 Jul 2013 21:49:36 +0200
parents 5757:b5ba004beb0a
children 5759:767e29b2cd3a 5766:e6a9085f0ac3
files plugins/adhoc/adhoc.lib.lua
diffstat 1 files changed, 5 insertions(+), 5 deletions(-) [+]
line wrap: on
line diff
--- a/plugins/adhoc/adhoc.lib.lua	Wed Jul 24 15:28:36 2013 +0200
+++ b/plugins/adhoc/adhoc.lib.lua	Wed Jul 24 21:49:36 2013 +0200
@@ -34,7 +34,6 @@
 
 	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;
@@ -44,8 +43,8 @@
 		cmdtag = command:cmdtag("canceled", sessionid);
 	elseif data.status == "error" then
 		states[sessionid] = nil;
-		stanza = st.error_reply(stanza, data.error.type, data.error.condition, data.error.message);
-		origin.send(stanza);
+		local reply = st.error_reply(stanza, data.error.type, data.error.condition, data.error.message);
+		origin.send(reply);
 		return true;
 	else
 		cmdtag = command:cmdtag("executing", sessionid);
@@ -78,8 +77,9 @@
 			cmdtag:add_child(content);
 		end
 	end
-	stanza:add_child(cmdtag);
-	origin.send(stanza);
+	local reply = st.reply(stanza);
+	reply:add_child(cmdtag);
+	origin.send(reply);
 
 	return true;
 end