From a015c6a04858224b509bfbf430b93aaca10fc278 Mon Sep 17 00:00:00 2001 From: Waqas Hussain Date: Thu, 1 Apr 2010 19:08:25 +0500 Subject: util.stanza: Fixed a nil global access. --- util/stanza.lua | 2 ++ 1 file changed, 2 insertions(+) (limited to 'util') diff --git a/util/stanza.lua b/util/stanza.lua index e1221caa..b039993f 100644 --- a/util/stanza.lua +++ b/util/stanza.lua @@ -38,6 +38,8 @@ if do_pretty_printing then end end +local xmlns_stanzas = "urn:ietf:params:xml:ns:xmpp-stanzas"; + module "stanza" stanza_mt = { __type = "stanza" }; -- cgit v1.2.3 From bc55b5ad8f2dfd3f6d22905900ea009fc19fcda5 Mon Sep 17 00:00:00 2001 From: Waqas Hussain Date: Thu, 1 Apr 2010 19:12:08 +0500 Subject: util.stanza: Fixed some more nil global accesses. --- util/stanza.lua | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'util') diff --git a/util/stanza.lua b/util/stanza.lua index b039993f..a457e619 100644 --- a/util/stanza.lua +++ b/util/stanza.lua @@ -225,14 +225,14 @@ function deserialize(stanza) for i=1,#attr do attr[i] = nil; end local attrx = {}; for att in pairs(attr) do - if s_find(att, "|", 1, true) and not s_find(k, "\1", 1, true) then - local ns,na = s_match(k, "^([^|]+)|(.+)$"); + if s_find(att, "|", 1, true) and not s_find(att, "\1", 1, true) then + local ns,na = s_match(att, "^([^|]+)|(.+)$"); attrx[ns.."\1"..na] = attr[att]; attr[att] = nil; end end for a,v in pairs(attrx) do - attr[x] = v; + attr[a] = v; end setmetatable(stanza, stanza_mt); for _, child in ipairs(stanza) do -- cgit v1.2.3 From 3ee35fe849abab96c33b9774fe439759943436a5 Mon Sep 17 00:00:00 2001 From: Waqas Hussain Date: Thu, 1 Apr 2010 19:27:26 +0500 Subject: util.uuid: Use a local instead of a global. --- util/uuid.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'util') diff --git a/util/uuid.lua b/util/uuid.lua index d46f8665..796c8ee4 100644 --- a/util/uuid.lua +++ b/util/uuid.lua @@ -32,7 +32,7 @@ local function _seed(x) buffer = new_random(buffer..x); end local function get_nibbles(n) - if #buffer < n then seed(uniq_time()); end + if #buffer < n then _seed(uniq_time()); end local r = buffer:sub(0, n); buffer = buffer:sub(n+1); return r; -- cgit v1.2.3 From 8e1f8ca95861cdc5fc23f92e8719250a22d061ec Mon Sep 17 00:00:00 2001 From: Waqas Hussain Date: Thu, 1 Apr 2010 19:28:23 +0500 Subject: util.ztact: Fixed global accesses. --- util/ztact.lua | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'util') diff --git a/util/ztact.lua b/util/ztact.lua index 35902ba1..2507bf8e 100644 --- a/util/ztact.lua +++ b/util/ztact.lua @@ -114,7 +114,7 @@ function tohex (s) -- - - - - - - - - - - - - - - - - - - - - - - - - tohex function tostring_r (d, indent, tab0) -- - - - - - - - - - - - - tostring_r - tab1 = tab0 or {} + local tab1 = tab0 or {} local rep = string.rep (' ', indent or 0) if type (d) == 'table' then for k,v in pairs (d) do @@ -210,7 +210,7 @@ function enqueue (queue, element) -- - - - - - - - - - - - - - - - - enqueue local function test_queue () - t = {} + local t = {} enqueue (t, 1) enqueue (t, 2) enqueue (t, 3) -- cgit v1.2.3