Merge 0.10->trunk
authorKim Alvefur <zash@zash.se>
Tue, 22 Apr 2014 22:23:46 +0000 (00:23 +0200)
committerKim Alvefur <zash@zash.se>
Tue, 22 Apr 2014 22:23:46 +0000 (00:23 +0200)
plugins/mod_s2s/mod_s2s.lua
tools/jabberd14sql2prosody.lua
util/dataforms.lua

index 73d95970cd86c820ff120b958007e08f02c99772..263f24c0b55c2b633810521f89abdcb1cc159507 100644 (file)
@@ -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
index 03376b30ee11a59d3fee8388d76792a854baa096..e43dc29602f7345eb0afbffed820ee1d42696efa 100644 (file)
@@ -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
index b38d0e274373c3923ad11cdd30a336b73f05e40f..c352858c67a11883cd20f5e9f528da53a6806e4c 100644 (file)
@@ -94,6 +94,15 @@ function form_t.form(layout, data, formtype)
                        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();
                end