Mercurial > prosody-hg
comparison net/xmppserver_listener.lua @ 2129:fcdcdf00787c
*_listener: Update for new net.server API, specifically .listener -> .onincoming, .disconnect -> .ondisconnect
| author | Matthew Wild <mwild1@gmail.com> |
|---|---|
| date | Sun, 22 Nov 2009 04:43:46 +0000 |
| parents | e33658f6052c |
| children | 8d33f94dc3a1 |
comparison
equal
deleted
inserted
replaced
| 2128:f107f0205793 | 2129:fcdcdf00787c |
|---|---|
| 102 session.sends2s("</stream:stream>"); | 102 session.sends2s("</stream:stream>"); |
| 103 if session.notopen or not session.conn.close() then | 103 if session.notopen or not session.conn.close() then |
| 104 session.conn.close(true); -- Force FIXME: timer? | 104 session.conn.close(true); -- Force FIXME: timer? |
| 105 end | 105 end |
| 106 session.conn.close(); | 106 session.conn.close(); |
| 107 xmppserver.disconnect(session.conn, "stream error"); | 107 xmppserver.ondisconnect(session.conn, "stream error"); |
| 108 end | 108 end |
| 109 end | 109 end |
| 110 | 110 |
| 111 | 111 |
| 112 -- End of session methods -- | 112 -- End of session methods -- |
| 113 | 113 |
| 114 function xmppserver.listener(conn, data) | 114 function xmppserver.onincoming(conn, data) |
| 115 local session = sessions[conn]; | 115 local session = sessions[conn]; |
| 116 if not session then | 116 if not session then |
| 117 session = s2s_new_incoming(conn); | 117 session = s2s_new_incoming(conn); |
| 118 sessions[conn] = session; | 118 sessions[conn] = session; |
| 119 | 119 |
| 146 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)); | 146 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)); |
| 147 end | 147 end |
| 148 end | 148 end |
| 149 end | 149 end |
| 150 | 150 |
| 151 function xmppserver.disconnect(conn, err) | 151 function xmppserver.ondisconnect(conn, err) |
| 152 local session = sessions[conn]; | 152 local session = sessions[conn]; |
| 153 if session then | 153 if session then |
| 154 if err and err ~= "closed" and session.srv_hosts then | 154 if err and err ~= "closed" and session.srv_hosts then |
| 155 (session.log or log)("debug", "s2s connection closed unexpectedly"); | 155 (session.log or log)("debug", "s2s connection closed unexpectedly"); |
| 156 if s2s_attempt_connect(session, err) then | 156 if s2s_attempt_connect(session, err) then |
