# HG changeset patch # User Matthew Wild # Date 1336094546 -3600 # Node ID 4fa47fc6f20c8aadfb1f326d235c494e1c2e8b19 # Parent 3bda6fc0265236f9eeca231eabb870baac6ef1cd mod_s2s: Add session.send() only to incoming streams, and fire the route/remote event on the host (not global anymore) diff -r 3bda6fc02652 -r 4fa47fc6f20c plugins/mod_s2s/mod_s2s.lua --- a/plugins/mod_s2s/mod_s2s.lua Fri May 04 01:50:17 2012 +0100 +++ b/plugins/mod_s2s/mod_s2s.lua Fri May 04 02:22:26 2012 +0100 @@ -250,6 +250,11 @@ log("debug", "Sending stream features: %s", tostring(features)); send(features); end + + local host_session = hosts[session.to_host]; + session.send = function(stanza) + host_session.events.fire_event("route/remote", { from_host = session.to_host, to_host = session.from_host, stanza = stanza}) + end; elseif session.direction == "outgoing" then -- If we are just using the connection for verifying dialback keys, we won't try and auth it if not attr.id then error("stream response did not give us a streamid!!!"); end @@ -281,7 +286,6 @@ end end session.notopen = nil; - session.send = function(stanza) prosody.events.fire_event("route/remote", { from_host = session.to_host, to_host = session.from_host, stanza = stanza}) end; end function stream_callbacks.streamclosed(session)