aboutsummaryrefslogtreecommitdiffstats
path: root/core/rostermanager.lua
diff options
context:
space:
mode:
authorWaqas Hussain <waqas20@gmail.com>2009-10-22 03:38:00 +0500
committerWaqas Hussain <waqas20@gmail.com>2009-10-22 03:38:00 +0500
commiteab91c4f75ae83515b2c576d540fbd3c84cb0943 (patch)
tree491392d3fe5e1ef263d7877a91d2bd3ee8d814e0 /core/rostermanager.lua
parentfefe960849623d219392f5d9f14df7892ce29d00 (diff)
downloadprosody-eab91c4f75ae83515b2c576d540fbd3c84cb0943.tar.gz
prosody-eab91c4f75ae83515b2c576d540fbd3c84cb0943.zip
rostermanager: Log a warning when a self-contact is detected.
Diffstat (limited to 'core/rostermanager.lua')
-rw-r--r--core/rostermanager.lua13
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