util.xmppstream: Remove namespace tracking, it's broken as implemented
authorMatthew Wild <mwild1@gmail.com>
Sat, 05 Mar 2016 23:37:56 +0000
changeset 7243 bf8aa0d1951c
parent 7242 c9af793b2d8f
child 7245 d0296db76ccd
util.xmppstream: Remove namespace tracking, it's broken as implemented The code fails to handle namespaces on the initial opening tag (when 'stanza' is nil). Fixing this seems not worth the effort for a feature that is not being used.
util/xmppstream.lua
--- a/util/xmppstream.lua	Sat Mar 05 17:51:35 2016 -0500
+++ b/util/xmppstream.lua	Sat Mar 05 23:37:56 2016 +0000
@@ -196,29 +196,6 @@
 		end
 	end
 
-	if stream_callbacks.track_namespaces then
-		local namespaces = {}
-		function xml_handlers:StartNamespaceDecl(prefix, url)
-			if prefix ~= nil then
-				namespaces[prefix] = url
-			end
-		end
-		function xml_handlers:EndNamespaceDecl(prefix)
-			if prefix ~= nil then
-				namespaces[prefix] = nil
-			end
-		end
-		local old_startelement = xml_handlers.StartElement
-		function xml_handlers:StartElement(tagname, attr)
-			old_startelement(self, tagname, attr)
-			local n = {}
-			for prefix, url in pairs(namespaces) do
-				n[prefix] = url
-			end
-			stanza.namespaces = n
-		end
-	end
-
 	local function restricted_handler(parser)
 		cb_error(session, "parse-error", "restricted-xml", "Restricted XML, see RFC 6120 section 11.1.");
 		if not parser.stop or not parser:stop() then