Changeset

103:ebdb7875443e

Fixed: Typos caused by lack of sleep. Learned: Lua variable assignments are not expressions.
author Waqas Hussain <waqas20@gmail.com>
date Tue, 14 Oct 2008 07:20:29 +0500
parents 102:a5b914370db5
children 104:cfbd3b849f9e
files core/rostermanager.lua
diffstat 1 files changed, 6 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/core/rostermanager.lua	Sun Oct 12 17:41:14 2008 +0500
+++ b/core/rostermanager.lua	Tue Oct 14 07:20:29 2008 +0500
@@ -8,6 +8,8 @@
 local format = string.format;
 local loadfile, setfenv, pcall = loadfile, setfenv, pcall;
 
+local hosts = hosts;
+
 require "util.datamanager"
 
 local datamanager = datamanager;
@@ -35,18 +37,19 @@
 	-- TODO implement
 end
 
-function load_roster(host, username)
+function load_roster(username, host)
 	if hosts[host] and hosts[host].sessions[username] then
 		local roster = hosts[host].sessions[username].roster;
 		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
 		return roster;
 	end
 	error("Attempt to load roster for non-loaded user"); --return nil;
 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
 		return datamanager.save(username, host, "roster", hosts[host].sessions[username].roster);
 	end