From 6b0eb25a146260e8e4a42eef18fcd51ad971e7a0 Mon Sep 17 00:00:00 2001 From: George Hazan Date: Sun, 10 Mar 2024 12:07:19 +0300 Subject: code cleaning --- include/m_database.h | 9 +++++---- libs/win32/mir_app.lib | Bin 291820 -> 291812 bytes libs/win64/mir_app.lib | Bin 291580 -> 291568 bytes plugins/IEView/src/HTMLBuilder.cpp | 2 +- plugins/NewStory/src/history_array.cpp | 2 +- plugins/TabSRMM/src/msglog.cpp | 2 +- protocols/Facebook/src/server.cpp | 2 +- protocols/JabberG/src/jabber_rc.cpp | 2 +- src/mir_app/src/chat_log.cpp | 4 ++-- src/mir_app/src/db_events.cpp | 23 ++++++++++++----------- src/mir_app/src/file.cpp | 2 +- src/mir_app/src/mir_app.def | 4 ++-- src/mir_app/src/mir_app64.def | 4 ++-- src/mir_app/src/srmm_log_rtf.cpp | 4 ++-- 14 files changed, 31 insertions(+), 29 deletions(-) diff --git a/include/m_database.h b/include/m_database.h index 7f9d1600b1..4dd9e5dd8e 100644 --- a/include/m_database.h +++ b/include/m_database.h @@ -687,18 +687,19 @@ namespace DB class MIR_APP_EXPORT EventInfo : public DBEVENTINFO, public MNonCopyable { - bool bValid; + bool m_bValid; + MEVENT m_hEvent; public: explicit EventInfo(); explicit EventInfo(MEVENT hEvent, bool bFetchBlob = true); ~EventInfo(); - bool fetch(MEVENT hEvent, bool bFetchBlob = true); + bool fetch(bool bFetchBlob = true); void unload(); - void wipeNotify(MEVENT hEvent); + void wipeNotify(); - __forceinline operator bool() const { return bValid; } + __forceinline operator bool() const { return m_bValid; } bool isSrmm() const; // could be displayed in a SRMM window bool isHistory() const; // could be displayed in a history window diff --git a/libs/win32/mir_app.lib b/libs/win32/mir_app.lib index 7812501077..e17a24c630 100644 Binary files a/libs/win32/mir_app.lib and b/libs/win32/mir_app.lib differ diff --git a/libs/win64/mir_app.lib b/libs/win64/mir_app.lib index a3f4b42cf6..2a1801716d 100644 Binary files a/libs/win64/mir_app.lib and b/libs/win64/mir_app.lib differ diff --git a/plugins/IEView/src/HTMLBuilder.cpp b/plugins/IEView/src/HTMLBuilder.cpp index 47525671a0..c561a94f74 100644 --- a/plugins/IEView/src/HTMLBuilder.cpp +++ b/plugins/IEView/src/HTMLBuilder.cpp @@ -205,7 +205,7 @@ void HTMLBuilder::appendEventOld(IEView *view, IEVIEWEVENT *event) } if (dbei.eventType == EVENTTYPE_MESSAGE || dbei.eventType == EVENTTYPE_FILE) - dbei.wipeNotify(hDbEvent); + dbei.wipeNotify(); if (!isDbEventShown(dbei)) { hDbEvent = db_event_next(event->hContact, hDbEvent); diff --git a/plugins/NewStory/src/history_array.cpp b/plugins/NewStory/src/history_array.cpp index 81a2477619..6e9aa1f8df 100644 --- a/plugins/NewStory/src/history_array.cpp +++ b/plugins/NewStory/src/history_array.cpp @@ -478,7 +478,7 @@ void ItemData::load(bool bLoadAlways) void ItemData::markRead() { if (!(dbe.flags & DBEF_SENT)) - dbe.wipeNotify(hEvent); + dbe.wipeNotify(); } void ItemData::setText(HWND hwnd) diff --git a/plugins/TabSRMM/src/msglog.cpp b/plugins/TabSRMM/src/msglog.cpp index d2e55696f1..e046d26281 100644 --- a/plugins/TabSRMM/src/msglog.cpp +++ b/plugins/TabSRMM/src/msglog.cpp @@ -571,7 +571,7 @@ bool CLogWindow::CreateRtfEvent(RtfLogStreamData *streamData, DB::EventInfo &dbe BOOL isSent = (dbei.flags & DBEF_SENT); BOOL bIsStatusChangeEvent = IsStatusEvent(dbei.eventType); if (!isSent && bIsStatusChangeEvent) - dbei.wipeNotify(streamData->hDbEvent); + dbei.wipeNotify(); CMStringW msg(ptrW(DbEvent_GetTextW(&dbei))); if (msg.IsEmpty()) diff --git a/protocols/Facebook/src/server.cpp b/protocols/Facebook/src/server.cpp index 63f6f9d09a..b45e644ce7 100644 --- a/protocols/Facebook/src/server.cpp +++ b/protocols/Facebook/src/server.cpp @@ -956,7 +956,7 @@ void FacebookProto::OnPublishReadReceipt(const JSONNode &root) break; if (dbei.flags & DBEF_SENT) - dbei.wipeNotify(ev); + dbei.wipeNotify(); } } diff --git a/protocols/JabberG/src/jabber_rc.cpp b/protocols/JabberG/src/jabber_rc.cpp index 2b5f1bd73f..f6b35ce727 100644 --- a/protocols/JabberG/src/jabber_rc.cpp +++ b/protocols/JabberG/src/jabber_rc.cpp @@ -560,7 +560,7 @@ int CJabberProto::AdhocForwardHandler(const TiXmlElement*, CJabberIqInfo *pInfo, nEventsSent++; - dbei.wipeNotify(hDbEvent); + dbei.wipeNotify(); } } diff --git a/src/mir_app/src/chat_log.cpp b/src/mir_app/src/chat_log.cpp index 6ff849e8b0..e54fe9a108 100644 --- a/src/mir_app/src/chat_log.cpp +++ b/src/mir_app/src/chat_log.cpp @@ -320,12 +320,12 @@ void CRtfLogWindow::CreateChatRtfMessage(RtfChatLogStreamData *streamData, const DB::EventInfo dbei(lin.hEvent); if (dbei) { if (dbei.eventType == EVENTTYPE_MESSAGE || dbei.eventType == EVENTTYPE_FILE || dbei.isSrmm()) - dbei.wipeNotify(lin.hEvent); + dbei.wipeNotify(); if (dbei.eventType == EVENTTYPE_FILE) { DB::FILE_BLOB blob(dbei); if (blob.isOffline()) { - dbei.wipeNotify(lin.hEvent); + dbei.wipeNotify(); 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 45936d8900..8d4348c0bd 100644 --- a/src/mir_app/src/db_events.cpp +++ b/src/mir_app/src/db_events.cpp @@ -250,29 +250,30 @@ MIR_APP_DLL(HICON) DbEvent_GetIcon(DBEVENTINFO *dbei, int flags) ///////////////////////////////////////////////////////////////////////////////////////// -DB::EventInfo::EventInfo(MEVENT hEvent, bool bFetchBlob) +DB::EventInfo::EventInfo(MEVENT hEvent, bool bFetchBlob) : + m_hEvent(hEvent) { memset(this, 0, sizeof(*this)); - fetch(hEvent, bFetchBlob); + fetch(bFetchBlob); } DB::EventInfo::EventInfo() : - bValid(false) + m_bValid(false) { memset(this, 0, sizeof(*this)); } DB::EventInfo::~EventInfo() { - if (bValid) + if (m_bValid) mir_free(pBlob); } -bool DB::EventInfo::fetch(MEVENT hEvent, bool bFetchBlob) +bool DB::EventInfo::fetch(bool bFetchBlob) { if (bFetchBlob) cbBlob = -1; - return bValid = ::db_event_get(hEvent, this) == 0; + return m_bValid = ::db_event_get(m_hEvent, this) == 0; } void DB::EventInfo::unload() @@ -281,17 +282,17 @@ void DB::EventInfo::unload() mir_free(pBlob); pBlob = nullptr; } - bValid = false; + m_bValid = false; } -void DB::EventInfo::wipeNotify(MEVENT hEvent) +void DB::EventInfo::wipeNotify() { - if (!bValid) + if (!m_bValid) return; if (!markedRead()) - db_event_markRead(hContact, hEvent); - Clist_RemoveEvent(-1, hEvent); + db_event_markRead(hContact, m_hEvent); + Clist_RemoveEvent(-1, m_hEvent); } // could be displayed in a SRMM window diff --git a/src/mir_app/src/file.cpp b/src/mir_app/src/file.cpp index 9b1bafe1ad..ca76162356 100644 --- a/src/mir_app/src/file.cpp +++ b/src/mir_app/src/file.cpp @@ -80,7 +80,7 @@ static void RemoveUnreadFileEvents(void) while (hDbEvent) { DB::EventInfo dbei(hDbEvent, false); if (dbei.eventType == EVENTTYPE_FILE) - dbei.wipeNotify(hDbEvent); + dbei.wipeNotify(); 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 7600b61835..449e6af00c 100644 --- a/src/mir_app/src/mir_app.def +++ b/src/mir_app/src/mir_app.def @@ -902,13 +902,13 @@ Clist_GroupSaveExpanded @1003 NONAME ?addButton@CMPluginBase@@QAEPAXPBUBBButton@@@Z @1032 NONAME ?SetQuoteEvent@CSrmmBaseDialog@@QAEXI@Z @1033 NONAME ?onClick_CloseQuote@CSrmmBaseDialog@@IAEXPAVCCtrlButton@@@Z @1034 NONAME -?fetch@EventInfo@DB@@QAE_NI_N@Z @1035 NONAME +?fetch@EventInfo@DB@@QAE_N_N@Z @1035 NONAME ?unload@EventInfo@DB@@QAEXXZ @1036 NONAME ?isAlertable@EventInfo@DB@@QBE_NXZ @1037 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 +?wipeNotify@EventInfo@DB@@QAEXXZ @1041 NONAME _CallContactService@16 @1048 NONAME ??0MDatabaseExport@@QAE@XZ @1049 NONAME ??1MDatabaseExport@@UAE@XZ @1050 NONAME diff --git a/src/mir_app/src/mir_app64.def b/src/mir_app/src/mir_app64.def index 78a03b754f..5589f1a8b8 100644 --- a/src/mir_app/src/mir_app64.def +++ b/src/mir_app/src/mir_app64.def @@ -902,13 +902,13 @@ Clist_GroupSaveExpanded @1003 NONAME ?addButton@CMPluginBase@@QEAAPEAXPEBUBBButton@@@Z @1032 NONAME ?SetQuoteEvent@CSrmmBaseDialog@@QEAAXI@Z @1033 NONAME ?onClick_CloseQuote@CSrmmBaseDialog@@IEAAXPEAVCCtrlButton@@@Z @1034 NONAME -?fetch@EventInfo@DB@@QEAA_NI_N@Z @1035 NONAME +?fetch@EventInfo@DB@@QEAA_N_N@Z @1035 NONAME ?unload@EventInfo@DB@@QEAAXXZ @1036 NONAME ?isAlertable@EventInfo@DB@@QEBA_NXZ @1037 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 +?wipeNotify@EventInfo@DB@@QEAAXXZ @1041 NONAME CallContactService @1042 NONAME ??0MDatabaseExport@@QEAA@XZ @1043 NONAME ??1MDatabaseExport@@UEAA@XZ @1044 NONAME diff --git a/src/mir_app/src/srmm_log_rtf.cpp b/src/mir_app/src/srmm_log_rtf.cpp index 709d173c74..0363f90c20 100644 --- a/src/mir_app/src/srmm_log_rtf.cpp +++ b/src/mir_app/src/srmm_log_rtf.cpp @@ -336,11 +336,11 @@ static bool CreateRtfFromDbEvent(RtfLogStreamData *dat) if (!(dbei.flags & DBEF_SENT)) { if (dbei.eventType == EVENTTYPE_MESSAGE || dbei.isSrmm()) - dbei.wipeNotify(dat->hDbEvent); + dbei.wipeNotify(); else if (dbei.eventType == EVENTTYPE_FILE) { DB::FILE_BLOB blob(dbei); if (blob.isOffline()) - dbei.wipeNotify(dat->hDbEvent); + dbei.wipeNotify(); } } else if (dbei.eventType == EVENTTYPE_JABBER_CHATSTATES || dbei.eventType == EVENTTYPE_JABBER_PRESENCE) { -- cgit v1.2.3