Software /
code /
prosody
Changeset
2048:d420722519e1
rostermanager: Log a warning when a self-contact is detected.
author | Waqas Hussain <waqas20@gmail.com> |
---|---|
date | Thu, 22 Oct 2009 03:38:00 +0500 |
parents | 2047:fb236904c959 |
children | 2049:227f3fd2caaf |
files | core/rostermanager.lua |
diffstat | 1 files changed, 10 insertions(+), 3 deletions(-) [+] |
line wrap: on
line diff
--- a/core/rostermanager.lua Thu Oct 22 03:34:50 2009 +0500 +++ b/core/rostermanager.lua Thu Oct 22 03:38:00 2009 +0500 @@ -81,7 +81,8 @@ end function load_roster(username, host) - log("debug", "load_roster: asked for: "..username.."@"..host); + local jid = username.."@"..host; + log("debug", "load_roster: asked for: "..jid); local roster; if hosts[host] and hosts[host].sessions[username] then roster = hosts[host].sessions[username].roster; @@ -89,7 +90,10 @@ 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 - roster[username.."@"..host] = nil; + if roster[jid] then + roster[jid] = nil; + log("warn", "roster for "..jid.." has a self-contact"); + end hosts[host].sessions[username].roster = roster; hosts[host].events.fire_event("roster-load", username, host, roster); end @@ -100,7 +104,10 @@ log("debug", "load_roster: loading for offline user: "..username.."@"..host); roster = datamanager.load(username, host, "roster") or {}; if not roster[false] then roster[false] = { }; end - roster[username.."@"..host] = nil; + if roster[jid] then + roster[jid] = nil; + log("warn", "roster for "..jid.." has a self-contact"); + end hosts[host].events.fire_event("roster-load", username, host, roster); return roster; end