From c6f19f056032de76565d097986d16db77b065a03 Mon Sep 17 00:00:00 2001
From: George Hazan <ghazan@miranda.im>
Date: Wed, 27 May 2020 16:54:25 +0300
Subject: Jabber: if we ignore roster nicks, we don't apply them when local
 CList/MyHandle isn't empty

---
 protocols/JabberG/src/jabber_util.cpp | 12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)

(limited to 'protocols/JabberG')

diff --git a/protocols/JabberG/src/jabber_util.cpp b/protocols/JabberG/src/jabber_util.cpp
index 0e02fe260a..aa64fb68e7 100755
--- a/protocols/JabberG/src/jabber_util.cpp
+++ b/protocols/JabberG/src/jabber_util.cpp
@@ -78,19 +78,19 @@ CMStringA MakeJid(const char *jid, const char *resource)
 
 void CJabberProto::UpdateItem(JABBER_LIST_ITEM *pItem, const char *name)
 {
-	if (name != nullptr) {
-		ptrA tszNick(getUStringA(pItem->hContact, "Nick"));
-		if (tszNick != nullptr) {
-			if (!m_bIgnoreRoster) {
+	if (!m_bIgnoreRoster || db_get_wsm(pItem->hContact, "CList", "MyHandle").IsEmpty()) {
+		if (name != nullptr) {
+			ptrA tszNick(getUStringA(pItem->hContact, "Nick"));
+			if (tszNick != nullptr) {
 				if (mir_strcmp(pItem->nick, tszNick) != 0)
 					db_set_utf(pItem->hContact, "CList", "MyHandle", pItem->nick);
 				else
 					db_unset(pItem->hContact, "CList", "MyHandle");
 			}
+			else db_set_utf(pItem->hContact, "CList", "MyHandle", pItem->nick);
 		}
-		else db_set_utf(pItem->hContact, "CList", "MyHandle", pItem->nick);
+		else db_unset(pItem->hContact, "CList", "MyHandle");
 	}
-	else db_unset(pItem->hContact, "CList", "MyHandle");
 
 	// check group delimiters
 	if (pItem->group && m_szGroupDelimiter) {
-- 
cgit v1.2.3