132 if data then |
132 if data then |
133 session.data(conn, data); |
133 session.data(conn, data); |
134 end |
134 end |
135 end |
135 end |
136 |
136 |
|
137 function xmppserver.status(conn, status) |
|
138 if status == "ssl-handshake-complete" then |
|
139 local session = sessions[conn]; |
|
140 if session and session.direction == "outgoing" then |
|
141 local format, to_host, from_host = string.format, session.to_host, session.from_host; |
|
142 session.log("warn", "Sending stream header..."); |
|
143 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)); |
|
144 end |
|
145 end |
|
146 end |
|
147 |
137 function xmppserver.disconnect(conn, err) |
148 function xmppserver.disconnect(conn, err) |
138 local session = sessions[conn]; |
149 local session = sessions[conn]; |
139 if session then |
150 if session then |
140 if err and err ~= "closed" and session.srv_hosts then |
151 if err and err ~= "closed" and session.srv_hosts then |
141 (session.log or log)("debug", "s2s connection closed unexpectedly"); |
152 (session.log or log)("debug", "s2s connection closed unexpectedly"); |