From ccc4e2a83f81a07ef522a271738a34c75c2a4752 Mon Sep 17 00:00:00 2001 From: Emmanuel Gil Peyrot Date: Tue, 19 Sep 2017 19:17:07 +0200 Subject: rostermanager: Simplify logging. --- core/rostermanager.lua | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'core/rostermanager.lua') diff --git a/core/rostermanager.lua b/core/rostermanager.lua index c94482c4..04f97f22 100644 --- a/core/rostermanager.lua +++ b/core/rostermanager.lua @@ -104,9 +104,9 @@ local function load_roster(username, host) if user then roster = user.roster; if roster then return roster; end - log("debug", "load_roster: loading for new user: %s@%s", username, host); + log("debug", "load_roster: loading for new user: %s", jid); else -- Attempt to load roster for non-loaded user - log("debug", "load_roster: loading for offline user: %s@%s", username, host); + log("debug", "load_roster: loading for offline user: %s", jid); end local roster_store = storagemanager.open(host, "roster", "keyval"); local data, err = roster_store:get(username); -- cgit v1.2.3 From e2a3d500049d4b7616388bf6f6cf94a51283a459 Mon Sep 17 00:00:00 2001 From: Emmanuel Gil Peyrot Date: Tue, 19 Sep 2017 19:17:23 +0200 Subject: rostermanager: Remove self-contact entry (fixes #933) --- core/rostermanager.lua | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'core/rostermanager.lua') diff --git a/core/rostermanager.lua b/core/rostermanager.lua index 04f97f22..ac5104c3 100644 --- a/core/rostermanager.lua +++ b/core/rostermanager.lua @@ -115,7 +115,8 @@ local function load_roster(username, host) roster_metadata(roster, err); if roster[jid] then roster[jid] = nil; - log("warn", "roster for %s has a self-contact", jid); + log("warn", "roster for %s had a self-contact, removing", jid); + roster_store:set(username, roster); end if not err then hosts[host].events.fire_event("roster-load", { username = username, host = host, roster = roster }); -- cgit v1.2.3 From 8bdde46dfd3b858f723219f8627951b90ff82a05 Mon Sep 17 00:00:00 2001 From: Kim Alvefur Date: Sun, 29 Oct 2017 00:05:26 +0200 Subject: rostermanager: Capitalize log message --- core/rostermanager.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'core/rostermanager.lua') diff --git a/core/rostermanager.lua b/core/rostermanager.lua index ac5104c3..32de3a54 100644 --- a/core/rostermanager.lua +++ b/core/rostermanager.lua @@ -115,7 +115,7 @@ local function load_roster(username, host) roster_metadata(roster, err); if roster[jid] then roster[jid] = nil; - log("warn", "roster for %s had a self-contact, removing", jid); + log("warn", "Roster for %s had a self-contact, removing", jid); roster_store:set(username, roster); end if not err then -- cgit v1.2.3 From 1925151837c00dd072dc1524853e07a7eebb382b Mon Sep 17 00:00:00 2001 From: Kim Alvefur Date: Sun, 29 Oct 2017 00:06:26 +0200 Subject: rostermanager: Demote warning to debug message --- core/rostermanager.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'core/rostermanager.lua') diff --git a/core/rostermanager.lua b/core/rostermanager.lua index 32de3a54..6acc1003 100644 --- a/core/rostermanager.lua +++ b/core/rostermanager.lua @@ -115,7 +115,7 @@ local function load_roster(username, host) roster_metadata(roster, err); if roster[jid] then roster[jid] = nil; - log("warn", "Roster for %s had a self-contact, removing", jid); + log("debug", "Roster for %s had a self-contact, removing", jid); roster_store:set(username, roster); end if not err then -- cgit v1.2.3 From 1ba31ce34d74feeb3de0db2c3093fb7f99a5c3b0 Mon Sep 17 00:00:00 2001 From: Kim Alvefur Date: Sun, 29 Oct 2017 00:07:18 +0200 Subject: rostermanager: Use internal method for storing removal of self-contact --- core/rostermanager.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'core/rostermanager.lua') diff --git a/core/rostermanager.lua b/core/rostermanager.lua index 6acc1003..dda69e7c 100644 --- a/core/rostermanager.lua +++ b/core/rostermanager.lua @@ -116,7 +116,7 @@ local function load_roster(username, host) if roster[jid] then roster[jid] = nil; log("debug", "Roster for %s had a self-contact, removing", jid); - roster_store:set(username, roster); + save_roster(username, host, roster, jid); end if not err then hosts[host].events.fire_event("roster-load", { username = username, host = host, roster = roster }); -- cgit v1.2.3 From b04b0835bc48d7578eb9a679ce5d23e2b4d9e192 Mon Sep 17 00:00:00 2001 From: Kim Alvefur Date: Sun, 29 Oct 2017 00:07:45 +0200 Subject: rostermanager: Log warning if removal self-contact failed --- core/rostermanager.lua | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'core/rostermanager.lua') diff --git a/core/rostermanager.lua b/core/rostermanager.lua index dda69e7c..f6a44028 100644 --- a/core/rostermanager.lua +++ b/core/rostermanager.lua @@ -116,7 +116,9 @@ local function load_roster(username, host) if roster[jid] then roster[jid] = nil; log("debug", "Roster for %s had a self-contact, removing", jid); - save_roster(username, host, roster, jid); + if not save_roster(username, host, roster, jid) then + log("warn", "Could not remove self-contact from roster for %s", jid); + end end if not err then hosts[host].events.fire_event("roster-load", { username = username, host = host, roster = roster }); -- cgit v1.2.3