Comparison

plugins/mod_s2s/mod_s2s.lua @ 6069:446148cad35e

mod_s2s: Revert e626ee2fe106 change, it broke Dialback
author Kim Alvefur <zash@zash.se>
date Thu, 10 Apr 2014 16:49:59 +0200
parent 6063:e626ee2fe106
child 6085:2f911644f527
comparison
equal deleted inserted replaced
6067:dab7ad6fa23c 6069:446148cad35e
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)
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
523 attr["xmlns:db"] = 'jabber:server:dialback';
524 end
525
526 session.sends2s("<?xml version='1.0'?>");
527 session.sends2s(st.stanza("stream:stream", attr):top_tag());
528 return true;
529 end
530
513 -- Session initialization logic shared by incoming and outgoing 531 -- Session initialization logic shared by incoming and outgoing
514 local function initialize_session(session) 532 local function initialize_session(session)
515 local stream = new_xmpp_stream(session, stream_callbacks); 533 local stream = new_xmpp_stream(session, stream_callbacks);
516 session.stream = stream; 534 session.stream = stream;
517 535
519 537
520 function session.reset_stream() 538 function session.reset_stream()
521 session.notopen = true; 539 session.notopen = true;
522 session.stream:reset(); 540 session.stream:reset();
523 end 541 end
542
543 session.open_stream = session_open_stream;
524 544
525 local filter = session.filter; 545 local filter = session.filter;
526 function session.data(data) 546 function session.data(data)
527 data = filter("bytes/in", data); 547 data = filter("bytes/in", data);
528 if data then 548 if data then