summaryrefslogtreecommitdiff
path: root/protocols/Steam/src/steam_chats.cpp
diff options
context:
space:
mode:
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);
+ }
}
/////////////////////////////////////////////////////////////////////////////////////////