mod_rest/mod_rest.lua
changeset 4947 e67cc71727ca
parent 4946 83a54f4af94c
child 4959 537054999093
equal deleted inserted replaced
4946:83a54f4af94c 4947:e67cc71727ca
   387 
   387 
   388 		local p = module:send_iq(payload, origin):next(
   388 		local p = module:send_iq(payload, origin):next(
   389 			function (result)
   389 			function (result)
   390 				module:log("debug", "Sending[rest]: %s", result.stanza:top_tag());
   390 				module:log("debug", "Sending[rest]: %s", result.stanza:top_tag());
   391 				response.headers.content_type = send_type;
   391 				response.headers.content_type = send_type;
   392 				local tail = responses[#responses];
   392 				if responses[1] then
   393 				if tail.name ~= "iq" or tail.attr.from ~= result.stanza.attr.from or tail.attr.id ~= result.stanza.attr.id then
   393 					local tail = responses[#responses];
   394 					origin.send(result.stanza);
   394 					if tail.name ~= "iq" or tail.attr.from ~= result.stanza.attr.from or tail.attr.id ~= result.stanza.attr.id then
       
   395 						origin.send(result.stanza);
       
   396 					end
   395 				end
   397 				end
   396 				if responses[2] then
   398 				if responses[2] then
   397 					return encode(send_type, responses);
   399 					return encode(send_type, responses);
   398 				end
   400 				end
   399 				return encode(send_type, result.stanza);
   401 				return encode(send_type, result.stanza);