core/s2smanager.lua

changeset 2951
294c359a05f5
parent 2925
692b3c6c5bd2
parent 2949
ef19faa7d106
child 3146
aaaea4cdbf10
child 3151
6eca858feb04
equal deleted inserted replaced
2947:ff7f6668b34f 2951:294c359a05f5
66 dummy = true; 66 dummy = true;
67 }; 67 };
68 for i, data in ipairs(sendq) do 68 for i, data in ipairs(sendq) do
69 local reply = data[2]; 69 local reply = data[2];
70 local xmlns = reply.attr.xmlns; 70 local xmlns = reply.attr.xmlns;
71 if not xmlns or xmlns == "jabber:client" or xmlns == "jabber:server" then 71 if not xmlns then
72 reply.attr.type = "error"; 72 reply.attr.type = "error";
73 reply:tag("error", {type = "cancel"}) 73 reply:tag("error", {type = "cancel"})
74 :tag("remote-server-not-found", {xmlns = "urn:ietf:params:xml:ns:xmpp-stanzas"}):up(); 74 :tag("remote-server-not-found", {xmlns = "urn:ietf:params:xml:ns:xmpp-stanzas"}):up();
75 if reason then 75 if reason then
76 reply:tag("text", {xmlns = "urn:ietf:params:xml:ns:xmpp-stanzas"}):text("Connection failed: "..reason):up(); 76 reply:tag("text", {xmlns = "urn:ietf:params:xml:ns:xmpp-stanzas"}):text("Connection failed: "..reason):up();
89 return false; 89 return false;
90 end 90 end
91 local host = hosts[from_host].s2sout[to_host]; 91 local host = hosts[from_host].s2sout[to_host];
92 if host then 92 if host then
93 -- We have a connection to this host already 93 -- We have a connection to this host already
94 if host.type == "s2sout_unauthed" and (data.name ~= "db:verify" or not host.dialback_key) and ((not data.xmlns) or data.xmlns == "jabber:client" or data.xmlns == "jabber:server") then 94 if host.type == "s2sout_unauthed" and (data.name ~= "db:verify" or not host.dialback_key) then
95 (host.log or log)("debug", "trying to send over unauthed s2sout to "..to_host); 95 (host.log or log)("debug", "trying to send over unauthed s2sout to "..to_host);
96 96
97 -- Queue stanza until we are able to send it 97 -- Queue stanza until we are able to send it
98 if host.sendq then t_insert(host.sendq, {tostring(data), st.reply(data)}); 98 if host.sendq then t_insert(host.sendq, {tostring(data), st.reply(data)});
99 else host.sendq = { {tostring(data), st.reply(data)} }; end 99 else host.sendq = { {tostring(data), st.reply(data)} }; end

mercurial