From eaa7549c051641579edc045fbbab86c3129e85ee Mon Sep 17 00:00:00 2001 From: George Hazan Date: Mon, 18 Nov 2024 23:19:03 +0300 Subject: Telegram: fix for broken forum threads --- protocols/Telegram/src/groupchat.cpp | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) (limited to 'protocols/Telegram/src/groupchat.cpp') diff --git a/protocols/Telegram/src/groupchat.cpp b/protocols/Telegram/src/groupchat.cpp index a5c575c66d..e3a646dc03 100644 --- a/protocols/Telegram/src/groupchat.cpp +++ b/protocols/Telegram/src/groupchat.cpp @@ -197,13 +197,11 @@ int CTelegramProto::GcEventHook(WPARAM, LPARAM lParam) if (mir_strcmpi(gch->si->pszModule, m_szModuleName)) return 0; - auto userId = _wtoi64(gch->si->ptszID); - switch (gch->iType) { case GC_USER_MESSAGE: if (gch->ptszText && mir_wstrlen(gch->ptszText) > 0) { rtrimw(gch->ptszText); - if (auto *pUser = FindUser(userId)) { + if (auto *pUser = (TG_USER *)gch->si->pItemData) { TD::int53 replyId = 0; if (auto *pDlg = gch->si->pDlg) { DB::EventInfo dbei(pDlg->m_hQuoteEvent, false); @@ -416,11 +414,17 @@ void CTelegramProto::ProcessForum(TD::updateForumTopicInfo *pForum) return; } + auto *pInfo = pForum->info_.get(); if (pUser->m_si == nullptr) { debugLogA("No parent chat for id %lld, skipping", pForum->chat_id_); return; } + if (pInfo->is_general_) { + SetId(pUser->m_si->hContact, pForum->info_->message_thread_id_, DBKEY_THREAD); + return; + } + wchar_t wszId[100]; mir_snwprintf(wszId, L"%lld_%lld", pForum->chat_id_, pForum->info_->message_thread_id_); -- cgit v1.2.3