mod_console: Don't allow bang bang as the first command in a session, or when the...
[prosody.git] / util / xmppstream.lua
index ed5395b5b0c9f2962dddbf7244635bf57d0c388e..2f232fd81127fe71626ab5bbb73941618af1c539 100644 (file)
@@ -69,8 +69,8 @@ function new_sax_handlers(session, stream_callbacks)
                        attr[i] = nil;
                        local ns, nm = k:match(ns_pattern);
                        if nm ~= "" then
-                               ns = ns_prefixes[ns]; 
-                               if ns then 
+                               ns = ns_prefixes[ns];
+                               if ns then
                                        attr[ns..":"..nm] = attr[k];
                                        attr[k] = nil;
                                end
@@ -95,10 +95,6 @@ function new_sax_handlers(session, stream_callbacks)
                        
                        stanza = st.stanza(name, attr);
                else -- we are inside a stanza, so add a tag
-                       attr.xmlns = nil;
-                       if curr_ns ~= stream_default_ns then
-                               attr.xmlns = curr_ns;
-                       end
                        stanza:tag(name, attr);
                end
        end
@@ -145,7 +141,12 @@ function new_sax_handlers(session, stream_callbacks)
                stanza, chardata = nil, {};
        end
        
-       return xml_handlers, { reset = reset };
+       local function set_session(stream, new_session)
+               session = new_session;
+               log = new_session.log or default_log;
+       end
+       
+       return xml_handlers, { reset = reset, set_session = set_session };
 end
 
 function new(session, stream_callbacks)
@@ -161,7 +162,8 @@ function new(session, stream_callbacks)
                end,
                feed = function (self, data)
                        return parse(parser, data);
-               end
+               end,
+               set_session = meta.set_session;
        };
 end