diff options
author | George Hazan <george.hazan@gmail.com> | 2023-06-07 19:02:15 +0300 |
---|---|---|
committer | George Hazan <george.hazan@gmail.com> | 2023-06-07 19:02:15 +0300 |
commit | 285bec1935c0776b761374d8e545a6a5af7f96c9 (patch) | |
tree | cdaf782e729887fb8354fb6052cceb0eaf4c9d38 /protocols/Telegram | |
parent | be8a64b8d423f460c4ea9aeae1d2f20ed078dc6c (diff) |
fixes #3544 (Telegram: не работает загрузка истории для Saved messages)
Diffstat (limited to 'protocols/Telegram')
-rw-r--r-- | protocols/Telegram/src/proto.h | 2 | ||||
-rw-r--r-- | protocols/Telegram/src/server.cpp | 6 | ||||
-rw-r--r-- | protocols/Telegram/src/utils.cpp | 5 |
3 files changed, 11 insertions, 2 deletions
diff --git a/protocols/Telegram/src/proto.h b/protocols/Telegram/src/proto.h index 0e87fec62c..3142f65826 100644 --- a/protocols/Telegram/src/proto.h +++ b/protocols/Telegram/src/proto.h @@ -294,6 +294,8 @@ class CTelegramProto : public PROTO<CTelegramProto> int64_t GetId(MCONTACT); void SetId(MCONTACT, int64_t id); + MCONTACT GetRealContact(const TG_USER *pUser); + // Menus HGENMENU hmiForward; diff --git a/protocols/Telegram/src/server.cpp b/protocols/Telegram/src/server.cpp index 90fa86a76b..c8eba7f5ae 100644 --- a/protocols/Telegram/src/server.cpp +++ b/protocols/Telegram/src/server.cpp @@ -317,6 +317,8 @@ void CTelegramProto::OnGetHistory(td::ClientManager::Response &response, void *p continue;
CMStringA szBody = GetMessageText(pUser, pMsg);
+ if (szBody.IsEmpty())
+ continue;
DBEVENTINFO dbei = {};
dbei.eventType = EVENTTYPE_MESSAGE;
@@ -330,7 +332,7 @@ void CTelegramProto::OnGetHistory(td::ClientManager::Response &response, void *p dbei.flags |= DBEF_SENT;
if (this->GetGcUserId(pUser, pMsg, szUserId))
dbei.szUserId = szUserId;
- db_event_add(pUser->hContact, &dbei);
+ db_event_add(GetRealContact(pUser), &dbei);
}
if (lastMsgId != INT64_MAX)
@@ -650,7 +652,7 @@ void CTelegramProto::ProcessMessage(const TD::message *pMessage) pre.flags |= PREF_SENT;
if (GetGcUserId(pUser, pMessage, szUserId))
pre.szUserId = szUserId;
- ProtoChainRecvMsg((pUser->hContact) ? pUser->hContact : m_iSavedMessages, &pre);
+ ProtoChainRecvMsg(GetRealContact(pUser), &pre);
}
void CTelegramProto::ProcessMessageContent(TD::updateMessageContent *pObj)
diff --git a/protocols/Telegram/src/utils.cpp b/protocols/Telegram/src/utils.cpp index 6ed1bff00d..eab4d893f6 100644 --- a/protocols/Telegram/src/utils.cpp +++ b/protocols/Telegram/src/utils.cpp @@ -55,6 +55,11 @@ CMStringW TG_USER::getDisplayName() const return wszNick;
}
+MCONTACT CTelegramProto::GetRealContact(const TG_USER *pUser)
+{
+ return (pUser->hContact != 0) ? pUser->hContact : m_iSavedMessages;
+}
+
TG_USER* CTelegramProto::GetSender(const TD::MessageSender *pSender)
{
switch (pSender->get_id()) {
|