mirror of
https://github.com/bjc/prosody.git
synced 2025-04-04 13:47:41 +03:00
Fixed: Typos caused by lack of sleep.
Learned: Lua variable assignments are not expressions.
This commit is contained in:
parent
bbff39858d
commit
1cdd0be85d
1 changed files with 6 additions and 3 deletions
|
@ -8,6 +8,8 @@ local setmetatable = setmetatable;
|
||||||
local format = string.format;
|
local format = string.format;
|
||||||
local loadfile, setfenv, pcall = loadfile, setfenv, pcall;
|
local loadfile, setfenv, pcall = loadfile, setfenv, pcall;
|
||||||
|
|
||||||
|
local hosts = hosts;
|
||||||
|
|
||||||
require "util.datamanager"
|
require "util.datamanager"
|
||||||
|
|
||||||
local datamanager = datamanager;
|
local datamanager = datamanager;
|
||||||
|
@ -35,18 +37,19 @@ function remove_from_roster(roster, jid)
|
||||||
-- TODO implement
|
-- TODO implement
|
||||||
end
|
end
|
||||||
|
|
||||||
function load_roster(host, username)
|
function load_roster(username, host)
|
||||||
if hosts[host] and hosts[host].sessions[username] then
|
if hosts[host] and hosts[host].sessions[username] then
|
||||||
local roster = hosts[host].sessions[username].roster;
|
local roster = hosts[host].sessions[username].roster;
|
||||||
if not roster then
|
if not roster then
|
||||||
return hosts[host].sessions[username].roster = datamanger.load(username, host, "roster") or {};
|
roster = datamanager.load(username, host, "roster") or {};
|
||||||
|
hosts[host].sessions[username].roster = roster;
|
||||||
end
|
end
|
||||||
return roster;
|
return roster;
|
||||||
end
|
end
|
||||||
error("Attempt to load roster for non-loaded user"); --return nil;
|
error("Attempt to load roster for non-loaded user"); --return nil;
|
||||||
end
|
end
|
||||||
|
|
||||||
function save_roster(host, username)
|
function save_roster(username, host)
|
||||||
if hosts[host] and hosts[host].sessions[username] and hosts[host].sessions[username].roster then
|
if hosts[host] and hosts[host].sessions[username] and hosts[host].sessions[username].roster then
|
||||||
return datamanager.save(username, host, "roster", hosts[host].sessions[username].roster);
|
return datamanager.save(username, host, "roster", hosts[host].sessions[username].roster);
|
||||||
end
|
end
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue