Comparison

util/dataforms.lua @ 2070:25dc4b9d06b1

util.dataforms: Support for jid-multi field type
author Florian Zeitz
date Fri, 06 Nov 2009 23:51:14 +0000
parent 2061:e34fdca432a9
child 2219:9e1c6b6a2ee4
comparison
equal deleted inserted replaced
2068:1e1ee53d7f6e 2070:25dc4b9d06b1
116 field_readers["text-single"]; 116 field_readers["text-single"];
117 117
118 field_readers["jid-single"] = 118 field_readers["jid-single"] =
119 field_readers["text-single"]; 119 field_readers["text-single"];
120 120
121 field_readers["jid-multi"] =
122 function (field_tag)
123 local result = {};
124 for value_tag in field_tag:childtags() do
125 if value_tag.name == "value" then
126 result[#result+1] = value_tag[1];
127 end
128 end
129 return result;
130 end
131
121 field_readers["text-multi"] = 132 field_readers["text-multi"] =
122 function (field_tag) 133 function (field_tag)
123 local result = {}; 134 local result = {};
124 for value_tag in field_tag:childtags() do 135 for value_tag in field_tag:childtags() do
125 if value_tag.name == "value" then 136 if value_tag.name == "value" then