# HG changeset patch # User Matthew Wild # Date 1327603679 0 # Node ID 99b37efe13ed985b4a2d36b690f84f9113e9f91c # Parent 0da4e0f0f0effa43b0c8ab242f0132f7fbeb539c# Parent 5f466a50e78b1ba308a17cc28d3087df7c9ede13 Merge with Zash diff -r 5f466a50e78b -r 99b37efe13ed util/xmppstream.lua --- a/util/xmppstream.lua Fri Jan 20 22:04:28 2012 +0100 +++ b/util/xmppstream.lua Thu Jan 26 18:47:59 2012 +0000 @@ -25,8 +25,11 @@ local new_parser = lxp.new; -local ns_prefixes = { - ["http://www.w3.org/XML/1998/namespace"] = "xml"; +local xml_namespace = { + ["http://www.w3.org/XML/1998/namespace\1lang"] = "xml:lang"; + ["http://www.w3.org/XML/1998/namespace\1space"] = "xml:space"; + ["http://www.w3.org/XML/1998/namespace\1base"] = "xml:base"; + ["http://www.w3.org/XML/1998/namespace\1id"] = "xml:id"; }; local xmlns_streams = "http://etherx.jabber.org/streams"; @@ -73,17 +76,13 @@ non_streamns_depth = non_streamns_depth + 1; end - -- FIXME !!!!! for i=1,#attr do local k = attr[i]; attr[i] = nil; - local ns, nm = k:match(ns_pattern); - if nm ~= "" then - ns = ns_prefixes[ns]; - if ns then - attr[ns..":"..nm] = attr[k]; - attr[k] = nil; - end + local xmlk = xml_namespace[k]; + if xmlk then + attr[xmlk] = attr[k]; + attr[k] = nil; end end @@ -140,19 +139,9 @@ stanza = t_remove(stack); end else - if tagname == stream_tag then - if cb_streamclosed then - cb_streamclosed(session); - end - else - local curr_ns,name = tagname:match(ns_pattern); - if name == "" then - curr_ns, name = "", curr_ns; - end - cb_error(session, "parse-error", "unexpected-element-close", name); + if cb_streamclosed then + cb_streamclosed(session); end - stanza, chardata = nil, {}; - stack = {}; end end