summaryrefslogtreecommitdiff
path: root/protocols/Telegram
diff options
context:
space:
mode:
Diffstat (limited to 'protocols/Telegram')
-rw-r--r--protocols/Telegram/src/proto.h2
-rw-r--r--protocols/Telegram/src/server.cpp5
-rw-r--r--protocols/Telegram/src/utils.cpp2
3 files changed, 7 insertions, 2 deletions
diff --git a/protocols/Telegram/src/proto.h b/protocols/Telegram/src/proto.h
index 020b6d740a..99e703d02c 100644
--- a/protocols/Telegram/src/proto.h
+++ b/protocols/Telegram/src/proto.h
@@ -98,7 +98,7 @@ struct TG_USER : public MZeroedObject
int64_t id, chatId = -1;
MCONTACT hContact;
- bool isGroupChat, isBot, bLoadMembers, bStartChat;
+ bool isGroupChat, isBot, bLoadMembers, bStartChat, bInited;
CMStringA szAvatarHash;
CMStringW wszNick, wszFirstName, wszLastName;
time_t m_timer1 = 0, m_timer2 = 0;
diff --git a/protocols/Telegram/src/server.cpp b/protocols/Telegram/src/server.cpp
index ae6ad7f162..bfed68de89 100644
--- a/protocols/Telegram/src/server.cpp
+++ b/protocols/Telegram/src/server.cpp
@@ -536,6 +536,7 @@ void CTelegramProto::ProcessChatLastMessage(TD::updateChatLastMessage *pObj)
return;
}
+ pUser->bInited = true;
if (pUser->hContact == INVALID_CONTACT_ID) {
debugLogA("Last message for a temporary contact, skipping");
return;
@@ -783,6 +784,8 @@ void CTelegramProto::ProcessMessage(const TD::message *pMessage)
dbei.timestamp = pMessage->date_;
if (pMessage->is_outgoing_)
dbei.flags |= DBEF_SENT;
+ if (!pUser->bInited)
+ dbei.flags |= DBEF_READ;
if (GetGcUserId(pUser, pMessage, szUserId))
dbei.szUserId = szUserId;
if (pMessage->reply_to_message_id_) {
@@ -798,6 +801,8 @@ void CTelegramProto::ProcessMessage(const TD::message *pMessage)
pre.timestamp = pMessage->date_;
if (pMessage->is_outgoing_)
pre.flags |= PREF_SENT;
+ if (!pUser->bInited)
+ pre.flags |= PREF_CREATEREAD;
if (GetGcUserId(pUser, pMessage, szUserId))
pre.szUserId = szUserId;
if (pMessage->reply_to_message_id_) {
diff --git a/protocols/Telegram/src/utils.cpp b/protocols/Telegram/src/utils.cpp
index a8fc7e2b56..ddf70e97ea 100644
--- a/protocols/Telegram/src/utils.cpp
+++ b/protocols/Telegram/src/utils.cpp
@@ -415,7 +415,7 @@ bool CTelegramProto::GetMessageFile(
pre.descr.a = caption.c_str();
if (pMsg->is_outgoing_)
pre.dwFlags |= PRFF_SENT;
- if (Contact::IsGroupChat(hContact))
+ if (Contact::IsGroupChat(hContact) || !pUser->bInited)
pre.dwFlags |= PRFF_READ;
if (pMsg->reply_to_message_id_) {
_i64toa(pMsg->reply_to_message_id_, szReplyId, 10);