diff options
-rw-r--r-- | protocols/Telegram/src/groupchat.cpp | 10 | ||||
-rw-r--r-- | protocols/Telegram/src/server.cpp | 9 |
2 files changed, 14 insertions, 5 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_); diff --git a/protocols/Telegram/src/server.cpp b/protocols/Telegram/src/server.cpp index 0f97275314..e014f76a87 100644 --- a/protocols/Telegram/src/server.cpp +++ b/protocols/Telegram/src/server.cpp @@ -599,8 +599,13 @@ void CTelegramProto::ProcessChat(TD::updateNewChat *pObj) m_arChats.insert(pUser);
if (!szTitle.empty()) {
- if (hContact != INVALID_CONTACT_ID)
- GcChangeTopic(pUser, szTitle);
+ if (hContact != INVALID_CONTACT_ID) {
+ if (pUser->isForum) {
+ pUser->wszNick = Utf2T(szTitle.c_str());
+ SendQuery(new TD::getForumTopics(pUser->chatId, "", 0, 0, 0, 100));
+ }
+ else GcChangeTopic(pUser, szTitle);
+ }
else if (pUser->wszNick.IsEmpty())
pUser->wszFirstName = Utf2T(szTitle.c_str());
}
|