summaryrefslogtreecommitdiff
path: root/protocols/Steam/src/steam_chats.cpp
diff options
context:
space:
mode:
authorGeorge Hazan <george.hazan@gmail.com>2025-03-03 18:43:09 +0300
committerGeorge Hazan <george.hazan@gmail.com>2025-03-03 18:43:09 +0300
commitc718ab514e2b6d4bb77d25477c9545758c20ae4b (patch)
tree8387716859022b3a89d59eb59e5fb060898f2d0d /protocols/Steam/src/steam_chats.cpp
parent7da217df01b90af80d9c87354f60c8cc1c1014a4 (diff)
fixes #4905 (Steam: группа не удаляется из списка контактов при покидании её через сайт)
Diffstat (limited to 'protocols/Steam/src/steam_chats.cpp')
-rw-r--r--protocols/Steam/src/steam_chats.cpp12
1 files changed, 12 insertions, 0 deletions
diff --git a/protocols/Steam/src/steam_chats.cpp b/protocols/Steam/src/steam_chats.cpp
index dab76be00c..e59d39efe7 100644
--- a/protocols/Steam/src/steam_chats.cpp
+++ b/protocols/Steam/src/steam_chats.cpp
@@ -28,6 +28,7 @@ void CSteamProto::OnGetMyChats(const CChatRoomGetMyChatRoomGroupsResponse &reply
if (hdr.failed())
return;
+ std::map<MCONTACT, bool> chatIds;
for (int i = 0; i < reply.n_chat_room_groups; i++) {
auto *pGroup = reply.chat_room_groups[i]->group_summary;
@@ -87,6 +88,8 @@ void CSteamProto::OnGetMyChats(const CChatRoomGetMyChatRoomGroupsResponse &reply
}
else si->pParent = pOwner;
+ chatIds[si->hContact] = true;
+
setDword(si->hContact, "ChatId", pChat->chat_id);
if (!wszGrpName.IsEmpty())
Clist_SetGroup(si->hContact, wszGrpName);
@@ -112,6 +115,15 @@ void CSteamProto::OnGetMyChats(const CChatRoomGetMyChatRoomGroupsResponse &reply
SendGetChatHistory(si->hContact, dwLastMsgId);
}
}
+
+ // clean garbage
+ for (auto &cc : AccContacts()) {
+ if (!Contact::IsGroupChat(cc))
+ continue;
+
+ if (chatIds.find(cc) == chatIds.end())
+ db_delete_contact(cc, CDF_DEL_CONTACT);
+ }
}
/////////////////////////////////////////////////////////////////////////////////////////