Mercurial > prosody-hg
comparison util/datamanager.lua @ 4541:05f5ec99da77
Merge with trunk
| author | Matthew Wild <mwild1@gmail.com> |
|---|---|
| date | Sun, 22 Jan 2012 22:55:49 +0000 |
| parents | 7de17ca4de14 |
| children | 5243b74a4cbb 85b2689dbcfe |
comparison
equal
deleted
inserted
replaced
| 4530:40905e7bf680 | 4541:05f5ec99da77 |
|---|---|
| 1 -- Prosody IM | 1 -- Prosody IM |
| 2 -- Copyright (C) 2008-2010 Matthew Wild | 2 -- Copyright (C) 2008-2010 Matthew Wild |
| 3 -- Copyright (C) 2008-2010 Waqas Hussain | 3 -- Copyright (C) 2008-2010 Waqas Hussain |
| 4 -- | 4 -- |
| 5 -- This project is MIT/X11 licensed. Please see the | 5 -- This project is MIT/X11 licensed. Please see the |
| 6 -- COPYING file in the source package for more information. | 6 -- COPYING file in the source package for more information. |
| 7 -- | 7 -- |
| 8 | 8 |
| 9 | 9 |
| 18 local tostring, tonumber = tostring, tonumber; | 18 local tostring, tonumber = tostring, tonumber; |
| 19 local error = error; | 19 local error = error; |
| 20 local next = next; | 20 local next = next; |
| 21 local t_insert = table.insert; | 21 local t_insert = table.insert; |
| 22 local append = require "util.serialization".append; | 22 local append = require "util.serialization".append; |
| 23 local path_separator = "/"; if os.getenv("WINDIR") then path_separator = "\\" end | 23 local path_separator = assert ( package.config:match ( "^([^\n]+)" ) , "package.config not in standard form" ) -- Extract directory seperator from package.config (an undocumented string that comes with lua) |
| 24 local lfs = require "lfs"; | 24 local lfs = require "lfs"; |
| 25 local prosody = prosody; | 25 local prosody = prosody; |
| 26 local raw_mkdir; | 26 local raw_mkdir; |
| 27 | 27 |
| 28 if prosody.platform == "posix" then | 28 if prosody.platform == "posix" then |
| 70 local function callback(username, host, datastore, data) | 70 local function callback(username, host, datastore, data) |
| 71 for _, f in ipairs(callbacks) do | 71 for _, f in ipairs(callbacks) do |
| 72 username, host, datastore, data = f(username, host, datastore, data); | 72 username, host, datastore, data = f(username, host, datastore, data); |
| 73 if username == false then break; end | 73 if username == false then break; end |
| 74 end | 74 end |
| 75 | 75 |
| 76 return username, host, datastore, data; | 76 return username, host, datastore, data; |
| 77 end | 77 end |
| 78 function add_callback(func) | 78 function add_callback(func) |
| 79 if not callbacks[func] then -- Would you really want to set the same callback more than once? | 79 if not callbacks[func] then -- Would you really want to set the same callback more than once? |
| 80 callbacks[func] = true; | 80 callbacks[func] = true; |
