summaryrefslogtreecommitdiff
path: root/protocols/Telegram/src/groupchat.cpp
diff options
context:
space:
mode:
authorGeorge Hazan <george.hazan@gmail.com>2024-11-18 23:19:03 +0300
committerGeorge Hazan <george.hazan@gmail.com>2024-11-18 23:19:03 +0300
commiteaa7549c051641579edc045fbbab86c3129e85ee (patch)
tree2f0665840da2982aa121caed87dff87296d19574 /protocols/Telegram/src/groupchat.cpp
parentf9d4be52548544305949dffedddc0d2044bdc45d (diff)
Telegram: fix for broken forum threads
Diffstat (limited to 'protocols/Telegram/src/groupchat.cpp')
-rw-r--r--protocols/Telegram/src/groupchat.cpp10
1 files changed, 7 insertions, 3 deletions
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_);