Software /
code /
prosody
Comparison
core/rostermanager.lua @ 2046:3992541f8a48
rostermanager: Remove self-contacts from loaded rosters.
author | Waqas Hussain <waqas20@gmail.com> |
---|---|
date | Thu, 22 Oct 2009 03:34:08 +0500 |
parent | 1947:ff2b86076e9c |
child | 2047:fb236904c959 |
comparison
equal
deleted
inserted
replaced
2045:3b7473a3fa44 | 2046:3992541f8a48 |
---|---|
87 roster = hosts[host].sessions[username].roster; | 87 roster = hosts[host].sessions[username].roster; |
88 if not roster then | 88 if not roster then |
89 log("debug", "load_roster: loading for new user: "..username.."@"..host); | 89 log("debug", "load_roster: loading for new user: "..username.."@"..host); |
90 roster = datamanager.load(username, host, "roster") or {}; | 90 roster = datamanager.load(username, host, "roster") or {}; |
91 if not roster[false] then roster[false] = { }; end | 91 if not roster[false] then roster[false] = { }; end |
92 roster[username.."@"..host] = nil; | |
92 hosts[host].sessions[username].roster = roster; | 93 hosts[host].sessions[username].roster = roster; |
93 hosts[host].events.fire_event("roster-load", username, host, roster); | 94 hosts[host].events.fire_event("roster-load", username, host, roster); |
94 end | 95 end |
95 return roster; | 96 return roster; |
96 end | 97 end |
97 | 98 |
98 -- Attempt to load roster for non-loaded user | 99 -- Attempt to load roster for non-loaded user |
99 log("debug", "load_roster: loading for offline user: "..username.."@"..host); | 100 log("debug", "load_roster: loading for offline user: "..username.."@"..host); |
100 roster = datamanager.load(username, host, "roster") or {}; | 101 roster = datamanager.load(username, host, "roster") or {}; |
102 roster[username.."@"..host] = nil; | |
101 hosts[host].events.fire_event("roster-load", username, host, roster); | 103 hosts[host].events.fire_event("roster-load", username, host, roster); |
102 return roster; | 104 return roster; |
103 end | 105 end |
104 | 106 |
105 function save_roster(username, host, roster) | 107 function save_roster(username, host, roster) |