aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorWaqas Hussain <waqas20@gmail.com>2012-01-25 11:54:12 +0500
committerWaqas Hussain <waqas20@gmail.com>2012-01-25 11:54:12 +0500
commit19bcbcde9c09abdad8fdeadf3758288e0ff76a12 (patch)
tree2694eb16be223cecc19860ce8e058eb57f4ea348
parent36936e4b059694ccc4e4f9d9e2d63c0aec24bf60 (diff)
downloadprosody-19bcbcde9c09abdad8fdeadf3758288e0ff76a12.tar.gz
prosody-19bcbcde9c09abdad8fdeadf3758288e0ff76a12.zip
util.xmppstream: Optimize attribute processing.
-rw-r--r--util/xmppstream.lua19
1 files changed, 9 insertions, 10 deletions
diff --git a/util/xmppstream.lua b/util/xmppstream.lua
index 09198f21..f1793b4f 100644
--- a/util/xmppstream.lua
+++ b/util/xmppstream.lua
@@ -25,8 +25,11 @@ module "xmppstream"
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 @@ function new_sax_handlers(session, stream_callbacks)
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