summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGeorge Hazan <george.hazan@gmail.com>2024-02-25 11:38:33 +0300
committerGeorge Hazan <george.hazan@gmail.com>2024-02-25 11:38:33 +0300
commit32924be432eff09324f2ab1ac741a01bbfef75ca (patch)
treed969dc87e69416ec91f5bf1a3151d8f4804c3153
parentc57f6f8b5c848b9287a8ae7e9dd99ec38ec20e68 (diff)
ICQ: fix for removing contacts
-rw-r--r--protocols/ICQ-WIM/src/poll.cpp12
-rw-r--r--protocols/ICQ-WIM/src/proto.cpp2
2 files changed, 9 insertions, 5 deletions
diff --git a/protocols/ICQ-WIM/src/poll.cpp b/protocols/ICQ-WIM/src/poll.cpp
index c24fe39333..4e39a52060 100644
--- a/protocols/ICQ-WIM/src/poll.cpp
+++ b/protocols/ICQ-WIM/src/poll.cpp
@@ -104,14 +104,18 @@ void CIcqProto::ProcessDiff(const JSONNode &ev)
bool bCreated = false, bDeleted = (szType == "deleted");
+ int iProcessed = 0;
for (auto &buddy : it["buddies"]) {
- if (bDeleted)
- continue;
-
MCONTACT hContact = ParseBuddyInfo(buddy, true);
if (hContact == INVALID_CONTACT_ID)
continue;
+ iProcessed++;
+ if (bDeleted) {
+ db_delete_contact(hContact, CDF_FROM_SERVER);
+ continue;
+ }
+
ProcessOnline(buddy, hContact);
setWString(hContact, "IcqGroup", pGroup->wszName);
@@ -125,7 +129,7 @@ void CIcqProto::ProcessDiff(const JSONNode &ev)
Clist_SetGroup(hContact, pGroup->wszName);
}
- if (bDeleted)
+ if (bDeleted && !iProcessed)
m_arGroups.remove(pGroup);
}
diff --git a/protocols/ICQ-WIM/src/proto.cpp b/protocols/ICQ-WIM/src/proto.cpp
index 805f75ea2e..00f37bfa92 100644
--- a/protocols/ICQ-WIM/src/proto.cpp
+++ b/protocols/ICQ-WIM/src/proto.cpp
@@ -161,7 +161,7 @@ void CIcqProto::OnContactAdded(MCONTACT hContact)
bool CIcqProto::OnContactDeleted(MCONTACT hContact, uint32_t flags)
{
- if (flags & CDF_FROM_SERVER) {
+ if (flags & CDF_DEL_CONTACT) {
CMStringW szId(GetUserId(hContact));
if (!isChatRoom(hContact)) {
mir_cslock lck(m_csCache);