aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKim Alvefur <zash@zash.se>2017-09-13 18:18:57 +0200
committerKim Alvefur <zash@zash.se>2017-09-13 18:18:57 +0200
commit5e0e0d2723d721e3ffc6c1b8f35e8008e91d6786 (patch)
tree7b86b1eab7b22d7ca285e37d847fd9f5dccb85a9
parentbc13033a0eef68eca6e213e4b1a3e43e2f4f1589 (diff)
downloadprosody-5e0e0d2723d721e3ffc6c1b8f35e8008e91d6786.tar.gz
prosody-5e0e0d2723d721e3ffc6c1b8f35e8008e91d6786.zip
mod_c2s: Iterate over child tags instead of child nodes in stream error (fixes traceback from #987)
-rw-r--r--plugins/mod_c2s.lua18
1 files changed, 8 insertions, 10 deletions
diff --git a/plugins/mod_c2s.lua b/plugins/mod_c2s.lua
index 2bb919f8..fdb3b211 100644
--- a/plugins/mod_c2s.lua
+++ b/plugins/mod_c2s.lua
@@ -98,16 +98,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 "");