diff options
-rw-r--r-- | net/xmppclient_listener.lua | 5 | ||||
-rw-r--r-- | net/xmppcomponent_listener.lua | 5 | ||||
-rw-r--r-- | net/xmppserver_listener.lua | 5 |
3 files changed, 15 insertions, 0 deletions
diff --git a/net/xmppclient_listener.lua b/net/xmppclient_listener.lua index 35838692..ce7788c7 100644 --- a/net/xmppclient_listener.lua +++ b/net/xmppclient_listener.lua @@ -69,9 +69,14 @@ end 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 client, <stream:error> is: %s", reason); diff --git a/net/xmppcomponent_listener.lua b/net/xmppcomponent_listener.lua index e62bb810..36d74579 100644 --- a/net/xmppcomponent_listener.lua +++ b/net/xmppcomponent_listener.lua @@ -87,9 +87,14 @@ end --- 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); diff --git a/net/xmppserver_listener.lua b/net/xmppserver_listener.lua index 3cfcfe86..81d26526 100644 --- a/net/xmppserver_listener.lua +++ b/net/xmppserver_listener.lua @@ -69,9 +69,14 @@ end 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.sends2s("<?xml version='1.0'?>"); + session.sends2s(st.stanza("stream:stream", default_stream_attr):top_tag()); + end if reason then if type(reason) == "string" then -- assume stream error log("info", "Disconnecting %s[%s], <stream:error> is: %s", session.host or "(unknown host)", session.type, reason); |