diff options
author | Waqas Hussain <waqas20@gmail.com> | 2009-10-22 03:38:00 +0500 |
---|---|---|
committer | Waqas Hussain <waqas20@gmail.com> | 2009-10-22 03:38:00 +0500 |
commit | eab91c4f75ae83515b2c576d540fbd3c84cb0943 (patch) | |
tree | 491392d3fe5e1ef263d7877a91d2bd3ee8d814e0 /core | |
parent | fefe960849623d219392f5d9f14df7892ce29d00 (diff) | |
download | prosody-eab91c4f75ae83515b2c576d540fbd3c84cb0943.tar.gz prosody-eab91c4f75ae83515b2c576d540fbd3c84cb0943.zip |
rostermanager: Log a warning when a self-contact is detected.
Diffstat (limited to 'core')
-rw-r--r-- | core/rostermanager.lua | 13 |
1 files changed, 10 insertions, 3 deletions
diff --git a/core/rostermanager.lua b/core/rostermanager.lua index b415c21c..a3aaf6f1 100644 --- a/core/rostermanager.lua +++ b/core/rostermanager.lua @@ -81,7 +81,8 @@ function roster_push(username, host, jid) 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 @@ function load_roster(username, host) 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 @@ function load_roster(username, host) 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 |