Software / code / prosody
Comparison
core/s2smanager.lua @ 345:6a7acfc1c933
Send version=1.0 in s2s stream header. Send s2s stream:features when in 1.0 mode.
| author | Matthew Wild <mwild1@gmail.com> |
|---|---|
| date | Wed, 19 Nov 2008 05:13:07 +0000 |
| parent | 344:ed5824e9dd94 |
| child | 346:22c8f7d412a1 |
comparison
equal
deleted
inserted
replaced
| 344:ed5824e9dd94 | 345:6a7acfc1c933 |
|---|---|
| 158 session.from_host = attr.from; | 158 session.from_host = attr.from; |
| 159 | 159 |
| 160 session.streamid = uuid_gen(); | 160 session.streamid = uuid_gen(); |
| 161 print(session, session.from_host, "incoming s2s stream opened"); | 161 print(session, session.from_host, "incoming s2s stream opened"); |
| 162 send("<?xml version='1.0'?>"); | 162 send("<?xml version='1.0'?>"); |
| 163 send(stanza("stream:stream", { xmlns='jabber:server', ["xmlns:db"]='jabber:server:dialback', ["xmlns:stream"]='http://etherx.jabber.org/streams', id=session.streamid, from=session.to_host }):top_tag()); | 163 send(stanza("stream:stream", { version = '1.0', xmlns='jabber:server', ["xmlns:db"]='jabber:server:dialback', ["xmlns:stream"]='http://etherx.jabber.org/streams', id=session.streamid, from=session.to_host }):top_tag()); |
| 164 if session.to_host and not hosts[session.to_host] then | 164 if session.to_host and not hosts[session.to_host] then |
| 165 -- Attempting to connect to a host we don't serve | 165 -- Attempting to connect to a host we don't serve |
| 166 session:close("host-unknown"); | 166 session:close("host-unknown"); |
| 167 return; | 167 return; |
| 168 end | 168 end |
| 169 if session.version >= 1.0 then | |
| 170 send(st.stanza("stream:features") | |
| 171 :tag("dialback", { xmlns='urn:xmpp:features:dialback' }):tag("optional"):up():up()); | |
| 172 end | |
| 173 --[[ | |
| 174 local features = {}; | |
| 175 modulemanager.fire_event("stream-features-s2s", session, features); | |
| 176 | |
| 177 send("<stream:features>"); | |
| 178 | |
| 179 for _, feature in ipairs(features) do | |
| 180 send(tostring(feature)); | |
| 181 end | |
| 182 | |
| 183 send("</stream:features>"); | |
| 184 ]] | |
| 169 elseif session.direction == "outgoing" then | 185 elseif session.direction == "outgoing" then |
| 170 -- If we are just using the connection for verifying dialback keys, we won't try and auth it | 186 -- If we are just using the connection for verifying dialback keys, we won't try and auth it |
| 171 if not attr.id then error("stream response did not give us a streamid!!!"); end | 187 if not attr.id then error("stream response did not give us a streamid!!!"); end |
| 172 session.streamid = attr.id; | 188 session.streamid = attr.id; |
| 173 | 189 |
| 175 initiate_dialback(session); | 191 initiate_dialback(session); |
| 176 else | 192 else |
| 177 mark_connected(session); | 193 mark_connected(session); |
| 178 end | 194 end |
| 179 end | 195 end |
| 180 --[[ | |
| 181 local features = {}; | |
| 182 modulemanager.fire_event("stream-features-s2s", session, features); | |
| 183 | |
| 184 send("<stream:features>"); | |
| 185 | |
| 186 for _, feature in ipairs(features) do | |
| 187 send(tostring(feature)); | |
| 188 end | |
| 189 | |
| 190 send("</stream:features>");]] | |
| 191 | 196 |
| 192 session.notopen = nil; | 197 session.notopen = nil; |
| 193 end | 198 end |
| 194 | 199 |
| 195 function initiate_dialback(session) | 200 function initiate_dialback(session) |