2
0
mirror of https://github.com/ars3niy/tdlib-purple synced 2025-08-31 05:55:08 +00:00

Temporary: remove secret chats when they are closed

This commit is contained in:
Arseniy Lartsev
2020-10-04 16:46:38 +02:00
parent a6062a50df
commit e6b9016a51
7 changed files with 75 additions and 15 deletions

View File

@@ -1595,6 +1595,13 @@ void PurpleTdClient::updateChat(const td::td_api::chat *chat)
purple_debug_misc(config::pluginId, "Update chat: %" G_GINT64_FORMAT " private user=%d basic group=%d supergroup=%d\n",
chat->id_, privateChatUser ? privateChatUser->id_ : 0, basicGroupId.value(), supergroupId.value());
SecretChatId secretChatId = getSecretChatId(*chat);
if (secretChatId.valid()) {
const td::td_api::secretChat *sc = m_data.getSecretChat(secretChatId);
if (sc && sc->state_ && (sc->state_->get_id() == td::td_api::secretChatStateClosed::ID))
deleteSecretChat(secretChatId, m_transceiver, m_data);
}
if (!privateChatUser)
downloadChatPhoto(*chat);