# HG changeset patch # User Kim Alvefur # Date 1398202586 -7200 # Node ID 7dcd6f124c934b6ee0ac9aadeba5c4af497ef937 # Parent 852bd69ba1482639703c8d44438d6dd3972c368f util.dataforms: Add support for XEP-0221: Data Forms Media Element diff -r 852bd69ba148 -r 7dcd6f124c93 util/dataforms.lua --- a/util/dataforms.lua Tue Apr 22 23:14:53 2014 +0200 +++ b/util/dataforms.lua Tue Apr 22 23:36:26 2014 +0200 @@ -93,6 +93,15 @@ 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();