Merge 0.6->0.7
authorMatthew Wild <mwild1@gmail.com>
Fri, 9 Apr 2010 11:31:51 +0000 (12:31 +0100)
committerMatthew Wild <mwild1@gmail.com>
Fri, 9 Apr 2010 11:31:51 +0000 (12:31 +0100)
1  2 
core/loggingmanager.lua
net/server_select.lua
plugins/muc/muc.lib.lua
prosody

index a088a3f3d63616a2a29c6375786133384724aa0c,b34d0413d41062e65f7c94c913690ea84be8d161..b329bf11c8e55a577424289570e397bd19885a50
@@@ -33,7 -33,7 +33,7 @@@ _G.log = logger.init("general")
  module "loggingmanager"
  
  -- The log config used if none specified in the config file
- local default_logging = { { to = "console" , levels = { min = (debug_mode and "debug" ) } } };
 -local default_logging = { { to = "console" , levels = { min = (debug_mode and "debug" ) } };
++local default_logging = { { to = "console" } };
  local default_file_logging = { { to = "file", levels = { min = (debug_mode and "debug") or "info" }, timestamps = true } };
  local default_timestamp = "%b %d %H:%M:%S";
  -- The actual config loggingmanager is using
index 0aad924d312cb0613197e9514bfa5535b0629ce1,0aad924d312cb0613197e9514bfa5535b0629ce1..ebf5c427d5aa719476ed59eeae4dbeb326f8975a
@@@ -661,7 -661,7 +661,7 @@@ addserver = function( addr, port, liste
        if type( listeners ) ~= "table" then
                err = "invalid listener table"
        end
--      if not type( port ) == "number" or not ( port >= 0 and port <= 65535 ) then
++      if type( port ) ~= "number" or not ( port >= 0 and port <= 65535 ) then
                err = "invalid port"
        elseif _server[ port ] then
                err = "listeners on port '" .. port .. "' already exist"
index 273e21ce94214b585d54580b60eb658b6d59f5af,273e21ce94214b585d54580b60eb658b6d59f5af..1cc001bb0fc8ead4aca56c7e9420f0a0edadbf33
@@@ -122,13 -122,13 +122,9 @@@ function room_mt:broadcast_message(stan
                local history = self._data['history'];
                if not history then history = {}; self._data['history'] = history; end
                stanza = st.clone(stanza);
--              stanza.attr.to = "";
--              local stamp = datetime.datetime();
--              local chars = #tostring(stanza);
--              stanza:tag("delay", {xmlns = "urn:xmpp:delay", from = muc_domain, stamp = stamp}):up(); -- XEP-0203
++              stanza:tag("delay", {xmlns = "urn:xmpp:delay", from = muc_domain, stamp = datetime.datetime()}):up(); -- XEP-0203
                stanza:tag("x", {xmlns = "jabber:x:delay", from = muc_domain, stamp = datetime.legacy()}):up(); -- XEP-0091 (deprecated)
--              local entry = { stanza = stanza, stamp = stamp };
--              t_insert(history, entry);
++              t_insert(history, st.preserialize(stanza));
                while #history > history_length do t_remove(history, 1) end
        end
  end
@@@ -155,46 -155,46 +151,12 @@@ function room_mt:send_occupant_list(to
                end
        end
  end
--function room_mt:send_history(to, stanza)
++function room_mt:send_history(to)
        local history = self._data['history']; -- send discussion history
        if history then
--              local x_tag = stanza and stanza:get_child("x", "http://jabber.org/protocol/muc");
--              local history_tag = x_tag and x_tag:get_child("history", "http://jabber.org/protocol/muc");
--              
--              local maxchars = history_tag and tonumber(history_tag.attr.maxchars);
--              if maxchars then maxchars = math.floor(maxchars); end
--              
--              local maxstanzas = math.floor(history_tag and tonumber(history_tag.attr.maxstanzas) or #history);
--              if not history_tag then maxstanzas = 20; end
--
--              local seconds = history_tag and tonumber(history_tag.attr.seconds);
--              if seconds then seconds = datetime.datetime(os.time() - math.floor(seconds)); end
--
--              local since = history_tag and history_tag.attr.since;
--              if since and not since:match("^%d%d%d%d%-%d%d%-%d%dT%d%d:%d%d:%d%dZ$") then since = nil; end -- FIXME timezone support
--              if seconds and (not since or since < seconds) then since = seconds; end
--
--              local n = 0;
--              local charcount = 0;
--              local stanzacount = 0;
--              
--              for i=#history,1,-1 do
--                      local entry = history[i];
--                      if maxchars then
--                              if not entry.chars then
--                                      entry.stanza.attr.to = "";
--                                      entry.chars = #tostring(entry.stanza);
--                              end
--                              charcount = charcount + entry.chars + #to;
--                              if charcount > maxchars then break; end
--                      end
--                      if since and since > entry.stamp then break; end
--                      if n + 1 > maxstanzas then break; end
--                      n = n + 1;
--              end
--              for i=#history-n+1,#history do
--                      local msg = history[i].stanza;
--                      msg.attr.to = to;
++              for _, msg in ipairs(history) do
++                      msg = st.deserialize(msg);
++                      msg.attr.to=to;
                        self:_route_stanza(msg);
                end
        end
@@@ -357,7 -357,7 +319,7 @@@ function room_mt:handle_to_occupant(ori
                                                                :tag("item", {affiliation=affiliation or "none", role=role or "none"}):up()
                                                                :tag("status", {code='110'}));
                                                end
--                                              self:send_history(from, stanza);
++                                              self:send_history(from);
                                        else -- banned
                                                local reply = st.error_reply(stanza, "auth", "forbidden"):up();
                                                reply.tags[1].attr.code = "403";
diff --cc prosody
index 0f705b62bc905cd4f1019b6cf049f7dede10f54c,0f705b62bc905cd4f1019b6cf049f7dede10f54c..46f3331f004bc9030f5866c5c50a6bcb3e104dc2
+++ b/prosody
@@@ -22,6 -22,6 +22,9 @@@ if CFG_SOURCEDIR the
        package.cpath = CFG_SOURCEDIR.."/?.so;"..package.cpath;
  end
  
++package.path = package.path..";"..(CFG_SOURCEDIR or ".").."/fallbacks/?.lua";
++package.cpath = package.cpath..";"..(CFG_SOURCEDIR or ".").."/fallbacks/?.so";
++
  -- Substitute ~ with path to home directory in data path
  if CFG_DATADIR then
        if os.getenv("HOME") then