Mercurial > prosody-hg
comparison plugins/mod_s2s/s2sout.lib.lua @ 5351:901ed253bbf7
mod_s2s, mod_saslauth, mod_compression: Refactor to have common code for opening streams
| author | Kim Alvefur <zash@zash.se> |
|---|---|
| date | Sat, 16 Mar 2013 17:46:43 +0100 |
| parents | 8b94a8d92cf3 |
| children | 43059357b2f0 |
comparison
equal
deleted
inserted
replaced
| 5350:fba042a2c228 | 5351:901ed253bbf7 |
|---|---|
| 42 | 42 |
| 43 local function compare_srv_priorities(a,b) | 43 local function compare_srv_priorities(a,b) |
| 44 return a.priority < b.priority or (a.priority == b.priority and a.weight > b.weight); | 44 return a.priority < b.priority or (a.priority == b.priority and a.weight > b.weight); |
| 45 end | 45 end |
| 46 | 46 |
| 47 local function session_open_stream(session, from, to) | |
| 48 session.sends2s(st.stanza("stream:stream", { | |
| 49 xmlns='jabber:server', ["xmlns:db"]='jabber:server:dialback', | |
| 50 ["xmlns:stream"]='http://etherx.jabber.org/streams', | |
| 51 from=from, to=to, version='1.0', ["xml:lang"]='en'}):top_tag()); | |
| 52 end | |
| 53 | |
| 54 function s2sout.initiate_connection(host_session) | 47 function s2sout.initiate_connection(host_session) |
| 55 initialize_filters(host_session); | 48 initialize_filters(host_session); |
| 49 host_session.version = 1; | |
| 56 host_session.open_stream = session_open_stream; | 50 host_session.open_stream = session_open_stream; |
| 57 | 51 |
| 58 -- Kick the connection attempting machine into life | 52 -- Kick the connection attempting machine into life |
| 59 if not s2sout.attempt_connection(host_session) then | 53 if not s2sout.attempt_connection(host_session) then |
| 60 -- Intentionally not returning here, the | 54 -- Intentionally not returning here, the |
