Software /
code /
prosody
Comparison
plugins/mod_s2s/mod_s2s.lua @ 10500:493cbfe99b64
mod_s2s: Fix name conflict introduced in c7864f970969
author | Kim Alvefur <zash@zash.se> |
---|---|
date | Tue, 10 Dec 2019 17:43:26 +0100 |
parent | 10483:c12a24f0a385 |
child | 10513:7a82f7ecf0ce |
comparison
equal
deleted
inserted
replaced
10499:79c568d4146c | 10500:493cbfe99b64 |
---|---|
504 else | 504 else |
505 session:open_stream(session.from_host, session.to_host); | 505 session:open_stream(session.from_host, session.to_host); |
506 end | 506 end |
507 end | 507 end |
508 if reason then -- nil == no err, initiated by us, false == initiated by remote | 508 if reason then -- nil == no err, initiated by us, false == initiated by remote |
509 local stream_error; | |
509 if type(reason) == "string" then -- assume stream error | 510 if type(reason) == "string" then -- assume stream error |
510 reason = st.stanza("stream:error"):tag(reason, {xmlns = 'urn:ietf:params:xml:ns:xmpp-streams' }); | 511 stream_error = st.stanza("stream:error"):tag(reason, {xmlns = 'urn:ietf:params:xml:ns:xmpp-streams' }); |
511 elseif type(reason) == "table" and not st.is_stanza(reason) then | 512 elseif type(reason) == "table" and not st.is_stanza(reason) then |
512 local stanza = st.stanza("stream:error"):tag(reason.condition or "undefined-condition", stream_xmlns_attr):up(); | 513 stream_error = st.stanza("stream:error"):tag(reason.condition or "undefined-condition", stream_xmlns_attr):up(); |
513 if reason.text then | 514 if reason.text then |
514 stanza:tag("text", stream_xmlns_attr):text(reason.text):up(); | 515 stream_error:tag("text", stream_xmlns_attr):text(reason.text):up(); |
515 end | 516 end |
516 if reason.extra then | 517 if reason.extra then |
517 stanza:add_child(reason.extra); | 518 stream_error:add_child(reason.extra); |
518 end | 519 end |
519 reason = stanza; | 520 end |
520 end | 521 if st.is_stanza(stream_error) then |
521 if st.is_stanza(reason) then | |
522 -- to and from are never unknown on outgoing connections | 522 -- to and from are never unknown on outgoing connections |
523 log("debug", "Disconnecting %s->%s[%s], <stream:error> is: %s", | 523 log("debug", "Disconnecting %s->%s[%s], <stream:error> is: %s", |
524 session.from_host or "(unknown host)" or session.ip, session.to_host or "(unknown host)", session.type, reason); | 524 session.from_host or "(unknown host)" or session.ip, session.to_host or "(unknown host)", session.type, reason); |
525 session.sends2s(reason); | 525 session.sends2s(stream_error); |
526 end | 526 end |
527 end | 527 end |
528 | 528 |
529 session.sends2s("</stream:stream>"); | 529 session.sends2s("</stream:stream>"); |
530 function session.sends2s() return false; end | 530 function session.sends2s() return false; end |