diff options
| author | George Hazan <ghazan@miranda.im> | 2023-01-11 12:05:57 +0300 |
|---|---|---|
| committer | George Hazan <ghazan@miranda.im> | 2023-01-11 12:05:57 +0300 |
| commit | 80879265e20ec0abd7384c20b670d9385b2e8f6a (patch) | |
| tree | 4b1016695f49a351306d72ce0803ed0dca55333b /protocols/Telegram/src/mt_proto.cpp | |
| parent | 9ab83c6bb239d88e54ae1ce7a8af49432543443a (diff) | |
Telegram: mark read sending optimization
Diffstat (limited to 'protocols/Telegram/src/mt_proto.cpp')
| -rw-r--r-- | protocols/Telegram/src/mt_proto.cpp | 14 |
1 files changed, 11 insertions, 3 deletions
diff --git a/protocols/Telegram/src/mt_proto.cpp b/protocols/Telegram/src/mt_proto.cpp index 87e7f5c7d7..a58c3ded1d 100644 --- a/protocols/Telegram/src/mt_proto.cpp +++ b/protocols/Telegram/src/mt_proto.cpp @@ -110,9 +110,17 @@ int CMTProto::OnDbMarkedRead(WPARAM hContact, LPARAM hDbEvent) DBEVENTINFO dbei = {}; db_event_get(hDbEvent, &dbei); if (dbei.szId) { - TD::array<TD::int53> ids; - ids.push_back(_atoi64(dbei.szId)); - SendQuery(new TD::viewMessages(_atoi64(userId), 0, std::move(ids), true)); + mir_cslock lck(m_csMarkRead); + if (m_markContact) { + if (m_markContact != hContact) + SendMarkRead(); + + m_impl.m_markRead.Stop(); + } + + m_markContact = hContact; + m_markIds.push_back(_atoi64(dbei.szId)); + m_impl.m_markRead.Start(500); } } |
