Software / code / prosody
Comparison
core/xmlhandlers.lua @ 2506:d11a781baf13
xmlhandlers: Removed unused variables.
| author | Waqas Hussain <waqas20@gmail.com> |
|---|---|
| date | Tue, 26 Jan 2010 03:39:53 +0500 |
| parent | 2505:0849e349992d |
| child | 2925:692b3c6c5bd2 |
comparison
equal
deleted
inserted
replaced
| 2505:0849e349992d | 2506:d11a781baf13 |
|---|---|
| 10 | 10 |
| 11 require "util.stanza" | 11 require "util.stanza" |
| 12 | 12 |
| 13 local st = stanza; | 13 local st = stanza; |
| 14 local tostring = tostring; | 14 local tostring = tostring; |
| 15 local pairs = pairs; | |
| 16 local ipairs = ipairs; | |
| 17 local t_insert = table.insert; | 15 local t_insert = table.insert; |
| 18 local t_concat = table.concat; | 16 local t_concat = table.concat; |
| 19 | 17 |
| 20 local default_log = require "util.logger".init("xmlhandlers"); | 18 local default_log = require "util.logger".init("xmlhandlers"); |
| 21 | 19 |
| 31 | 29 |
| 32 local ns_separator = "\1"; | 30 local ns_separator = "\1"; |
| 33 local ns_pattern = "^([^"..ns_separator.."]*)"..ns_separator.."?(.*)$"; | 31 local ns_pattern = "^([^"..ns_separator.."]*)"..ns_separator.."?(.*)$"; |
| 34 | 32 |
| 35 function init_xmlhandlers(session, stream_callbacks) | 33 function init_xmlhandlers(session, stream_callbacks) |
| 36 local ns_stack = { "" }; | |
| 37 local curr_tag; | |
| 38 local chardata = {}; | 34 local chardata = {}; |
| 39 local xml_handlers = {}; | 35 local xml_handlers = {}; |
| 40 local log = session.log or default_log; | 36 local log = session.log or default_log; |
| 41 | 37 |
| 42 local cb_streamopened = stream_callbacks.streamopened; | 38 local cb_streamopened = stream_callbacks.streamopened; |
| 95 if curr_ns == "jabber:client" and name ~= "iq" and name ~= "presence" and name ~= "message" then | 91 if curr_ns == "jabber:client" and name ~= "iq" and name ~= "presence" and name ~= "message" then |
| 96 cb_error(session, "invalid-top-level-element"); | 92 cb_error(session, "invalid-top-level-element"); |
| 97 end | 93 end |
| 98 | 94 |
| 99 stanza = st.stanza(name, attr); | 95 stanza = st.stanza(name, attr); |
| 100 curr_tag = stanza; | |
| 101 else -- we are inside a stanza, so add a tag | 96 else -- we are inside a stanza, so add a tag |
| 102 attr.xmlns = nil; | 97 attr.xmlns = nil; |
| 103 if curr_ns ~= stream_default_ns then | 98 if curr_ns ~= stream_default_ns then |
| 104 attr.xmlns = curr_ns; | 99 attr.xmlns = curr_ns; |
| 105 end | 100 end |