Changeset

2464:0b5f0ae7a6b1

xmlhandlers: More refactoring, split up stream_ns and stream_tag, add stream_error_tag so that callers don't need to be so worried about the separator we use
author Matthew Wild <mwild1@gmail.com>
date Tue, 19 Jan 2010 03:52:41 +0000
parents 2463:d9ff0190eb4a
children 2465:48a209636a42
files core/xmlhandlers.lua
diffstat 1 files changed, 7 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/core/xmlhandlers.lua	Mon Jan 18 19:00:18 2010 +0000
+++ b/core/xmlhandlers.lua	Tue Jan 19 03:52:41 2010 +0000
@@ -26,6 +26,9 @@
 local ns_prefixes = {
 						["http://www.w3.org/XML/1998/namespace"] = "xml";
 				}
+
+local xmlns_streams = "http://etherx.jabber.org/streams";
+
 local ns_separator = "\1";
 local ns_pattern = "^([^"..ns_separator.."]*)"..ns_separator.."?(.*)$";
 
@@ -41,7 +44,10 @@
 		local cb_error = stream_callbacks.error or function (session, e) error("XML stream error: "..tostring(e)); end;
 		local cb_handlestanza = stream_callbacks.handlestanza;
 		
-		local stream_tag = stream_callbacks.stream_tag;
+		local stream_ns = stream_callbacks.stream_ns or xmlns_streams;
+		local stream_tag = stream_ns..ns_separator..(stream_callbacks.stream_tag or "stream");
+		local stream_error_tag = stream_ns..ns_separator..(stream_callbacks.error_tag or "error");
+		
 		local stream_default_ns = stream_callbacks.default_ns;
 		
 		local stanza