aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKim Alvefur <zash@zash.se>2017-09-14 01:27:36 +0200
committerKim Alvefur <zash@zash.se>2017-09-14 01:27:36 +0200
commit5dee36d8385e36c4d72a97a33cf3c934af3d6633 (patch)
treea9b92a43a132af45694c9650f643c0b0ef2ae332
parent12cdea49b391a7b2dea63856f4a689ed5668ea09 (diff)
downloadprosody-5dee36d8385e36c4d72a97a33cf3c934af3d6633.tar.gz
prosody-5dee36d8385e36c4d72a97a33cf3c934af3d6633.zip
mod_component, mod_s2s: Iterate over child tags instead of child nodes (can include text) in stream error (same as 176b7f4e4ac9)
-rw-r--r--plugins/mod_component.lua18
-rw-r--r--plugins/mod_s2s/mod_s2s.lua18
2 files changed, 16 insertions, 20 deletions
diff --git a/plugins/mod_component.lua b/plugins/mod_component.lua
index 11abab79..acd70c60 100644
--- a/plugins/mod_component.lua
+++ b/plugins/mod_component.lua
@@ -151,16 +151,14 @@ function stream_callbacks.error(session, error, data, data2)
session:close("not-well-formed");
elseif error == "stream-error" then
local condition, text = "undefined-condition";
- for child in data:children() do
- if child.attr.xmlns == xmlns_xmpp_streams then
- if child.name ~= "text" then
- condition = child.name;
- else
- text = child:get_text();
- end
- if condition ~= "undefined-condition" and text then
- break;
- end
+ for child in data:childtags(nil, xmlns_xmpp_streams) do
+ if child.name ~= "text" then
+ condition = child.name;
+ else
+ text = child:get_text();
+ end
+ if condition ~= "undefined-condition" and text then
+ break;
end
end
text = condition .. (text and (" ("..text..")") or "");
diff --git a/plugins/mod_s2s/mod_s2s.lua b/plugins/mod_s2s/mod_s2s.lua
index e038e5b4..10b81a17 100644
--- a/plugins/mod_s2s/mod_s2s.lua
+++ b/plugins/mod_s2s/mod_s2s.lua
@@ -416,16 +416,14 @@ function stream_callbacks.error(session, error, data)
session:close("not-well-formed");
elseif error == "stream-error" then
local condition, text = "undefined-condition";
- for child in data:children() do
- if child.attr.xmlns == xmlns_xmpp_streams then
- if child.name ~= "text" then
- condition = child.name;
- else
- text = child:get_text();
- end
- if condition ~= "undefined-condition" and text then
- break;
- end
+ for child in data:childtags(nil, xmlns_xmpp_streams) do
+ if child.name ~= "text" then
+ condition = child.name;
+ else
+ text = child:get_text();
+ end
+ if condition ~= "undefined-condition" and text then
+ break;
end
end
text = condition .. (text and (" ("..text..")") or "");