xmlhandlers: More refactoring, split up stream_ns and stream_tag, add stream_error_ta...
authorMatthew Wild <mwild1@gmail.com>
Tue, 19 Jan 2010 03:52:41 +0000 (03:52 +0000)
committerMatthew Wild <mwild1@gmail.com>
Tue, 19 Jan 2010 03:52:41 +0000 (03:52 +0000)
core/xmlhandlers.lua

index c59f9df83057d984cbea9bd1a63b1080d0e795c5..6e693d8669187314f6d704204d7e0eceddde4006 100644 (file)
@@ -26,6 +26,9 @@ module "xmlhandlers"
 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 @@ function init_xmlhandlers(session, stream_callbacks)
                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