Comparison

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
comparison
equal deleted inserted replaced
10246:19d7a2e7b9c4 10247:5de65f30fe5e
206 206
207 local event_data = { session = session }; 207 local event_data = { session = session };
208 if session.type == "s2sout" then 208 if session.type == "s2sout" then
209 fire_global_event("s2sout-established", event_data); 209 fire_global_event("s2sout-established", event_data);
210 hosts[from].events.fire_event("s2sout-established", event_data); 210 hosts[from].events.fire_event("s2sout-established", event_data);
211
212 if session.incoming then
213 session.send = function(stanza)
214 return hosts[from].events.fire_event("route/remote", { from_host = from, to_host = to, stanza = stanza });
215 end;
216 end
217
211 else 218 else
212 local host_session = hosts[to]; 219 local host_session = hosts[to];
213 session.send = function(stanza) 220 session.send = function(stanza)
214 return host_session.events.fire_event("route/remote", { from_host = to, to_host = from, stanza = stanza }); 221 return host_session.events.fire_event("route/remote", { from_host = to, to_host = from, stanza = stanza });
215 end; 222 end;