mod_s2s: Add function to send replies on s2sout connections that support incoming traffic
authorKim Alvefur <zash@zash.se>
Sat, 07 Sep 2019 18:32:29 +0200
changeset 10251 5de65f30fe5e
parent 10250 19d7a2e7b9c4
child 10252 d7cadd118053
mod_s2s: Add function to send replies on s2sout connections that support incoming traffic
plugins/mod_s2s/mod_s2s.lua
--- a/plugins/mod_s2s/mod_s2s.lua	Sat Sep 07 17:44:57 2019 +0200
+++ b/plugins/mod_s2s/mod_s2s.lua	Sat Sep 07 18:32:29 2019 +0200
@@ -208,6 +208,13 @@
 	if session.type == "s2sout" then
 		fire_global_event("s2sout-established", event_data);
 		hosts[from].events.fire_event("s2sout-established", event_data);
+
+		if session.incoming then
+			session.send = function(stanza)
+				return hosts[from].events.fire_event("route/remote", { from_host = from, to_host = to, stanza = stanza });
+			end;
+		end
+
 	else
 		local host_session = hosts[to];
 		session.send = function(stanza)