aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKim Alvefur <zash@zash.se>2022-08-18 03:26:32 +0200
committerKim Alvefur <zash@zash.se>2022-08-18 03:26:32 +0200
commit20afe7d20dfde84a9deb6ed4f85a6e7a9429f09c (patch)
tree9c22770ef4c2a69d5132ee4288042c1a2ac1fa2d
parent8ef7bc2cf4d430c96e2b9b1876ba406c7c03aba9 (diff)
downloadprosody-20afe7d20dfde84a9deb6ed4f85a6e7a9429f09c.tar.gz
prosody-20afe7d20dfde84a9deb6ed4f85a6e7a9429f09c.zip
mod_s2s: Add event where resolver for s2sout can be tweaked
Could be used to implement custom connection methods (c.f. mod_onions) without needing to duplicate the rest of route_to_new_session(). Adds a feature to enable detection since it can be difficult to detect support for an event otherwise.
-rw-r--r--core/features.lua2
-rw-r--r--plugins/mod_s2s.lua4
2 files changed, 6 insertions, 0 deletions
diff --git a/core/features.lua b/core/features.lua
index 7248f881..35df5636 100644
--- a/core/features.lua
+++ b/core/features.lua
@@ -4,5 +4,7 @@ return {
available = set.new{
-- mod_bookmarks bundled
"mod_bookmarks";
+
+ "s2sout-pre-connect-event";
};
};
diff --git a/plugins/mod_s2s.lua b/plugins/mod_s2s.lua
index 300a747e..ee65ba70 100644
--- a/plugins/mod_s2s.lua
+++ b/plugins/mod_s2s.lua
@@ -230,6 +230,10 @@ function route_to_new_session(event)
resolver;
});
end
+
+ local pre_event = { session = host_session; resolver = resolver };
+ module:context(from_host):fire_event("s2sout-pre-connect", pre_event);
+ resolver = pre_event.resolver;
connect(resolver, listener, nil, { session = host_session });
m_initiated_connections:with_labels(from_host):add(1)
return true;