Merge 0.9->0.10
authorMatthew Wild <mwild1@gmail.com>
Wed, 2 Apr 2014 16:41:38 +0000 (17:41 +0100)
committerMatthew Wild <mwild1@gmail.com>
Wed, 2 Apr 2014 16:41:38 +0000 (17:41 +0100)
1  2 
core/portmanager.lua
net/server_event.lua
net/server_select.lua
plugins/mod_compression.lua
plugins/muc/muc.lib.lua
util/dependencies.lua
util/xmppstream.lua

index 95900c08483156f8f54f8fe2412e450c56e6b63b,421d7fc60f4c27c40ab0b98f3a8db15cb02d55c7..4cbf3eb3619315d0e48728f31640f7e91481eaaa
@@@ -111,9 -113,9 +113,9 @@@ function activate(service_name
                   }
        bind_ports = set.new(type(bind_ports) ~= "table" and { bind_ports } or bind_ports );
  
-       local mode, ssl = listener.default_mode or "*a";
+       local mode, ssl = listener.default_mode or default_mode;
        local hooked_ports = {};
 -      
 +
        for interface in bind_interfaces do
                for port in bind_ports do
                        local port_number = tonumber(port);
Simple merge
Simple merge
Simple merge
Simple merge
Simple merge
index 550170c94c75d96118cf023be0fe9bcfaeaf093c,73f5e314177f8269a0e50e9a21b7536da1438de9..586ad5f94a4cdaede7ae18b3fcbea3f99a700e69
@@@ -40,25 -43,29 +43,29 @@@ local ns_pattern = "^([^"..ns_separator
  _M.ns_separator = ns_separator;
  _M.ns_pattern = ns_pattern;
  
- function new_sax_handlers(session, stream_callbacks)
+ local function dummy_cb() end
+ function new_sax_handlers(session, stream_callbacks, cb_handleprogress)
        local xml_handlers = {};
 -      
 +
        local cb_streamopened = stream_callbacks.streamopened;
        local cb_streamclosed = stream_callbacks.streamclosed;
        local cb_error = stream_callbacks.error or function(session, e, stanza) error("XML stream error: "..tostring(e)..(stanza and ": "..tostring(stanza) or ""),2); end;
        local cb_handlestanza = stream_callbacks.handlestanza;
 -      
+       cb_handleprogress = cb_handleprogress or dummy_cb;
 +
        local stream_ns = stream_callbacks.stream_ns or xmlns_streams;
        local stream_tag = stream_callbacks.stream_tag or "stream";
        if stream_ns ~= "" then
                stream_tag = stream_ns..ns_separator..stream_tag;
        end
        local stream_error_tag = stream_ns..ns_separator..(stream_callbacks.error_tag or "error");
 -      
 +
        local stream_default_ns = stream_callbacks.default_ns;
 -      
 +
        local stack = {};
        local chardata, stanza = {};
+       local stanza_size = 0;
        local non_streamns_depth = 0;
        function xml_handlers:StartElement(tagname, attr)
                if stanza and #chardata > 0 then
                                attr[k] = nil;
                        end
                end
 -              
 +
                if not stanza then --if we are not currently inside a stanza
+                       if lxp_supports_bytecount then
+                               stanza_size = self:getcurrentbytecount();
+                       end
                        if session.notopen then
                                if tagname == stream_tag then
                                        non_streamns_depth = 0;
                        if curr_ns == "jabber:client" and name ~= "iq" and name ~= "presence" and name ~= "message" then
                                cb_error(session, "invalid-top-level-element");
                        end
 -                      
 +
                        stanza = setmetatable({ name = name, attr = attr, tags = {} }, stanza_mt);
                else -- we are inside a stanza, so add a tag
+                       if lxp_supports_bytecount then
+                               stanza_size = stanza_size + self:getcurrentbytecount();
+                       end
                        t_insert(stack, stanza);
                        local oldstanza = stanza;
                        stanza = setmetatable({ name = name, attr = attr, tags = {} }, stanza_mt);
        end
        xml_handlers.Comment = restricted_handler;
        xml_handlers.ProcessingInstruction = restricted_handler;
 -      
 +
        local function reset()
-               stanza, chardata = nil, {};
+               stanza, chardata, stanza_size = nil, {}, 0;
                stack = {};
        end
 -      
 +
        local function set_session(stream, new_session)
                session = new_session;
        end