util.dataforms: Add support for XEP-0221: Data Forms Media Element
authorKim Alvefur <zash@zash.se>
Tue, 22 Apr 2014 21:36:26 +0000 (23:36 +0200)
committerKim Alvefur <zash@zash.se>
Tue, 22 Apr 2014 21:36:26 +0000 (23:36 +0200)
util/dataforms.lua

index 52924841a0dc4fcc98907ed2eb96f9891c1cdbfe..01a8eef327c1ac566a0ecfabb997c03207f6f237 100644 (file)
@@ -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();