summaryrefslogtreecommitdiff
path: root/protocols/Telegram/src/proto.cpp
diff options
context:
space:
mode:
authorGeorge Hazan <george.hazan@gmail.com>2025-02-11 19:55:32 +0300
committerGeorge Hazan <george.hazan@gmail.com>2025-02-11 19:55:32 +0300
commitf34b6e62e80f8dd1e8c20ba26665a17301e5fbb8 (patch)
tree6e8884a4951a7e644630a2047f0008aa16c44332 /protocols/Telegram/src/proto.cpp
parent924e1a992d88c3f0f2a7cc25b83a8b94c58329b6 (diff)
Telegram: offline thread messages always fall into the main thread
Diffstat (limited to 'protocols/Telegram/src/proto.cpp')
-rw-r--r--protocols/Telegram/src/proto.cpp11
1 files changed, 10 insertions, 1 deletions
diff --git a/protocols/Telegram/src/proto.cpp b/protocols/Telegram/src/proto.cpp
index d8d6f3a842..c4042f1d52 100644
--- a/protocols/Telegram/src/proto.cpp
+++ b/protocols/Telegram/src/proto.cpp
@@ -17,7 +17,10 @@ static int CompareRequests(const TG_REQUEST_BASE *p1, const TG_REQUEST_BASE *p2)
}
static int CompareChats(const TG_USER *p1, const TG_USER *p2)
-{ return CompareId(p1->chatId, p2->chatId);
+{
+ if (p1->chatId != p2->chatId)
+ return CompareId(p1->chatId, p2->chatId);
+ return CompareId(p1->forumId, p2->forumId);
}
static int CompareUsers(const TG_USER *p1, const TG_USER *p2)
@@ -125,6 +128,12 @@ void CTelegramProto::OnCacheInit()
if (int64_t id = GetId(cc)) {
bool isGroupChat = isChatRoom(cc);
auto *pUser = new TG_USER(id, cc, isGroupChat);
+ if (auto iThreadId = GetId(cc, DBKEY_THREAD)) {
+ pUser->isForum = true;
+ pUser->chatId = pUser->id;
+ pUser->forumId = iThreadId;
+ m_arChats.insert(pUser);
+ }
pUser->szAvatarHash = getMStringA(cc, DBKEY_AVATAR_HASH);
m_arUsers.insert(pUser);
if (isGroupChat && iCompatLevel < 3)