Comparison

plugins/mod_s2s/mod_s2s.lua @ 8233:4e7269c53659

mod_component, mod_s2s: Iterate over child tags instead of child nodes (can include text) in stream error (same as 176b7f4e4ac9)
author Kim Alvefur <zash@zash.se>
date Thu, 14 Sep 2017 01:27:36 +0200
parent 7677:8613086779fa
child 8234:97b3ca502547
comparison
equal deleted inserted replaced
8232:176b7f4e4ac9 8233:4e7269c53659
414 elseif error == "parse-error" then 414 elseif error == "parse-error" then
415 session.log("debug", "Server-to-server XML parse error: %s", tostring(error)); 415 session.log("debug", "Server-to-server XML parse error: %s", tostring(error));
416 session:close("not-well-formed"); 416 session:close("not-well-formed");
417 elseif error == "stream-error" then 417 elseif error == "stream-error" then
418 local condition, text = "undefined-condition"; 418 local condition, text = "undefined-condition";
419 for child in data:children() do 419 for child in data:childtags(nil, xmlns_xmpp_streams) do
420 if child.attr.xmlns == xmlns_xmpp_streams then 420 if child.name ~= "text" then
421 if child.name ~= "text" then 421 condition = child.name;
422 condition = child.name; 422 else
423 else 423 text = child:get_text();
424 text = child:get_text(); 424 end
425 end 425 if condition ~= "undefined-condition" and text then
426 if condition ~= "undefined-condition" and text then 426 break;
427 break;
428 end
429 end 427 end
430 end 428 end
431 text = condition .. (text and (" ("..text..")") or ""); 429 text = condition .. (text and (" ("..text..")") or "");
432 session.log("info", "Session closed by remote with error: %s", text); 430 session.log("info", "Session closed by remote with error: %s", text);
433 session:close(nil, text); 431 session:close(nil, text);