diff options
author | Matthew Wild <mwild1@gmail.com> | 2009-10-04 14:35:39 +0100 |
---|---|---|
committer | Matthew Wild <mwild1@gmail.com> | 2009-10-04 14:35:39 +0100 |
commit | e6396f07f3812da675ec5cb248b9d04d51f7d168 (patch) | |
tree | d0f717198d5801e7bd240b3094cccf86148a61b3 | |
parent | 0cd9b39dbaf932b221328d3c0e91aa19d32e2a53 (diff) | |
download | prosody-e6396f07f3812da675ec5cb248b9d04d51f7d168.tar.gz prosody-e6396f07f3812da675ec5cb248b9d04d51f7d168.zip |
xmppserver_listener: Add status() function to signal when a connection completes its SSL handshake
-rw-r--r-- | net/xmppserver_listener.lua | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/net/xmppserver_listener.lua b/net/xmppserver_listener.lua index 92b3b716..c7ff8379 100644 --- a/net/xmppserver_listener.lua +++ b/net/xmppserver_listener.lua @@ -134,6 +134,17 @@ function xmppserver.listener(conn, data) end end +function xmppserver.status(conn, status) + if status == "ssl-handshake-complete" then + local session = sessions[conn]; + if session and session.direction == "outgoing" then + local format, to_host, from_host = string.format, session.to_host, session.from_host; + session.log("warn", "Sending stream header..."); + session.sends2s(format([[<stream:stream xmlns='jabber:server' xmlns:db='jabber:server:dialback' xmlns:stream='http://etherx.jabber.org/streams' from='%s' to='%s' version='1.0'>]], from_host, to_host)); + end + end +end + function xmppserver.disconnect(conn, err) local session = sessions[conn]; if session then |