diff options
author | George Hazan <george.hazan@gmail.com> | 2024-11-27 21:42:32 +0300 |
---|---|---|
committer | George Hazan <george.hazan@gmail.com> | 2024-11-27 21:42:32 +0300 |
commit | cb73d3cc19a6f27185c5228ce604312fc3203797 (patch) | |
tree | c699fa0748a97989a57cd5fe1c8ec6561130d293 /protocols | |
parent | 6118d594ef03d4bf3591f1ea4cc5cf619315a78a (diff) |
Telegram: more correct way of thread history fetching
Diffstat (limited to 'protocols')
-rw-r--r-- | protocols/Telegram/src/server.cpp | 19 |
1 files changed, 12 insertions, 7 deletions
diff --git a/protocols/Telegram/src/server.cpp b/protocols/Telegram/src/server.cpp index c62aedca58..952e076940 100644 --- a/protocols/Telegram/src/server.cpp +++ b/protocols/Telegram/src/server.cpp @@ -502,15 +502,20 @@ INT_PTR CTelegramProto::SvcLoadServerHistory(WPARAM hContact, LPARAM) lastMsgId = dbei2id(dbei);
}
+ auto userId = GetId(hContact);
+
if (TD::int53 threadId = GetId(hContact, DBKEY_THREAD)) {
- auto chatId = GetId(hContact);
- auto *pUser = new TG_USER(-1, hContact, true);
- pUser->chatId = chatId;
- pUser->isForum = pUser->isGroupChat = true;
- pUser->nHistoryChunks = 5;
- SendQuery(new TD::getMessageThreadHistory(chatId, lastMsgId, lastMsgId, 0, 100), &CTelegramProto::OnGetHistory, pUser);
+ if (FindChat(userId)) {
+ auto *pUser = new TG_USER(-1, hContact, true);
+ pUser->chatId = userId;
+ pUser->isForum = pUser->isGroupChat = true;
+ pUser->nHistoryChunks = 5;
+ SendQuery(new TD::getMessageThreadHistory(pUser->chatId, lastMsgId, lastMsgId, 0, 100), &CTelegramProto::OnGetHistory, pUser);
+ return 0;
+ }
}
- else if (auto *pUser = FindUser(GetId(hContact))) {
+
+ if (auto *pUser = FindUser(userId)) {
pUser->nHistoryChunks = 5;
SendQuery(new TD::getChatHistory(pUser->chatId, lastMsgId, 0, 100, false), &CTelegramProto::OnGetHistory, pUser);
}
|