aboutsummaryrefslogtreecommitdiffstats
path: root/net/xmppclient_listener.lua
diff options
context:
space:
mode:
authorMatthew Wild <mwild1@gmail.com>2010-03-15 03:18:33 +0000
committerMatthew Wild <mwild1@gmail.com>2010-03-15 03:18:33 +0000
commited5b64df222bf1e7abc5aa7801f387f090ad2214 (patch)
tree9a83b9236b92ccbe0ad8d9277bcc565966b39be3 /net/xmppclient_listener.lua
parent456cd9c62a173637f18d2c613e3514919369ad90 (diff)
parent2650d367fa08e67a0a1f6cfbaaebf5fd3221ecd6 (diff)
downloadprosody-ed5b64df222bf1e7abc5aa7801f387f090ad2214.tar.gz
prosody-ed5b64df222bf1e7abc5aa7801f387f090ad2214.zip
Merge with 0.7 (and indirectly 0.6.2)
Diffstat (limited to 'net/xmppclient_listener.lua')
-rw-r--r--net/xmppclient_listener.lua23
1 files changed, 21 insertions, 2 deletions
diff --git a/net/xmppclient_listener.lua b/net/xmppclient_listener.lua
index 3a0c65be..0d0e92ce 100644
--- a/net/xmppclient_listener.lua
+++ b/net/xmppclient_listener.lua
@@ -33,13 +33,32 @@ local opt_keepalives = config.get("*", "core", "tcp_keepalives");
local stream_callbacks = { default_ns = "jabber:client",
streamopened = sm_streamopened, streamclosed = sm_streamclosed, handlestanza = core_process_stanza };
+local xmlns_xmpp_streams = "urn:ietf:params:xml:ns:xmpp-streams";
+
function stream_callbacks.error(session, error, data)
if error == "no-stream" then
session.log("debug", "Invalid opening stream header");
session:close("invalid-namespace");
- elseif session.close then
- (session.log or log)("debug", "Client XML parse error: %s", tostring(error));
+ elseif error == "parse-error" then
+ (session.log or log)("debug", "Client XML parse error: %s", tostring(data));
session:close("xml-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
+ end
+ end
+ text = condition .. (text and (" ("..text..")") or "");
+ session.log("info", "Session closed by remote with error: %s", text);
+ session:close(nil, text);
end
end