Diff

plugins/adhoc/adhoc.lib.lua @ 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
parent 5075:4d939d2b1574
child 6302:76699a0ae4c4
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