diff options
author | Kim Alvefur <zash@zash.se> | 2016-02-22 18:46:59 +0100 |
---|---|---|
committer | Kim Alvefur <zash@zash.se> | 2016-02-22 18:46:59 +0100 |
commit | 349f3e7a755249a16acf5417f9bea95c0df77513 (patch) | |
tree | 15d7151c2609ac821e0dd08e27f67795300b090d /util | |
parent | 82a913c6816be2b0503368afac85b8b20335db0e (diff) | |
parent | 6ee4f6f618ee4a07f3b25f38c7da675d68fdceee (diff) | |
download | prosody-349f3e7a755249a16acf5417f9bea95c0df77513.tar.gz prosody-349f3e7a755249a16acf5417f9bea95c0df77513.zip |
Merge 0.10->trunk
Diffstat (limited to 'util')
-rw-r--r-- | util/debug.lua | 3 | ||||
-rw-r--r-- | util/import.lua | 1 | ||||
-rw-r--r-- | util/iterators.lua | 5 | ||||
-rw-r--r-- | util/multitable.lua | 3 | ||||
-rw-r--r-- | util/random.lua | 3 | ||||
-rw-r--r-- | util/session.lua | 6 | ||||
-rw-r--r-- | util/sql.lua | 2 |
7 files changed, 16 insertions, 7 deletions
diff --git a/util/debug.lua b/util/debug.lua index a78524a9..00f476d0 100644 --- a/util/debug.lua +++ b/util/debug.lua @@ -1,6 +1,9 @@ -- Variables ending with these names will not -- have their values printed ('password' includes -- 'new_password', etc.) +-- +-- luacheck: ignore 122/debug + local censored_names = { password = true; passwd = true; diff --git a/util/import.lua b/util/import.lua index 174da0ca..c2b9dce1 100644 --- a/util/import.lua +++ b/util/import.lua @@ -8,6 +8,7 @@ +local unpack = table.unpack or unpack; --luacheck: ignore 113 local t_insert = table.insert; function import(module, ...) local m = package.loaded[module] or require(module); diff --git a/util/iterators.lua b/util/iterators.lua index aa9c3ec0..868ba786 100644 --- a/util/iterators.lua +++ b/util/iterators.lua @@ -11,8 +11,9 @@ local it = {}; local t_insert = table.insert; -local select, unpack, next = select, unpack, next; -local function pack(...) return { n = select("#", ...), ... }; end +local select, next = select, next; +local unpack = table.unpack or unpack; --luacheck: ignore 113 +local pack = table.pack or function (...) return { n = select("#", ...), ... }; end -- Reverse an iterator function it.reverse(f, s, var) diff --git a/util/multitable.lua b/util/multitable.lua index 7a2d2b2a..e4321d3d 100644 --- a/util/multitable.lua +++ b/util/multitable.lua @@ -8,7 +8,8 @@ local select = select; local t_insert = table.insert; -local unpack, pairs, next, type = unpack, pairs, next, type; +local pairs, next, type = pairs, next, type; +local unpack = table.unpack or unpack; --luacheck: ignore 113 local _ENV = nil; diff --git a/util/random.lua b/util/random.lua index e4b4a700..574e2e1c 100644 --- a/util/random.lua +++ b/util/random.lua @@ -6,6 +6,9 @@ -- COPYING file in the source package for more information. -- +local ok, crand = pcall(require, "util.crand"); +if ok then return crand; end + local urandom, urandom_err = io.open("/dev/urandom", "r"); local function seed() diff --git a/util/session.lua b/util/session.lua index fda7fccd..b2a726ce 100644 --- a/util/session.lua +++ b/util/session.lua @@ -9,13 +9,13 @@ local function new_session(typ) end local function set_id(session) - local id = typ .. tostring(session):match("%x+$"):lower(); + local id = session.type .. tostring(session):match("%x+$"):lower(); session.id = id; return session; end local function set_logger(session) - local log = logger.init(id); + local log = logger.init(session.id); session.log = log; return session; end @@ -30,7 +30,7 @@ local function set_send(session) local conn = session.conn; if not conn then function session.send(data) - log("debug", "Discarding data sent to unconnected session: %s", tostring(data)); + session.log("debug", "Discarding data sent to unconnected session: %s", tostring(data)); return false; end return session; diff --git a/util/sql.lua b/util/sql.lua index b4d14537..9981ac3c 100644 --- a/util/sql.lua +++ b/util/sql.lua @@ -1,6 +1,6 @@ local setmetatable, getmetatable = setmetatable, getmetatable; -local ipairs, unpack, select = ipairs, unpack, select; +local ipairs, unpack, select = ipairs, table.unpack or unpack, select; --luacheck: ignore 113 local tonumber, tostring = tonumber, tostring; local assert, xpcall, debug_traceback = assert, xpcall, debug.traceback; local t_concat = table.concat; |