core/s2smanager.lua
changeset 558 ab3960421356
parent 544 efde848869c5
child 559 fa4a51fe6442
equal deleted inserted replaced
557:c9b3ffb08fe3 558:ab3960421356
    54 function send_to_host(from_host, to_host, data)
    54 function send_to_host(from_host, to_host, data)
    55 	if data.name then data = tostring(data); end
    55 	if data.name then data = tostring(data); end
    56 	local host = hosts[from_host].s2sout[to_host];
    56 	local host = hosts[from_host].s2sout[to_host];
    57 	if host then
    57 	if host then
    58 		-- We have a connection to this host already
    58 		-- We have a connection to this host already
    59 		if host.type == "s2sout_unauthed" and ((not data.xmlns) or data.xmlns == "jabber:client" or data.xmlns == "jabber:server") then
    59 		if host.type == "s2sout_unauthed" and (data.xmlns == "jabber:client" or data.xmlns == "jabber:server") then
    60 			(host.log or log)("debug", "trying to send over unauthed s2sout to "..to_host..", authing it now...");
    60 			(host.log or log)("debug", "trying to send over unauthed s2sout to "..to_host);
    61 			if not host.notopen and not host.dialback_key then
    61 			if not host.notopen and not host.dialback_key then
    62 				host.log("debug", "dialback had not been initiated");
    62 				host.log("debug", "dialback had not been initiated");
    63 				initiate_dialback(host);
    63 				initiate_dialback(host);
    64 			end
    64 			end
    65 			
    65 			
    66 			-- Queue stanza until we are able to send it
    66 			-- Queue stanza until we are able to send it
    67 			if host.sendq then t_insert(host.sendq, data);
    67 			if host.sendq then t_insert(host.sendq, data);
    68 			else host.sendq = { data }; end
    68 			else host.sendq = { data }; end
       
    69 			host.log("debug", "stanza queued");
    69 		elseif host.type == "local" or host.type == "component" then
    70 		elseif host.type == "local" or host.type == "component" then
    70 			log("error", "Trying to send a stanza to ourselves??")
    71 			log("error", "Trying to send a stanza to ourselves??")
    71 			log("error", "Traceback: %s", get_traceback());
    72 			log("error", "Traceback: %s", get_traceback());
    72 			log("error", "Stanza: %s", tostring(data));
    73 			log("error", "Stanza: %s", tostring(data));
    73 		else
    74 		else