From 13d11d6735a28f23475727483b8c9b13f93d0f81 Mon Sep 17 00:00:00 2001 From: Kim Alvefur Date: Tue, 22 Apr 2014 21:56:06 +0200 Subject: mod_s2s: Follow XMPP Core on when a stream is to be considered ready --- plugins/mod_s2s/mod_s2s.lua | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/plugins/mod_s2s/mod_s2s.lua b/plugins/mod_s2s/mod_s2s.lua index 73d95970..263f24c0 100644 --- a/plugins/mod_s2s/mod_s2s.lua +++ b/plugins/mod_s2s/mod_s2s.lua @@ -150,6 +150,13 @@ function module.add_host(module) module:hook("route/remote", route_to_new_session, -10); module:hook("s2s-authenticated", make_authenticated, -1); module:hook("s2s-read-timeout", keepalive, -1); + module:hook_stanza("http://etherx.jabber.org/streams", "features", function (session, stanza) + if session.type == "s2sout" then + -- Stream is authenticated and we are seem to be done with feature negotiation, + -- so the stream is ready for stanzas. RFC 6120 Section 4.3 + mark_connected(session); + end + end, -1); end -- Stream is authorised, and ready for normal stanzas @@ -219,7 +226,10 @@ function make_authenticated(event) end session.log("debug", "connection %s->%s is now authenticated for %s", session.from_host, session.to_host, host); - mark_connected(session); + if (session.type == "s2sout" and session.external_auth ~= "succeeded") or session.type == "s2sin" then + -- Stream either used dialback for authentication or is an incoming stream. + mark_connected(session); + end return true; end -- cgit v1.2.3 From 70b5195b4fd077010c5b3a0e523e978cf2914310 Mon Sep 17 00:00:00 2001 From: Kim Alvefur Date: Tue, 22 Apr 2014 23:14:53 +0200 Subject: tools/jabberd14sql2prosody: Fix package.path (thanks daurnimator) --- tools/jabberd14sql2prosody.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/jabberd14sql2prosody.lua b/tools/jabberd14sql2prosody.lua index d6a6753f..386bdcf0 100644 --- a/tools/jabberd14sql2prosody.lua +++ b/tools/jabberd14sql2prosody.lua @@ -428,7 +428,7 @@ end end -- import modules -package.path = package.path.."..\?.lua;"; +package.path = package.path..";../?.lua;"; local my_name = arg[0]; if my_name:match("[/\\]") then -- cgit v1.2.3 From ef460cbd97a813669486cbd8b23a5a4a012cac70 Mon Sep 17 00:00:00 2001 From: Kim Alvefur Date: Tue, 22 Apr 2014 23:36:26 +0200 Subject: util.dataforms: Add support for XEP-0221: Data Forms Media Element --- util/dataforms.lua | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/util/dataforms.lua b/util/dataforms.lua index 52924841..01a8eef3 100644 --- a/util/dataforms.lua +++ b/util/dataforms.lua @@ -93,6 +93,15 @@ function form_t.form(layout, data, formtype) end end end + + local media = field.media; + if media then + form:tag("media", { xmlns = "urn:xmpp:media-element", height = media.height, width = media.width }); + for _, val in ipairs(media) do + form:tag("uri", { type = val.type }):text(val.uri):up() + end + form:up(); + end if field.required then form:tag("required"):up(); -- cgit v1.2.3