Changeset

6148:7dcd6f124c93

util.dataforms: Add support for XEP-0221: Data Forms Media Element
author Kim Alvefur <zash@zash.se>
date Tue, 22 Apr 2014 23:36:26 +0200
parents 6147:852bd69ba148
children 6149:2ae6e9063e88 6154:dfe88a0e18fd
files util/dataforms.lua
diffstat 1 files changed, 9 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- 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();