372 session:close({ condition = "host-unknown"; text = "This host does not serve "..session.to_host }); |
372 session:close({ condition = "host-unknown"; text = "This host does not serve "..session.to_host }); |
373 return; |
373 return; |
374 end |
374 end |
375 if session.version >= 1.0 then |
375 if session.version >= 1.0 then |
376 local features = st.stanza("stream:features"); |
376 local features = st.stanza("stream:features"); |
377 |
|
378 if session.to_host then |
377 if session.to_host then |
379 hosts[session.to_host].events.fire_event("s2s-stream-features", { session = session, features = features }); |
378 hosts[session.to_host].events.fire_event("s2s-stream-features", { session = session, features = features }); |
380 else |
379 else |
381 (session.log or log)("warn", "No 'to' on stream header from %s means we can't offer any features", session.from_host or "unknown host"); |
380 (session.log or log)("warn", "No 'to' on stream header from %s means we can't offer any features", session.from_host or "unknown host"); |
382 end |
381 end |
389 if not attr.id then error("stream response did not give us a streamid!!!"); end |
388 if not attr.id then error("stream response did not give us a streamid!!!"); end |
390 session.streamid = attr.id; |
389 session.streamid = attr.id; |
391 |
390 |
392 -- Send unauthed buffer |
391 -- Send unauthed buffer |
393 -- (stanzas which are fine to send before dialback) |
392 -- (stanzas which are fine to send before dialback) |
394 -- Note that this is *not* the stanza queue (which |
393 -- Note that this is *not* the stanza queue (which |
395 -- we can only send if auth succeeds) :) |
394 -- we can only send if auth succeeds) :) |
396 local send_buffer = session.send_buffer; |
395 local send_buffer = session.send_buffer; |
397 if send_buffer and #send_buffer > 0 then |
396 if send_buffer and #send_buffer > 0 then |
398 log("debug", "Sending s2s send_buffer now..."); |
397 log("debug", "Sending s2s send_buffer now..."); |
399 for i, data in ipairs(send_buffer) do |
398 for i, data in ipairs(send_buffer) do |