From 9d172663dda93e682c06fa2a9b55944756db4373 Mon Sep 17 00:00:00 2001 From: George Hazan Date: Mon, 28 Apr 2025 12:31:18 +0300 Subject: =?UTF-8?q?fixes=20#5004=20(NewStory:=20=D0=B8=D0=BD=D0=B4=D0=B8?= =?UTF-8?q?=D0=BA=D0=B0=D1=86=D0=B8=D1=8F=20=D0=BE=D1=82=D1=80=D0=B5=D0=B4?= =?UTF-8?q?=D0=B0=D0=BA=D1=82=D0=B8=D1=80=D0=BE=D0=B2=D0=B0=D0=BD=D0=BD?= =?UTF-8?q?=D0=BE=D0=B3=D0=BE=20=D1=81=D0=BE=D0=BE=D0=B1=D1=89=D0=B5=D0=BD?= =?UTF-8?q?=D0=B8=D1=8F)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- include/m_database.h | 1 + plugins/Dbx_sqlite/src/dbevents.cpp | 1 + plugins/NewStory/src/history_control.cpp | 12 ++++++++++-- protocols/Telegram/src/server.cpp | 6 +++++- 4 files changed, 17 insertions(+), 3 deletions(-) diff --git a/include/m_database.h b/include/m_database.h index 3a1393d2d4..1fc5614a0e 100644 --- a/include/m_database.h +++ b/include/m_database.h @@ -208,6 +208,7 @@ struct DBEVENTINFO bool isBookmark : 1; // event is bookmarked bool isJson : 1; // event's body is a JSON structure bool bMsec : 1; // event's timestamp is in milliseconds + bool bEdited : 1; // event was edited }; }; diff --git a/plugins/Dbx_sqlite/src/dbevents.cpp b/plugins/Dbx_sqlite/src/dbevents.cpp index 814e6428c6..0b934a3e48 100644 --- a/plugins/Dbx_sqlite/src/dbevents.cpp +++ b/plugins/Dbx_sqlite/src/dbevents.cpp @@ -285,6 +285,7 @@ BOOL CDbxSQLite::EditEvent(MEVENT hDbEvent, const DBEVENTINFO *dbei) if (tmp.bSent) tmp.bRead = true; + tmp.bEdited = true; mir_cslockfull lock(m_csDbAccess); sqlite3_stmt *stmt; diff --git a/plugins/NewStory/src/history_control.cpp b/plugins/NewStory/src/history_control.cpp index ee3ba8daec..bea9d73618 100644 --- a/plugins/NewStory/src/history_control.cpp +++ b/plugins/NewStory/src/history_control.cpp @@ -805,7 +805,7 @@ void NewstoryListData::Paint(simpledib::dib &dib) if (g_plugin.bShowType) { switch (pItem->dbe.eventType) { case EVENTTYPE_MESSAGE: - hIcon = g_plugin.getIcon(IDI_SENDMSG); + hIcon = Skin_LoadIcon(SKINICON_EVENT_MESSAGE); break; case EVENTTYPE_FILE: hIcon = Skin_LoadIcon(SKINICON_EVENT_FILE); @@ -819,6 +819,7 @@ void NewstoryListData::Paint(simpledib::dib &dib) } DrawIconEx(dib, xPos, yPos, hIcon, 16, 16, 0, 0, DI_NORMAL); xPos += 18; + IcoLib_ReleaseIcon(hIcon); } // Direction icon @@ -829,10 +830,11 @@ void NewstoryListData::Paint(simpledib::dib &dib) hIcon = g_plugin.getIcon(IDI_MSGIN); DrawIconEx(dib, xPos, yPos, hIcon, 16, 16, 0, 0, DI_NORMAL); xPos += 18; + IcoLib_ReleaseIcon(hIcon); } // Bookmark icon - if (pItem->dbe.flags & DBEF_BOOKMARK) { + if (pItem->dbe.isBookmark) { DrawIconEx(dib, xPos, yPos, g_plugin.getIcon(IDI_BOOKMARK), 16, 16, 0, 0, DI_NORMAL); xPos += 18; } @@ -850,6 +852,12 @@ void NewstoryListData::Paint(simpledib::dib &dib) DrawIconEx(dib, cachedWindowWidth - (xRight = 20), yPos, g_plugin.getIcon(IDI_REMOTEREAD), 16, 16, 0, 0, DI_NORMAL); else if (pItem->m_bDelivered) DrawIconEx(dib, cachedWindowWidth - (xRight = 20), yPos, g_plugin.getIcon(IDI_DELIVERED), 16, 16, 0, 0, DI_NORMAL); + + // Edited icon + if (pItem->dbe.bEdited) { + xRight += 20; + DrawIconEx(dib, cachedWindowWidth - xRight, yPos, g_plugin.getIcon(IDI_SENDMSG), 16, 16, 0, 0, DI_NORMAL); + } } // draw html itself diff --git a/protocols/Telegram/src/server.cpp b/protocols/Telegram/src/server.cpp index 9ecd5ff29a..0c144c1e6f 100644 --- a/protocols/Telegram/src/server.cpp +++ b/protocols/Telegram/src/server.cpp @@ -483,7 +483,9 @@ void CTelegramProto::OnGetHistory(td::ClientManager::Response &response, void *p dbei.cbBlob = szBody.GetLength(); dbei.pBlob = szBody.GetBuffer(); dbei.szId = szMsgId; - dbei.flags = DBEF_READ | DBEF_UTF; + dbei.bRead = dbei.bUtf = true; + if (pMsg->edit_date_) + dbei.bEdited = true; if (pMsg->is_outgoing_) dbei.flags |= DBEF_SENT; if (this->GetGcUserId(pUser, pMsg, szUserId)) @@ -997,6 +999,8 @@ void CTelegramProto::ProcessMessage(const TD::message *pMessage) dbei.bSent = dbei.bRead = true; else if (pMessage->id_ <= pUser->lastReadId) dbei.bRead = true; + if (pMessage->edit_date_) + dbei.bEdited = true; if (!pUser->bInited) dbei.bRead = true; if (GetGcUserId(pUser, pMessage, szUserId)) -- cgit v1.2.3