Software /
code /
prosody
Comparison
tools/xep227toprosody.lua @ 6869:5ce783c37024
xep227toprosody: Pass parser to callbacks (needed since addition of stanza size limits)
author | Kim Alvefur <zash@zash.se> |
---|---|
date | Fri, 18 Sep 2015 16:14:43 +0200 |
parent | 5989:5aaddafe0beb |
child | 6870:d5b416070f70 |
comparison
equal
deleted
inserted
replaced
6865:20b0f0b48655 | 6869:5ce783c37024 |
---|---|
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 |