From 9c0b2a3e23db30483dcb42c33986027a64c3e5d0 Mon Sep 17 00:00:00 2001 From: Kim Alvefur Date: Thu, 14 May 2015 20:47:37 +0200 Subject: net.http.codes: Update from registry --- net/http/codes.lua | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/net/http/codes.lua b/net/http/codes.lua index 0cadd079..bc31c7dd 100644 --- a/net/http/codes.lua +++ b/net/http/codes.lua @@ -25,6 +25,7 @@ local response_codes = { [305] = "Use Proxy"; -- The 306 status code was used in a previous version of [RFC2616], is no longer used, and the code is reserved. [307] = "Temporary Redirect"; + [308] = "Permanent Redirect"; [400] = "Bad Request"; [401] = "Unauthorized"; @@ -39,17 +40,21 @@ local response_codes = { [410] = "Gone"; [411] = "Length Required"; [412] = "Precondition Failed"; - [413] = "Request Entity Too Large"; - [414] = "Request-URI Too Long"; + [413] = "Payload Too Large"; + [414] = "URI Too Long"; [415] = "Unsupported Media Type"; - [416] = "Requested Range Not Satisfiable"; + [416] = "Range Not Satisfiable"; [417] = "Expectation Failed"; [418] = "I'm a teapot"; + [421] = "Misdirected Request"; [422] = "Unprocessable Entity"; [423] = "Locked"; [424] = "Failed Dependency"; -- The 425 status code is reserved for the WebDAV advanced collections expired proposal [RFC2817] [426] = "Upgrade Required"; + [428] = "Precondition Required"; + [429] = "Too Many Requests"; + [431] = "Request Header Fields Too Large"; [500] = "Internal Server Error"; [501] = "Not Implemented"; @@ -61,6 +66,7 @@ local response_codes = { [507] = "Insufficient Storage"; [508] = "Loop Detected"; [510] = "Not Extended"; + [511] = "Network Authentication Required"; }; for k,v in pairs(response_codes) do response_codes[k] = k.." "..v; end -- cgit v1.2.3 From 1b433c8e7ff1197f3cd6d8c5010e11c292578fde Mon Sep 17 00:00:00 2001 From: Kim Alvefur Date: Fri, 15 May 2015 15:14:12 +0200 Subject: xep227store.lib.lua: Remove mostly duplicated code --- plugins/storage/xep227store.lib.lua | 168 ------------------------------------ 1 file changed, 168 deletions(-) delete mode 100644 plugins/storage/xep227store.lib.lua diff --git a/plugins/storage/xep227store.lib.lua b/plugins/storage/xep227store.lib.lua deleted file mode 100644 index 5ef8df54..00000000 --- a/plugins/storage/xep227store.lib.lua +++ /dev/null @@ -1,168 +0,0 @@ - -local st = require "util.stanza"; - -local function getXml(user, host) - local jid = user.."@"..host; - local path = "data/"..jid..".xml"; - local f = io.open(path); - if not f then return; end - local s = f:read("*a"); - return parse_xml_real(s); -end -local function setXml(user, host, xml) - local jid = user.."@"..host; - local path = "data/"..jid..".xml"; - if xml then - local f = io.open(path, "w"); - if not f then return; end - local s = tostring(xml); - f:write(s); - f:close(); - return true; - else - return os.remove(path); - end -end -local function getUserElement(xml) - if xml and xml.name == "server-data" then - local host = xml.tags[1]; - if host and host.name == "host" then - local user = host.tags[1]; - if user and user.name == "user" then - return user; - end - end - end -end -local function createOuterXml(user, host) - return st.stanza("server-data", {xmlns='http://www.xmpp.org/extensions/xep-0227.html#ns'}) - :tag("host", {jid=host}) - :tag("user", {name = user}); -end -local function removeFromArray(array, value) - for i,item in ipairs(array) do - if item == value then - table.remove(array, i); - return; - end - end -end -local function removeStanzaChild(s, child) - removeFromArray(s.tags, child); - removeFromArray(s, child); -end - -local handlers = {}; - -handlers.accounts = { - get = function(self, user) - local user = getUserElement(getXml(user, self.host)); - if user and user.attr.password then - return { password = user.attr.password }; - end - end; - set = function(self, user, data) - if data and data.password then - local xml = getXml(user, self.host); - if not xml then xml = createOuterXml(user, self.host); end - local usere = getUserElement(xml); - usere.attr.password = data.password; - return setXml(user, self.host, xml); - else - return setXml(user, self.host, nil); - end - end; -}; -handlers.vcard = { - get = function(self, user) - local user = getUserElement(getXml(user, self.host)); - if user then - local vcard = user:get_child("vCard", 'vcard-temp'); - if vcard then - return st.preserialize(vcard); - end - end - end; - set = function(self, user, data) - local xml = getXml(user, self.host); - local usere = xml and getUserElement(xml); - if usere then - local vcard = usere:get_child("vCard", 'vcard-temp'); - if vcard then - removeStanzaChild(usere, vcard); - elseif not data then - return true; - end - if data then - vcard = st.deserialize(data); - usere:add_child(vcard); - end - return setXml(user, self.host, xml); - end - return true; - end; -}; -handlers.private = { - get = function(self, user) - local user = getUserElement(getXml(user, self.host)); - if user then - local private = user:get_child("query", "jabber:iq:private"); - if private then - local r = {}; - for _, tag in ipairs(private.tags) do - r[tag.name..":"..tag.attr.xmlns] = st.preserialize(tag); - end - return r; - end - end - end; - set = function(self, user, data) - local xml = getXml(user, self.host); - local usere = xml and getUserElement(xml); - if usere then - local private = usere:get_child("query", 'jabber:iq:private'); - if private then removeStanzaChild(usere, private); end - if data and next(data) ~= nil then - private = st.stanza("query", {xmlns='jabber:iq:private'}); - for _,tag in pairs(data) do - private:add_child(st.deserialize(tag)); - end - usere:add_child(private); - end - return setXml(user, self.host, xml); - end - return true; - end; -}; - ------------------------------ -local driver = {}; -driver.__index = driver; - -function driver:open(host, datastore, typ) - local cache_key = host.." "..datastore; - if self.ds_cache[cache_key] then return self.ds_cache[cache_key]; end - local instance = setmetatable({}, self); - instance.host = host; - instance.datastore = datastore; - local handler = handlers[datastore]; - if not handler then return nil; end - for key,val in pairs(handler) do - instance[key] = val; - end - if instance.init then instance:init(); end - self.ds_cache[cache_key] = instance; - return instance; -end - ------------------------------ -local _M = {}; - -function _M.new() - local instance = setmetatable({}, driver); - instance.__index = instance; - instance.ds_cache = {}; - return instance; -end - -return _M; -- cgit v1.2.3 From de9745b3323173e4bb65ba30e86ba6e41659af09 Mon Sep 17 00:00:00 2001 From: Kim Alvefur Date: Fri, 15 May 2015 15:14:30 +0200 Subject: mod_storage_xep0227: Rename to reflect current naming practices --- plugins/mod_storage_xep0227.lua | 163 ++++++++++++++++++++++++++++++++++++++++ plugins/storage/mod_xep0227.lua | 163 ---------------------------------------- 2 files changed, 163 insertions(+), 163 deletions(-) create mode 100644 plugins/mod_storage_xep0227.lua delete mode 100644 plugins/storage/mod_xep0227.lua diff --git a/plugins/mod_storage_xep0227.lua b/plugins/mod_storage_xep0227.lua new file mode 100644 index 00000000..5d07a2ea --- /dev/null +++ b/plugins/mod_storage_xep0227.lua @@ -0,0 +1,163 @@ + +local ipairs, pairs = ipairs, pairs; +local setmetatable = setmetatable; +local tostring = tostring; +local next = next; +local t_remove = table.remove; +local os_remove = os.remove; +local io_open = io.open; + +local st = require "util.stanza"; +local parse_xml_real = require "util.xml".parse; + +local function getXml(user, host) + local jid = user.."@"..host; + local path = "data/"..jid..".xml"; + local f = io_open(path); + if not f then return; end + local s = f:read("*a"); + return parse_xml_real(s); +end +local function setXml(user, host, xml) + local jid = user.."@"..host; + local path = "data/"..jid..".xml"; + if xml then + local f = io_open(path, "w"); + if not f then return; end + local s = tostring(xml); + f:write(s); + f:close(); + return true; + else + return os_remove(path); + end +end +local function getUserElement(xml) + if xml and xml.name == "server-data" then + local host = xml.tags[1]; + if host and host.name == "host" then + local user = host.tags[1]; + if user and user.name == "user" then + return user; + end + end + end +end +local function createOuterXml(user, host) + return st.stanza("server-data", {xmlns='http://www.xmpp.org/extensions/xep-0227.html#ns'}) + :tag("host", {jid=host}) + :tag("user", {name = user}); +end +local function removeFromArray(array, value) + for i,item in ipairs(array) do + if item == value then + t_remove(array, i); + return; + end + end +end +local function removeStanzaChild(s, child) + removeFromArray(s.tags, child); + removeFromArray(s, child); +end + +local handlers = {}; + +handlers.accounts = { + get = function(self, user) + local user = getUserElement(getXml(user, self.host)); + if user and user.attr.password then + return { password = user.attr.password }; + end + end; + set = function(self, user, data) + if data and data.password then + local xml = getXml(user, self.host); + if not xml then xml = createOuterXml(user, self.host); end + local usere = getUserElement(xml); + usere.attr.password = data.password; + return setXml(user, self.host, xml); + else + return setXml(user, self.host, nil); + end + end; +}; +handlers.vcard = { + get = function(self, user) + local user = getUserElement(getXml(user, self.host)); + if user then + local vcard = user:get_child("vCard", 'vcard-temp'); + if vcard then + return st.preserialize(vcard); + end + end + end; + set = function(self, user, data) + local xml = getXml(user, self.host); + local usere = xml and getUserElement(xml); + if usere then + local vcard = usere:get_child("vCard", 'vcard-temp'); + if vcard then + removeStanzaChild(usere, vcard); + elseif not data then + return true; + end + if data then + vcard = st.deserialize(data); + usere:add_child(vcard); + end + return setXml(user, self.host, xml); + end + return true; + end; +}; +handlers.private = { + get = function(self, user) + local user = getUserElement(getXml(user, self.host)); + if user then + local private = user:get_child("query", "jabber:iq:private"); + if private then + local r = {}; + for _, tag in ipairs(private.tags) do + r[tag.name..":"..tag.attr.xmlns] = st.preserialize(tag); + end + return r; + end + end + end; + set = function(self, user, data) + local xml = getXml(user, self.host); + local usere = xml and getUserElement(xml); + if usere then + local private = usere:get_child("query", 'jabber:iq:private'); + if private then removeStanzaChild(usere, private); end + if data and next(data) ~= nil then + private = st.stanza("query", {xmlns='jabber:iq:private'}); + for _,tag in pairs(data) do + private:add_child(st.deserialize(tag)); + end + usere:add_child(private); + end + return setXml(user, self.host, xml); + end + return true; + end; +}; + +----------------------------- +local driver = {}; + +function driver:open(host, datastore, typ) + local instance = setmetatable({}, self); + instance.host = host; + instance.datastore = datastore; + local handler = handlers[datastore]; + if not handler then return nil; end + for key,val in pairs(handler) do + instance[key] = val; + end + if instance.init then instance:init(); end + return instance; +end + +module:provides("storage", driver); diff --git a/plugins/storage/mod_xep0227.lua b/plugins/storage/mod_xep0227.lua deleted file mode 100644 index 5d07a2ea..00000000 --- a/plugins/storage/mod_xep0227.lua +++ /dev/null @@ -1,163 +0,0 @@ - -local ipairs, pairs = ipairs, pairs; -local setmetatable = setmetatable; -local tostring = tostring; -local next = next; -local t_remove = table.remove; -local os_remove = os.remove; -local io_open = io.open; - -local st = require "util.stanza"; -local parse_xml_real = require "util.xml".parse; - -local function getXml(user, host) - local jid = user.."@"..host; - local path = "data/"..jid..".xml"; - local f = io_open(path); - if not f then return; end - local s = f:read("*a"); - return parse_xml_real(s); -end -local function setXml(user, host, xml) - local jid = user.."@"..host; - local path = "data/"..jid..".xml"; - if xml then - local f = io_open(path, "w"); - if not f then return; end - local s = tostring(xml); - f:write(s); - f:close(); - return true; - else - return os_remove(path); - end -end -local function getUserElement(xml) - if xml and xml.name == "server-data" then - local host = xml.tags[1]; - if host and host.name == "host" then - local user = host.tags[1]; - if user and user.name == "user" then - return user; - end - end - end -end -local function createOuterXml(user, host) - return st.stanza("server-data", {xmlns='http://www.xmpp.org/extensions/xep-0227.html#ns'}) - :tag("host", {jid=host}) - :tag("user", {name = user}); -end -local function removeFromArray(array, value) - for i,item in ipairs(array) do - if item == value then - t_remove(array, i); - return; - end - end -end -local function removeStanzaChild(s, child) - removeFromArray(s.tags, child); - removeFromArray(s, child); -end - -local handlers = {}; - -handlers.accounts = { - get = function(self, user) - local user = getUserElement(getXml(user, self.host)); - if user and user.attr.password then - return { password = user.attr.password }; - end - end; - set = function(self, user, data) - if data and data.password then - local xml = getXml(user, self.host); - if not xml then xml = createOuterXml(user, self.host); end - local usere = getUserElement(xml); - usere.attr.password = data.password; - return setXml(user, self.host, xml); - else - return setXml(user, self.host, nil); - end - end; -}; -handlers.vcard = { - get = function(self, user) - local user = getUserElement(getXml(user, self.host)); - if user then - local vcard = user:get_child("vCard", 'vcard-temp'); - if vcard then - return st.preserialize(vcard); - end - end - end; - set = function(self, user, data) - local xml = getXml(user, self.host); - local usere = xml and getUserElement(xml); - if usere then - local vcard = usere:get_child("vCard", 'vcard-temp'); - if vcard then - removeStanzaChild(usere, vcard); - elseif not data then - return true; - end - if data then - vcard = st.deserialize(data); - usere:add_child(vcard); - end - return setXml(user, self.host, xml); - end - return true; - end; -}; -handlers.private = { - get = function(self, user) - local user = getUserElement(getXml(user, self.host)); - if user then - local private = user:get_child("query", "jabber:iq:private"); - if private then - local r = {}; - for _, tag in ipairs(private.tags) do - r[tag.name..":"..tag.attr.xmlns] = st.preserialize(tag); - end - return r; - end - end - end; - set = function(self, user, data) - local xml = getXml(user, self.host); - local usere = xml and getUserElement(xml); - if usere then - local private = usere:get_child("query", 'jabber:iq:private'); - if private then removeStanzaChild(usere, private); end - if data and next(data) ~= nil then - private = st.stanza("query", {xmlns='jabber:iq:private'}); - for _,tag in pairs(data) do - private:add_child(st.deserialize(tag)); - end - usere:add_child(private); - end - return setXml(user, self.host, xml); - end - return true; - end; -}; - ------------------------------ -local driver = {}; - -function driver:open(host, datastore, typ) - local instance = setmetatable({}, self); - instance.host = host; - instance.datastore = datastore; - local handler = handlers[datastore]; - if not handler then return nil; end - for key,val in pairs(handler) do - instance[key] = val; - end - if instance.init then instance:init(); end - return instance; -end - -module:provides("storage", driver); -- cgit v1.2.3 From 7875c914d3cc4b533b058c9f78354cf6e0bb4192 Mon Sep 17 00:00:00 2001 From: Kim Alvefur Date: Fri, 15 May 2015 15:16:03 +0200 Subject: mod_storage_xep0227: Use configured storage path --- plugins/mod_storage_xep0227.lua | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/plugins/mod_storage_xep0227.lua b/plugins/mod_storage_xep0227.lua index 5d07a2ea..ebecad04 100644 --- a/plugins/mod_storage_xep0227.lua +++ b/plugins/mod_storage_xep0227.lua @@ -7,12 +7,13 @@ local t_remove = table.remove; local os_remove = os.remove; local io_open = io.open; +local paths = require"util.paths"; local st = require "util.stanza"; local parse_xml_real = require "util.xml".parse; local function getXml(user, host) local jid = user.."@"..host; - local path = "data/"..jid..".xml"; + local path = paths.join(prosody.paths.data, jid..".xml"); local f = io_open(path); if not f then return; end local s = f:read("*a"); @@ -20,7 +21,7 @@ local function getXml(user, host) end local function setXml(user, host, xml) local jid = user.."@"..host; - local path = "data/"..jid..".xml"; + local path = paths.join(prosody.paths.data, jid..".xml"); if xml then local f = io_open(path, "w"); if not f then return; end -- cgit v1.2.3 From 09475a58627185035bc27fa64af04ca968b293cd Mon Sep 17 00:00:00 2001 From: Kim Alvefur Date: Fri, 15 May 2015 15:17:27 +0200 Subject: mod_storage_xep0227: Close file handle after reading --- plugins/mod_storage_xep0227.lua | 1 + 1 file changed, 1 insertion(+) diff --git a/plugins/mod_storage_xep0227.lua b/plugins/mod_storage_xep0227.lua index ebecad04..b41fc6ce 100644 --- a/plugins/mod_storage_xep0227.lua +++ b/plugins/mod_storage_xep0227.lua @@ -17,6 +17,7 @@ local function getXml(user, host) local f = io_open(path); if not f then return; end local s = f:read("*a"); + f:close(); return parse_xml_real(s); end local function setXml(user, host, xml) -- cgit v1.2.3 From 72be074759b48e715c88c5c880e5f4b523f3ee5d Mon Sep 17 00:00:00 2001 From: Kim Alvefur Date: Fri, 15 May 2015 15:25:37 +0200 Subject: mod_storage_xep0227: Open file for writing even if removing so os.remove has a file to delete --- plugins/mod_storage_xep0227.lua | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/plugins/mod_storage_xep0227.lua b/plugins/mod_storage_xep0227.lua index b41fc6ce..22575fe3 100644 --- a/plugins/mod_storage_xep0227.lua +++ b/plugins/mod_storage_xep0227.lua @@ -23,14 +23,15 @@ end local function setXml(user, host, xml) local jid = user.."@"..host; local path = paths.join(prosody.paths.data, jid..".xml"); + local f = io_open(path, "w"); + if not f then return; end if xml then - local f = io_open(path, "w"); - if not f then return; end local s = tostring(xml); f:write(s); f:close(); return true; else + f:close(); return os_remove(path); end end -- cgit v1.2.3 From dabbd2ce70cea0764e992b35fdbe4db77988c015 Mon Sep 17 00:00:00 2001 From: Kim Alvefur Date: Fri, 15 May 2015 15:25:59 +0200 Subject: mod_storage_xep0227: Return error from io.open if unable to open file for writing --- plugins/mod_storage_xep0227.lua | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/plugins/mod_storage_xep0227.lua b/plugins/mod_storage_xep0227.lua index 22575fe3..61ef7d6d 100644 --- a/plugins/mod_storage_xep0227.lua +++ b/plugins/mod_storage_xep0227.lua @@ -23,8 +23,8 @@ end local function setXml(user, host, xml) local jid = user.."@"..host; local path = paths.join(prosody.paths.data, jid..".xml"); - local f = io_open(path, "w"); - if not f then return; end + local f, err = io_open(path, "w"); + if not f then return f, err; end if xml then local s = tostring(xml); f:write(s); -- cgit v1.2.3 From 12a016b88ac88f942f50ce71a660e032f383beb2 Mon Sep 17 00:00:00 2001 From: Kim Alvefur Date: Fri, 15 May 2015 15:29:05 +0200 Subject: mod_storage_xep0227: Update open method for current API --- plugins/mod_storage_xep0227.lua | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-) diff --git a/plugins/mod_storage_xep0227.lua b/plugins/mod_storage_xep0227.lua index 61ef7d6d..f3c6866c 100644 --- a/plugins/mod_storage_xep0227.lua +++ b/plugins/mod_storage_xep0227.lua @@ -150,15 +150,10 @@ handlers.private = { ----------------------------- local driver = {}; -function driver:open(host, datastore, typ) - local instance = setmetatable({}, self); - instance.host = host; - instance.datastore = datastore; +function driver:open(datastore, typ) local handler = handlers[datastore]; - if not handler then return nil; end - for key,val in pairs(handler) do - instance[key] = val; - end + if not handler then return nil, "unsupported-datastore"; end + local instance = setmetatable({ host = module.host; datastore = datastore; }, { __index = handler }); if instance.init then instance:init(); end return instance; end -- cgit v1.2.3 From d2481f9ae6c8080457c742d52ccf8b5dddbd08ad Mon Sep 17 00:00:00 2001 From: Kim Alvefur Date: Fri, 15 May 2015 15:30:38 +0200 Subject: mod_storage_xep0227: Use the registered namespace --- plugins/mod_storage_xep0227.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plugins/mod_storage_xep0227.lua b/plugins/mod_storage_xep0227.lua index f3c6866c..f1410d70 100644 --- a/plugins/mod_storage_xep0227.lua +++ b/plugins/mod_storage_xep0227.lua @@ -47,7 +47,7 @@ local function getUserElement(xml) end end local function createOuterXml(user, host) - return st.stanza("server-data", {xmlns='http://www.xmpp.org/extensions/xep-0227.html#ns'}) + return st.stanza("server-data", {xmlns='urn:xmpp:pie:0'}) :tag("host", {jid=host}) :tag("user", {name = user}); end -- cgit v1.2.3 From 83a9c237c37e55897eb666dde09a48e9a72799b8 Mon Sep 17 00:00:00 2001 From: Kim Alvefur Date: Fri, 15 May 2015 15:32:21 +0200 Subject: mod_storage_xep0227: Store data from mod_auth_internal_hashed in a private namespace --- plugins/mod_storage_xep0227.lua | 21 +++++++++++++++++++-- 1 file changed, 19 insertions(+), 2 deletions(-) diff --git a/plugins/mod_storage_xep0227.lua b/plugins/mod_storage_xep0227.lua index f1410d70..4510f5d1 100644 --- a/plugins/mod_storage_xep0227.lua +++ b/plugins/mod_storage_xep0227.lua @@ -66,19 +66,36 @@ end local handlers = {}; +-- In order to support mod_auth_internal_hashed +local extended = "http://prosody.im/protocol/extended-xep0227\1"; + handlers.accounts = { get = function(self, user) local user = getUserElement(getXml(user, self.host)); if user and user.attr.password then return { password = user.attr.password }; + elseif user then + local data = {}; + for k, v in pairs(user.attr) do + if k:sub(1, #extended) == extended then + data[k:sub(#extended+1)] = v; + end + end + return data; end end; set = function(self, user, data) - if data and data.password then + if data then local xml = getXml(user, self.host); if not xml then xml = createOuterXml(user, self.host); end local usere = getUserElement(xml); - usere.attr.password = data.password; + for k, v in pairs(data) do + if k == "password" then + usere.attr.password = v; + else + usere.attr[extended..k] = v; + end + end return setXml(user, self.host, xml); else return setXml(user, self.host, nil); -- cgit v1.2.3 From 2de1fd6037e68bdd0b103284ce7c94a2736d9eaa Mon Sep 17 00:00:00 2001 From: Kim Alvefur Date: Fri, 15 May 2015 15:32:39 +0200 Subject: mod_storage_xep0227: Silence luacheck warnings --- plugins/mod_storage_xep0227.lua | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/plugins/mod_storage_xep0227.lua b/plugins/mod_storage_xep0227.lua index 4510f5d1..ef227ca3 100644 --- a/plugins/mod_storage_xep0227.lua +++ b/plugins/mod_storage_xep0227.lua @@ -71,7 +71,7 @@ local extended = "http://prosody.im/protocol/extended-xep0227\1"; handlers.accounts = { get = function(self, user) - local user = getUserElement(getXml(user, self.host)); + user = getUserElement(getXml(user, self.host)); if user and user.attr.password then return { password = user.attr.password }; elseif user then @@ -104,7 +104,7 @@ handlers.accounts = { }; handlers.vcard = { get = function(self, user) - local user = getUserElement(getXml(user, self.host)); + user = getUserElement(getXml(user, self.host)); if user then local vcard = user:get_child("vCard", 'vcard-temp'); if vcard then @@ -133,7 +133,7 @@ handlers.vcard = { }; handlers.private = { get = function(self, user) - local user = getUserElement(getXml(user, self.host)); + user = getUserElement(getXml(user, self.host)); if user then local private = user:get_child("query", "jabber:iq:private"); if private then -- cgit v1.2.3