Software /
code /
prosody
Comparison
util/dataforms.lua @ 3540:bc139431830b
Monster whitespace commit (beware the whitespace monster).
author | Waqas Hussain <waqas20@gmail.com> |
---|---|
date | Sat, 16 Oct 2010 23:00:42 +0500 |
parent | 3380:e74e80b454a1 |
child | 4397:1378e3c79c34 |
comparison
equal
deleted
inserted
replaced
3539:8bbd965267b2 | 3540:bc139431830b |
---|---|
124 | 124 |
125 end | 125 end |
126 return data; | 126 return data; |
127 end | 127 end |
128 | 128 |
129 field_readers["text-single"] = | 129 field_readers["text-single"] = |
130 function (field_tag) | 130 function (field_tag) |
131 local value = field_tag:child_with_name("value"); | 131 local value = field_tag:child_with_name("value"); |
132 if value then | 132 if value then |
133 return value[1]; | 133 return value[1]; |
134 end | 134 end |
135 end | 135 end |
136 | 136 |
137 field_readers["text-private"] = | 137 field_readers["text-private"] = |
138 field_readers["text-single"]; | 138 field_readers["text-single"]; |
139 | 139 |
140 field_readers["jid-single"] = | 140 field_readers["jid-single"] = |
141 field_readers["text-single"]; | 141 field_readers["text-single"]; |
142 | 142 |
143 field_readers["jid-multi"] = | 143 field_readers["jid-multi"] = |
144 function (field_tag) | 144 function (field_tag) |
145 local result = {}; | 145 local result = {}; |
146 for value_tag in field_tag:childtags() do | 146 for value_tag in field_tag:childtags() do |
147 if value_tag.name == "value" then | 147 if value_tag.name == "value" then |
148 result[#result+1] = value_tag[1]; | 148 result[#result+1] = value_tag[1]; |
149 end | 149 end |
150 end | 150 end |
151 return result; | 151 return result; |
152 end | 152 end |
153 | 153 |
154 field_readers["text-multi"] = | 154 field_readers["text-multi"] = |
155 function (field_tag) | 155 function (field_tag) |
156 local result = {}; | 156 local result = {}; |
157 for value_tag in field_tag:childtags() do | 157 for value_tag in field_tag:childtags() do |
158 if value_tag.name == "value" then | 158 if value_tag.name == "value" then |
159 result[#result+1] = value_tag[1]; | 159 result[#result+1] = value_tag[1]; |
174 end | 174 end |
175 end | 175 end |
176 return result; | 176 return result; |
177 end | 177 end |
178 | 178 |
179 field_readers["boolean"] = | 179 field_readers["boolean"] = |
180 function (field_tag) | 180 function (field_tag) |
181 local value = field_tag:child_with_name("value"); | 181 local value = field_tag:child_with_name("value"); |
182 if value then | 182 if value then |
183 if value[1] == "1" or value[1] == "true" then | 183 if value[1] == "1" or value[1] == "true" then |
184 return true; | 184 return true; |
185 else | 185 else |
186 return false; | 186 return false; |
187 end | 187 end |
188 end | 188 end |
189 end | 189 end |
190 | 190 |
191 field_readers["hidden"] = | 191 field_readers["hidden"] = |
192 function (field_tag) | 192 function (field_tag) |
193 local value = field_tag:child_with_name("value"); | 193 local value = field_tag:child_with_name("value"); |
194 if value then | 194 if value then |
195 return value[1]; | 195 return value[1]; |
196 end | 196 end |