+ if data.name then data = tostring(data); end
+ local host = hosts[from_host].s2sout[to_host];
+ if host then
+ -- We have a connection to this host already
+ if host.type == "s2sout_unauthed" and ((not data.xmlns) or data.xmlns == "jabber:client" or data.xmlns == "jabber:server") then
+ (host.log or log)("debug", "trying to send over unauthed s2sout to "..to_host..", authing it now...");
+ if not host.notopen and not host.dialback_key then
+ host.log("debug", "dialback had not been initiated");
+ initiate_dialback(host);
+ end
+
+ -- Queue stanza until we are able to send it
+ if host.sendq then t_insert(host.sendq, data);
+ else host.sendq = { data }; end
+ elseif host.type == "local" or host.type == "component" then
+ log("error", "Trying to send a stanza to ourselves??")
+ log("error", "Traceback: %s", get_traceback());
+ log("error", "Stanza: %s", tostring(data));
+ else
+ (host.log or log)("debug", "going to send stanza to "..to_host.." from "..from_host);
+ -- FIXME
+ if host.from_host ~= from_host then
+ log("error", "WARNING! This might, possibly, be a bug, but it might not...");
+ log("error", "We are going to send from %s instead of %s", tostring(host.from_host), tostring(from_host));
+ end
+ host.sends2s(data);
+ host.log("debug", "stanza sent over "..host.type);
+ end