Mercurial > prosody-hg
diff net/xmppcomponent_listener.lua @ 1617:c6e175a0d83b
xmpp{client,server,component]_listener: Open stream if sending an error and it isn't already open. Fixes #120
| author | Matthew Wild <mwild1@gmail.com> |
|---|---|
| date | Tue, 28 Jul 2009 19:15:29 +0100 |
| parents | 841d61be198f |
| children | 33d087466767 |
line wrap: on
line diff
--- a/net/xmppcomponent_listener.lua Tue Jul 28 18:47:59 2009 +0100 +++ b/net/xmppcomponent_listener.lua Tue Jul 28 19:15:29 2009 +0100 @@ -87,9 +87,14 @@ --- Closing a component connection local stream_xmlns_attr = {xmlns='urn:ietf:params:xml:ns:xmpp-streams'}; +local default_stream_attr = { ["xmlns:stream"] = stream_callbacks.stream_tag:gsub("%|[^|]+$", ""), xmlns = stream_callbacks.default_ns, version = "1.0", id = "" }; local function session_close(session, reason) local log = session.log or log; if session.conn then + if session.notopen then + session.send("<?xml version='1.0'?>"); + session.send(st.stanza("stream:stream", default_stream_attr):top_tag()); + end if reason then if type(reason) == "string" then -- assume stream error log("info", "Disconnecting component, <stream:error> is: %s", reason);
