Mercurial > prosody-hg
comparison plugins/mod_component.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 |
| parents | ef22c17cc24d |
| children | 97b3ca502547 |
comparison
equal
deleted
inserted
replaced
| 8232:176b7f4e4ac9 | 8233:4e7269c53659 |
|---|---|
| 149 elseif error == "parse-error" then | 149 elseif error == "parse-error" then |
| 150 session.log("warn", "External component %s XML parse error: %s", tostring(session.host), tostring(data)); | 150 session.log("warn", "External component %s XML parse error: %s", tostring(session.host), tostring(data)); |
| 151 session:close("not-well-formed"); | 151 session:close("not-well-formed"); |
| 152 elseif error == "stream-error" then | 152 elseif error == "stream-error" then |
| 153 local condition, text = "undefined-condition"; | 153 local condition, text = "undefined-condition"; |
| 154 for child in data:children() do | 154 for child in data:childtags(nil, xmlns_xmpp_streams) do |
| 155 if child.attr.xmlns == xmlns_xmpp_streams then | 155 if child.name ~= "text" then |
| 156 if child.name ~= "text" then | 156 condition = child.name; |
| 157 condition = child.name; | 157 else |
| 158 else | 158 text = child:get_text(); |
| 159 text = child:get_text(); | 159 end |
| 160 end | 160 if condition ~= "undefined-condition" and text then |
| 161 if condition ~= "undefined-condition" and text then | 161 break; |
| 162 break; | |
| 163 end | |
| 164 end | 162 end |
| 165 end | 163 end |
| 166 text = condition .. (text and (" ("..text..")") or ""); | 164 text = condition .. (text and (" ("..text..")") or ""); |
| 167 session.log("info", "Session closed by remote with error: %s", text); | 165 session.log("info", "Session closed by remote with error: %s", text); |
| 168 session:close(nil, text); | 166 session:close(nil, text); |
