Software /
code /
prosody
Changeset
1380:9b3b43b8963a
rostermanager: Fire event on roster load
author | Matthew Wild <mwild1@gmail.com> |
---|---|
date | Mon, 22 Jun 2009 14:14:28 +0100 |
parents | 1379:03d8a930053f |
children | 1381:46a58df8557d |
files | core/rostermanager.lua |
diffstat | 1 files changed, 7 insertions(+), 2 deletions(-) [+] |
line wrap: on
line diff
--- a/core/rostermanager.lua Mon Jun 22 02:58:28 2009 +0100 +++ b/core/rostermanager.lua Mon Jun 22 14:14:28 2009 +0100 @@ -82,19 +82,24 @@ function load_roster(username, host) log("debug", "load_roster: asked for: "..username.."@"..host); + local roster; if hosts[host] and hosts[host].sessions[username] then - local roster = hosts[host].sessions[username].roster; + roster = hosts[host].sessions[username].roster; if not roster then log("debug", "load_roster: loading for new user: "..username.."@"..host); roster = datamanager.load(username, host, "roster") or {}; if not roster[false] then roster[false] = { }; end hosts[host].sessions[username].roster = roster; + hosts[host].events.fire_event("roster-load", username, host, roster); end return roster; end + -- Attempt to load roster for non-loaded user log("debug", "load_roster: loading for offline user: "..username.."@"..host); - return datamanager.load(username, host, "roster") or {}; + roster = datamanager.load(username, host, "roster") or {}; + hosts[host].events.fire_event("roster-load", username, host, roster); + return roster; end function save_roster(username, host)