Software /
code /
prosody
Comparison
plugins/mod_s2s/mod_s2s.lua @ 6085:2f911644f527
mod_s2s: Replace open_stream() with function that only adds s2s/dialback attributes to stream header
author | Kim Alvefur <zash@zash.se> |
---|---|
date | Fri, 18 Apr 2014 07:51:41 +0200 |
parent | 6069:446148cad35e |
child | 6146:ac4f8770d9aa |
comparison
equal
deleted
inserted
replaced
6084:3c02a9ed399e | 6085:2f911644f527 |
---|---|
508 conn:close(); -- Close immediately, as this is an outgoing connection or is not authed | 508 conn:close(); -- Close immediately, as this is an outgoing connection or is not authed |
509 end | 509 end |
510 end | 510 end |
511 end | 511 end |
512 | 512 |
513 function session_open_stream(session, from, to) | 513 function session_stream_attrs(session, from, to, attr) |
514 local attr = { | |
515 ["xmlns:stream"] = 'http://etherx.jabber.org/streams', | |
516 xmlns = 'jabber:server', | |
517 version = session.version and (session.version > 0 and "1.0" or nil), | |
518 ["xml:lang"] = 'en', | |
519 id = session.streamid, | |
520 from = from, to = to, | |
521 } | |
522 if not from or (hosts[from] and hosts[from].modules.dialback) then | 514 if not from or (hosts[from] and hosts[from].modules.dialback) then |
523 attr["xmlns:db"] = 'jabber:server:dialback'; | 515 attr["xmlns:db"] = 'jabber:server:dialback'; |
524 end | 516 end |
525 | |
526 session.sends2s("<?xml version='1.0'?>"); | |
527 session.sends2s(st.stanza("stream:stream", attr):top_tag()); | |
528 return true; | |
529 end | 517 end |
530 | 518 |
531 -- Session initialization logic shared by incoming and outgoing | 519 -- Session initialization logic shared by incoming and outgoing |
532 local function initialize_session(session) | 520 local function initialize_session(session) |
533 local stream = new_xmpp_stream(session, stream_callbacks); | 521 local stream = new_xmpp_stream(session, stream_callbacks); |
538 function session.reset_stream() | 526 function session.reset_stream() |
539 session.notopen = true; | 527 session.notopen = true; |
540 session.stream:reset(); | 528 session.stream:reset(); |
541 end | 529 end |
542 | 530 |
543 session.open_stream = session_open_stream; | 531 session.stream_attrs = session_stream_attrs; |
544 | 532 |
545 local filter = session.filter; | 533 local filter = session.filter; |
546 function session.data(data) | 534 function session.data(data) |
547 data = filter("bytes/in", data); | 535 data = filter("bytes/in", data); |
548 if data then | 536 if data then |