diff options
author | George Hazan <george.hazan@gmail.com> | 2023-12-22 17:55:36 +0300 |
---|---|---|
committer | George Hazan <george.hazan@gmail.com> | 2023-12-22 17:55:36 +0300 |
commit | af546e2f55ccb9a270ce4967d1942aebfcbbea19 (patch) | |
tree | fc15b7c1616f190637989534918687cf17403274 /src/mir_app | |
parent | 7f2ed0ff4588043500b739e151c4db73e5e2968e (diff) |
DB::EventInfo::wipeNotify - useful helper to hide blinking event both from database & contact list
Diffstat (limited to 'src/mir_app')
-rw-r--r-- | src/mir_app/src/chat_log.cpp | 8 | ||||
-rw-r--r-- | src/mir_app/src/db_events.cpp | 10 | ||||
-rw-r--r-- | src/mir_app/src/file.cpp | 8 | ||||
-rw-r--r-- | src/mir_app/src/mir_app.def | 1 | ||||
-rw-r--r-- | src/mir_app/src/mir_app64.def | 1 | ||||
-rw-r--r-- | src/mir_app/src/srmm_log_rtf.cpp | 14 |
6 files changed, 28 insertions, 14 deletions
diff --git a/src/mir_app/src/chat_log.cpp b/src/mir_app/src/chat_log.cpp index 8ef8ffca1e..830430b0d5 100644 --- a/src/mir_app/src/chat_log.cpp +++ b/src/mir_app/src/chat_log.cpp @@ -319,15 +319,13 @@ void CRtfLogWindow::CreateChatRtfMessage(RtfChatLogStreamData *streamData, const if (lin.hEvent) {
DB::EventInfo dbei(lin.hEvent);
if (dbei) {
- if (dbei.eventType == EVENTTYPE_MESSAGE || dbei.eventType == EVENTTYPE_FILE || dbei.isSrmm()) {
- if (!dbei.markedRead())
- db_event_markRead(si->hContact, lin.hEvent);
- Clist_RemoveEvent(-1, lin.hEvent);
- }
+ if (dbei.eventType == EVENTTYPE_MESSAGE || dbei.eventType == EVENTTYPE_FILE || dbei.isSrmm())
+ dbei.wipeNotify(lin.hEvent);
if (dbei.eventType == EVENTTYPE_FILE) {
DB::FILE_BLOB blob(dbei);
if (blob.isOffline()) {
+ dbei.wipeNotify(lin.hEvent);
InsertFileLink(buf, lin.hEvent, blob);
return;
}
diff --git a/src/mir_app/src/db_events.cpp b/src/mir_app/src/db_events.cpp index 78d00685ef..1fb1a25a12 100644 --- a/src/mir_app/src/db_events.cpp +++ b/src/mir_app/src/db_events.cpp @@ -287,6 +287,16 @@ void DB::EventInfo::unload() bValid = false;
}
+void DB::EventInfo::wipeNotify(MEVENT hEvent)
+{
+ if (!bValid)
+ return;
+
+ if (!markedRead())
+ db_event_markRead(hContact, hEvent);
+ Clist_RemoveEvent(-1, hEvent);
+}
+
// could be displayed in a SRMM window
bool DB::EventInfo::isSrmm() const
{
diff --git a/src/mir_app/src/file.cpp b/src/mir_app/src/file.cpp index 8fa9291276..ed674f402a 100644 --- a/src/mir_app/src/file.cpp +++ b/src/mir_app/src/file.cpp @@ -77,10 +77,10 @@ static void RemoveUnreadFileEvents(void) for (auto &hContact : Contacts()) { MEVENT hDbEvent = db_event_firstUnread(hContact); while (hDbEvent) { - DBEVENTINFO dbei = {}; - db_event_get(hDbEvent, &dbei); - if (!dbei.markedRead() && dbei.eventType == EVENTTYPE_FILE) - db_event_markRead(hContact, hDbEvent); + DB::EventInfo dbei(hDbEvent, false); + if (dbei.eventType == EVENTTYPE_FILE) + dbei.wipeNotify(hDbEvent); + hDbEvent = db_event_next(hContact, hDbEvent); } } diff --git a/src/mir_app/src/mir_app.def b/src/mir_app/src/mir_app.def index 83ab5e5a8f..889d6acbf5 100644 --- a/src/mir_app/src/mir_app.def +++ b/src/mir_app/src/mir_app.def @@ -920,3 +920,4 @@ Clist_GroupSaveExpanded @1003 NONAME ?Send@File@@YGPAUHWND__@@IQAPA_W@Z @1038 NONAME
?GetReceivedFolder@File@@YGPA_WIPA_WI_N@Z @1039 NONAME
?DlgProc@CUserInfoPageDlg@@UAEHIIJ@Z @1040 NONAME
+?wipeNotify@EventInfo@DB@@QAEXI@Z @1047 NONAME
diff --git a/src/mir_app/src/mir_app64.def b/src/mir_app/src/mir_app64.def index a768154279..6ec4da466d 100644 --- a/src/mir_app/src/mir_app64.def +++ b/src/mir_app/src/mir_app64.def @@ -920,3 +920,4 @@ Clist_GroupSaveExpanded @1003 NONAME ?Send@File@@YAPEAUHWND__@@IQEAPEA_W@Z @1038 NONAME
?GetReceivedFolder@File@@YAPEA_WIPEA_W_K_N@Z @1039 NONAME
?DlgProc@CUserInfoPageDlg@@UEAA_JI_K_J@Z @1040 NONAME
+?wipeNotify@EventInfo@DB@@QEAAXI@Z @1041 NONAME
diff --git a/src/mir_app/src/srmm_log_rtf.cpp b/src/mir_app/src/srmm_log_rtf.cpp index af3cd6426e..94174b7dce 100644 --- a/src/mir_app/src/srmm_log_rtf.cpp +++ b/src/mir_app/src/srmm_log_rtf.cpp @@ -327,10 +327,14 @@ static bool CreateRtfFromDbEvent(RtfLogStreamData *dat) if (!dat->pLog->CreateRtfEvent(dat, dbei))
return false;
- if (!(dbei.flags & DBEF_SENT) && (dbei.eventType == EVENTTYPE_MESSAGE || dbei.isSrmm())) {
- if (!dbei.markedRead())
- db_event_markRead(dat->hContact, dat->hDbEvent);
- Clist_RemoveEvent(-1, dat->hDbEvent);
+ if (!(dbei.flags & DBEF_SENT)) {
+ if (dbei.eventType == EVENTTYPE_MESSAGE || dbei.isSrmm())
+ dbei.wipeNotify(dat->hDbEvent);
+ else if (dbei.eventType == EVENTTYPE_FILE) {
+ DB::FILE_BLOB blob(dbei);
+ if (blob.isOffline())
+ dbei.wipeNotify(dat->hDbEvent);
+ }
}
else if (dbei.eventType == EVENTTYPE_JABBER_CHATSTATES || dbei.eventType == EVENTTYPE_JABBER_PRESENCE) {
db_event_markRead(dat->hContact, dat->hDbEvent);
@@ -620,7 +624,7 @@ INT_PTR CRtfLogWindow::WndProc(UINT msg, WPARAM wParam, LPARAM lParam) return 0;
}
- LRESULT res = mir_callNextSubclass(m_rtf.GetHwnd(), stubLogProc, msg, wParam, lParam);
+ LRESULT res = mir_callNextSubclass(m_rtf.GetHwnd(), stubLogProc, msg, wParam, lParam);
if (msg == WM_GETDLGCODE)
return res & ~DLGC_HASSETSEL;
return res;
|