Diff

plugins/mod_s2s/mod_s2s.lua @ 10247:5de65f30fe5e

mod_s2s: Add function to send replies on s2sout connections that support incoming traffic
author Kim Alvefur <zash@zash.se>
date Sat, 07 Sep 2019 18:32:29 +0200
parent 10246:19d7a2e7b9c4
child 10248:d7cadd118053
line wrap: on
line diff
--- 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)