From c718ab514e2b6d4bb77d25477c9545758c20ae4b Mon Sep 17 00:00:00 2001 From: George Hazan Date: Mon, 3 Mar 2025 18:43:09 +0300 Subject: =?UTF-8?q?fixes=20#4905=20(Steam:=20=D0=B3=D1=80=D1=83=D0=BF?= =?UTF-8?q?=D0=BF=D0=B0=20=D0=BD=D0=B5=20=D1=83=D0=B4=D0=B0=D0=BB=D1=8F?= =?UTF-8?q?=D0=B5=D1=82=D1=81=D1=8F=20=D0=B8=D0=B7=20=D1=81=D0=BF=D0=B8?= =?UTF-8?q?=D1=81=D0=BA=D0=B0=20=D0=BA=D0=BE=D0=BD=D1=82=D0=B0=D0=BA=D1=82?= =?UTF-8?q?=D0=BE=D0=B2=20=D0=BF=D1=80=D0=B8=20=D0=BF=D0=BE=D0=BA=D0=B8?= =?UTF-8?q?=D0=B4=D0=B0=D0=BD=D0=B8=D0=B8=20=D0=B5=D1=91=20=D1=87=D0=B5?= =?UTF-8?q?=D1=80=D0=B5=D0=B7=20=D1=81=D0=B0=D0=B9=D1=82)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- protocols/Steam/src/main.cpp | 1 + protocols/Steam/src/steam_chats.cpp | 12 ++++++++++++ protocols/Steam/src/steam_proto.h | 1 + 3 files changed, 14 insertions(+) (limited to 'protocols/Steam/src') diff --git a/protocols/Steam/src/main.cpp b/protocols/Steam/src/main.cpp index 13a688ac4e..babfc1b747 100644 --- a/protocols/Steam/src/main.cpp +++ b/protocols/Steam/src/main.cpp @@ -178,6 +178,7 @@ void CMPlugin::InitSteamServices() serviceHandlers[DeleteChatMessage] = ServiceResponseHandler(&CSteamProto::OnDoNothing); serviceHandlers[NotifyIncomingChatMessage] = ServiceResponseHandler(&CSteamProto::OnGetChatMessage); serviceHandlers[NotifyModifiedChatMessage] = ServiceResponseHandler(&CSteamProto::OnDoNothing); + serviceHandlers[NotifyChatGroupUserStateChanged] = ServiceResponseHandler(&CSteamProto::OnDoNothing); serviceHandlers[GetOwnAuthorizedDevices] = ServiceResponseHandler(&CSteamProto::OnGotDeviceList); 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 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); + } } ///////////////////////////////////////////////////////////////////////////////////////// diff --git a/protocols/Steam/src/steam_proto.h b/protocols/Steam/src/steam_proto.h index 870d513c89..360a7403b3 100644 --- a/protocols/Steam/src/steam_proto.h +++ b/protocols/Steam/src/steam_proto.h @@ -41,6 +41,7 @@ #define NotifyIncomingChatMessage "ChatRoomClient.NotifyIncomingChatMessage#1" #define NotifyModifiedChatMessage "ChatRoomClient.NotifyChatMessageModified#1" +#define NotifyChatGroupUserStateChanged "ChatRoomClient.NotifyChatGroupUserStateChanged#1" #define NotificationReceived "SteamNotificationClient.NotificationsReceived#1" -- cgit v1.2.3