net.dns: Ensure all pending requests get notified of a timeout when looking up a...
[prosody.git] / util / dataforms.lua
index 8634e337f98ee1db5b43470581764755a4c9e12c..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();
@@ -187,7 +196,11 @@ field_readers["list-multi"] =
                for value in field_tag:childtags("value") do
                        result[#result+1] = value:get_text();
                end
-               return result, (required and #result == 0 and "Required value missing" or nil);
+               if #result > 0 then
+                       return result;
+               elseif required then
+                       return nil, "Required value missing";
+               end
        end
 
 field_readers["text-multi"] =