Comparison

tools/xep227toprosody.lua @ 6871:e4b5885b7712

Merge 0.10->trunk
author Kim Alvefur <zash@zash.se>
date Fri, 25 Sep 2015 18:11:45 +0200
parent 6870:d5b416070f70
child 11680:a3d3fb9d0d43
comparison
equal deleted inserted replaced
6868:dcf9ceac9265 6871:e4b5885b7712
200 end 200 end
201 --io.write("+ ", string.rep(" ", count), name, " (", curr_ns, ")", "\n") 201 --io.write("+ ", string.rep(" ", count), name, " (", curr_ns, ")", "\n")
202 --count = count + 1; 202 --count = count + 1;
203 if curr_host ~= "" then 203 if curr_host ~= "" then
204 -- forward to xmlhandlers 204 -- forward to xmlhandlers
205 user_handlers:StartElement(elementname, attributes); 205 user_handlers.StartElement(parser, elementname, attributes);
206 elseif (curr_ns == xmlns_xep227) and (name == "host") then 206 elseif (curr_ns == xmlns_xep227) and (name == "host") then
207 curr_host = attributes["jid"]; -- start of host element 207 curr_host = attributes["jid"]; -- start of host element
208 print("Begin parsing host "..curr_host); 208 print("Begin parsing host "..curr_host);
209 elseif (curr_ns ~= xmlns_xep227) or (name ~= "server-data") then 209 elseif (curr_ns ~= xmlns_xep227) or (name ~= "server-data") then
210 io.stderr:write("Unhandled XML element: ", name, "\n"); 210 io.stderr:write("Unhandled XML element: ", name, "\n");
224 if (curr_ns == xmlns_xep227) and (name == "host") then 224 if (curr_ns == xmlns_xep227) and (name == "host") then
225 print("End parsing host "..curr_host); 225 print("End parsing host "..curr_host);
226 curr_host = "" -- end of host element 226 curr_host = "" -- end of host element
227 else 227 else
228 -- forward to xmlhandlers 228 -- forward to xmlhandlers
229 user_handlers:EndElement(elementname); 229 user_handlers.EndElement(parser, elementname);
230 end 230 end
231 elseif (curr_ns ~= xmlns_xep227) or (name ~= "server-data") then 231 elseif (curr_ns ~= xmlns_xep227) or (name ~= "server-data") then
232 io.stderr:write("Unhandled XML element: ", name, "\n"); 232 io.stderr:write("Unhandled XML element: ", name, "\n");
233 os.exit(1); 233 os.exit(1);
234 end 234 end
235 end 235 end
236 236
237 function lxp_handlers.CharacterData(parser, string) 237 function lxp_handlers.CharacterData(parser, string)
238 if curr_host ~= "" then 238 if curr_host ~= "" then
239 -- forward to xmlhandlers 239 -- forward to xmlhandlers
240 user_handlers:CharacterData(string); 240 user_handlers.CharacterData(parser, string);
241 end 241 end
242 end 242 end
243 243
244 ----------------------------------------------------------------------- 244 -----------------------------------------------------------------------
245 245