summaryrefslogtreecommitdiff
path: root/protocols/Telegram/src/proto.cpp
diff options
context:
space:
mode:
authorGeorge Hazan <ghazan@miranda.im>2023-03-29 13:05:35 +0300
committerGeorge Hazan <ghazan@miranda.im>2023-03-29 13:05:35 +0300
commit0770a12fb1d36674053771f2c559c508725090af (patch)
treec9144cce3d78dba371ed97fe99da279f373e1ecd /protocols/Telegram/src/proto.cpp
parenta95b57678699388a4e40716eacd8af5931574d72 (diff)
fixes #3402 (Telegram: mark read sending doesn't work sometimes)
Diffstat (limited to 'protocols/Telegram/src/proto.cpp')
-rw-r--r--protocols/Telegram/src/proto.cpp25
1 files changed, 12 insertions, 13 deletions
diff --git a/protocols/Telegram/src/proto.cpp b/protocols/Telegram/src/proto.cpp
index 26cc4e31d9..df74510a59 100644
--- a/protocols/Telegram/src/proto.cpp
+++ b/protocols/Telegram/src/proto.cpp
@@ -93,7 +93,7 @@ CTelegramProto::~CTelegramProto()
void CTelegramProto::OnContactDeleted(MCONTACT hContact)
{
- TD::int53 id = _atoi64(getMStringA(hContact, DBKEY_ID));
+ TD::int53 id = GetId(hContact);
if (id == 0)
return;
@@ -111,8 +111,7 @@ void CTelegramProto::OnContactDeleted(MCONTACT hContact)
int CTelegramProto::OnEmptyHistory(WPARAM hContact, LPARAM)
{
if (Proto_IsProtoOnContact(hContact, m_szModuleName)) {
- TD::int53 id = _atoi64(getMStringA(hContact, DBKEY_ID));
- if (auto *pUser = FindUser(id))
+ if (auto *pUser = FindUser(GetId(hContact)))
SendQuery(new TD::deleteChatHistory(pUser->chatId, true, true));
}
@@ -189,22 +188,22 @@ void CTelegramProto::OnEventDeleted(MCONTACT hContact, MEVENT hDbEvent)
if (!hContact)
return;
- ptrA userId(getStringA(hContact, DBKEY_ID));
- if (!userId)
+ auto *pUser = FindUser(GetId(hContact));
+ if (!pUser)
return;
DBEVENTINFO dbei = {};
db_event_get(hDbEvent, &dbei);
if (dbei.szId) {
mir_cslock lck(m_csDeleteMsg);
- if (m_deleteMsgContact) {
- if (m_deleteMsgContact != hContact)
+ if (m_deleteChatId) {
+ if (m_deleteChatId != pUser->chatId)
SendDeleteMsg();
m_impl.m_deleteMsg.Stop();
}
- m_deleteMsgContact = hContact;
+ m_deleteChatId = pUser->chatId;
m_deleteIds.push_back(_atoi64(dbei.szId));
m_impl.m_deleteMsg.Start(500);
}
@@ -215,22 +214,22 @@ void CTelegramProto::OnMarkRead(MCONTACT hContact, MEVENT hDbEvent)
if (!hContact)
return;
- ptrA userId(getStringA(hContact, DBKEY_ID));
- if (!userId)
+ auto *pUser = FindUser(GetId(hContact));
+ if (!pUser)
return;
DBEVENTINFO dbei = {};
db_event_get(hDbEvent, &dbei);
if (dbei.szId) {
mir_cslock lck(m_csMarkRead);
- if (m_markContact) {
- if (m_markContact != hContact)
+ if (m_markChatId) {
+ if (m_markChatId != hContact)
SendMarkRead();
m_impl.m_markRead.Stop();
}
- m_markContact = hContact;
+ m_markChatId = pUser->chatId;
m_markIds.push_back(_atoi64(dbei.szId));
m_impl.m_markRead.Start(500);
}