From e69b5b2a3a758022c48179c86fa5a5d246aabeba Mon Sep 17 00:00:00 2001 From: George Hazan Date: Sun, 2 Feb 2025 19:51:35 +0300 Subject: Telegram: - fix for the forums with more than 100 threads; - fix for the files receiving in threads --- protocols/Telegram/src/utils.cpp | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) (limited to 'protocols/Telegram/src/utils.cpp') diff --git a/protocols/Telegram/src/utils.cpp b/protocols/Telegram/src/utils.cpp index 3d33b6b0c8..4e8a22192e 100644 --- a/protocols/Telegram/src/utils.cpp +++ b/protocols/Telegram/src/utils.cpp @@ -232,8 +232,14 @@ int CTelegramProto::GetDefaultMute(const TG_USER *pUser) return m_iDefaultMutePrivate; } -MCONTACT CTelegramProto::GetRealContact(const TG_USER *pUser) +MCONTACT CTelegramProto::GetRealContact(const TG_USER *pUser, int64_t threadId) { + if (threadId) { + wchar_t buf[100]; + mir_snwprintf(buf, L"%lld_%lld", pUser->chatId, threadId); + if (auto *si = Chat_Find(buf, m_szModuleName)) + return si->hContact; + } return (pUser->hContact != 0) ? pUser->hContact : m_iSavedMessages; } @@ -452,7 +458,7 @@ bool CTelegramProto::GetMessageFile(const EmbeddedFile &F, TG_FILE_REQUEST::Type pRequest->m_fileName = Utf2T(pszFileName); pRequest->m_fileSize = pFile->size_; pRequest->m_bRecv = !F.pMsg->is_outgoing_; - pRequest->m_hContact = GetRealContact(F.pUser); + pRequest->m_hContact = GetRealContact(F.pUser, F.pMsg->message_thread_id_); if (mir_strlen(pszCaption)) F.szBody += pszCaption; -- cgit v1.2.3