diff options
author | Matthew Wild <mwild1@gmail.com> | 2009-06-22 14:14:28 +0100 |
---|---|---|
committer | Matthew Wild <mwild1@gmail.com> | 2009-06-22 14:14:28 +0100 |
commit | 5983be0564fe2ac2adb8f2a283b9a0241e00e04e (patch) | |
tree | 34d45a3393d5a56ec756b2186dad200e4f8cc096 /core | |
parent | 04d4fb4a735cf69c467e9f5782603e4c8364a099 (diff) | |
download | prosody-5983be0564fe2ac2adb8f2a283b9a0241e00e04e.tar.gz prosody-5983be0564fe2ac2adb8f2a283b9a0241e00e04e.zip |
rostermanager: Fire event on roster load
Diffstat (limited to 'core')
-rw-r--r-- | core/rostermanager.lua | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/core/rostermanager.lua b/core/rostermanager.lua index 867add2c..514d3d8e 100644 --- a/core/rostermanager.lua +++ b/core/rostermanager.lua @@ -82,19 +82,24 @@ end 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) |