Software /
code /
prosody
Comparison
core/s2smanager.lua @ 2780:f8232abcab2a
s2smanager: Send reply stream header only after checking we serve this host (sorry darkrain... :) )
author | Matthew Wild <mwild1@gmail.com> |
---|---|
date | Thu, 17 Dec 2009 21:36:31 +0000 |
parent | 2760:604db849f111 |
child | 2781:4b5881b6bbfc |
comparison
equal
deleted
inserted
replaced
2779:87b66be6d514 | 2780:f8232abcab2a |
---|---|
367 session.to_host = attr.to and nameprep(attr.to); | 367 session.to_host = attr.to and nameprep(attr.to); |
368 session.from_host = attr.from and nameprep(attr.from); | 368 session.from_host = attr.from and nameprep(attr.from); |
369 | 369 |
370 session.streamid = uuid_gen(); | 370 session.streamid = uuid_gen(); |
371 (session.log or log)("debug", "incoming s2s received <stream:stream>"); | 371 (session.log or log)("debug", "incoming s2s received <stream:stream>"); |
372 send("<?xml version='1.0'?>"); | |
373 send(stanza("stream:stream", { xmlns='jabber:server', ["xmlns:db"]='jabber:server:dialback', | |
374 ["xmlns:stream"]='http://etherx.jabber.org/streams', id=session.streamid, from=session.to_host, version=(session.version > 0 and "1.0" or nil) }):top_tag()); | |
375 if session.to_host and not hosts[session.to_host] then | 372 if session.to_host and not hosts[session.to_host] then |
376 -- Attempting to connect to a host we don't serve | 373 -- Attempting to connect to a host we don't serve |
377 session:close({ condition = "host-unknown"; text = "This host does not serve "..session.to_host }); | 374 session:close({ condition = "host-unknown"; text = "This host does not serve "..session.to_host }); |
378 return; | 375 return; |
379 end | 376 end |
377 send("<?xml version='1.0'?>"); | |
378 send(stanza("stream:stream", { xmlns='jabber:server', ["xmlns:db"]='jabber:server:dialback', | |
379 ["xmlns:stream"]='http://etherx.jabber.org/streams', id=session.streamid, from=session.to_host, version=(session.version > 0 and "1.0" or nil) }):top_tag()); | |
380 if session.version >= 1.0 then | 380 if session.version >= 1.0 then |
381 local features = st.stanza("stream:features"); | 381 local features = st.stanza("stream:features"); |
382 | 382 |
383 if session.to_host then | 383 if session.to_host then |
384 hosts[session.to_host].events.fire_event("s2s-stream-features", { session = session, features = features }); | 384 hosts[session.to_host].events.fire_event("s2s-stream-features", { session = session, features = features }); |
385 else | 385 else |
386 (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"); | 386 (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"); |
387 end | 387 end |