summaryrefslogtreecommitdiff
path: root/plugins
diff options
context:
space:
mode:
authorGeorge Hazan <ghazan@miranda.im>2023-04-14 18:48:50 +0300
committerGeorge Hazan <ghazan@miranda.im>2023-04-14 18:48:50 +0300
commit357bb36c10405e7571f9ebd41d8e11837ebd6175 (patch)
treea1cd0dabe39ce913f7bf3356e47fc1d18363940e /plugins
parentf12d6a4000cfce521392200635d1cadc63dba934 (diff)
duplicate code removed
Diffstat (limited to 'plugins')
-rw-r--r--plugins/IEView/src/HTMLBuilder.cpp4
-rw-r--r--plugins/IEView/src/HTMLBuilder.h4
-rw-r--r--plugins/IEView/src/HistoryHTMLBuilder.cpp7
-rw-r--r--plugins/IEView/src/HistoryHTMLBuilder.h2
-rw-r--r--plugins/IEView/src/ScriverHTMLBuilder.cpp6
-rw-r--r--plugins/IEView/src/ScriverHTMLBuilder.h2
-rw-r--r--plugins/IEView/src/TabSRMMHTMLBuilder.cpp8
-rw-r--r--plugins/IEView/src/TabSRMMHTMLBuilder.h4
-rw-r--r--plugins/IEView/src/Utils.cpp12
-rw-r--r--plugins/IEView/src/Utils.h4
-rw-r--r--plugins/Scriver/src/msgdialog.cpp3
-rw-r--r--plugins/Scriver/src/msglog.cpp16
-rw-r--r--plugins/Scriver/src/msgs.cpp8
-rw-r--r--plugins/Scriver/src/msgs.h7
-rw-r--r--plugins/Scriver/src/msgutils.cpp9
-rw-r--r--plugins/TabSRMM/src/functions.h3
-rw-r--r--plugins/TabSRMM/src/mim.cpp5
-rw-r--r--plugins/TabSRMM/src/msgdlgother.cpp8
-rw-r--r--plugins/TabSRMM/src/msglog.cpp16
-rw-r--r--plugins/TabSRMM/src/msgs.h2
20 files changed, 50 insertions, 80 deletions
diff --git a/plugins/IEView/src/HTMLBuilder.cpp b/plugins/IEView/src/HTMLBuilder.cpp
index 2711b7da90..a314bbdce4 100644
--- a/plugins/IEView/src/HTMLBuilder.cpp
+++ b/plugins/IEView/src/HTMLBuilder.cpp
@@ -209,7 +209,7 @@ void HTMLBuilder::appendEventOld(IEView *view, IEVIEWEVENT *event)
g_clistApi.pfnRemoveEvent(event->hContact, hDbEvent);
}
- if (!isDbEventShown(&dbei)) {
+ if (!isDbEventShown(dbei)) {
hDbEvent = db_event_next(event->hContact, hDbEvent);
continue;
}
@@ -230,7 +230,7 @@ void HTMLBuilder::appendEventOld(IEView *view, IEVIEWEVENT *event)
eventData->szNick.w = getContactName(event->hContact, szProto);
eventData->bIsMe = FALSE;
}
- if (dbei.eventType == EVENTTYPE_MESSAGE || Utils::DbEventIsForMsgWindow(&dbei)) {
+ if (dbei.eventType == EVENTTYPE_MESSAGE || dbei.isSrmm()) {
eventData->szText.w = DbEvent_GetTextW(&dbei, newEvent.codepage);
if (dbei.eventType == EVENTTYPE_MESSAGE)
eventData->iType = IEED_EVENT_MESSAGE;
diff --git a/plugins/IEView/src/HTMLBuilder.h b/plugins/IEView/src/HTMLBuilder.h
index e1ebaa66d4..08d152d12b 100644
--- a/plugins/IEView/src/HTMLBuilder.h
+++ b/plugins/IEView/src/HTMLBuilder.h
@@ -62,14 +62,14 @@ protected:
virtual char* getEncodedContactName(MCONTACT hContact, const char *szProto);
virtual void getUINs(MCONTACT hContact, char *&uinIn, char *&uinOut);
- virtual uint32_t getLastEventTime();
+ virtual uint32_t getLastEventTime();
virtual void setLastEventTime(uint32_t);
virtual int getLastEventType();
virtual void setLastEventType(int);
virtual bool isSameDate(time_t time1, time_t time2);
- virtual bool isDbEventShown(DBEVENTINFO * dbei) = 0;
+ virtual bool isDbEventShown(const DB::EventInfo &dbei) = 0;
virtual ProtocolSettings *getSRMMProtocolSettings(MCONTACT hContact);
virtual ProtocolSettings *getHistoryProtocolSettings(MCONTACT hContact);
diff --git a/plugins/IEView/src/HistoryHTMLBuilder.cpp b/plugins/IEView/src/HistoryHTMLBuilder.cpp
index 25014d36bb..66f17dad13 100644
--- a/plugins/IEView/src/HistoryHTMLBuilder.cpp
+++ b/plugins/IEView/src/HistoryHTMLBuilder.cpp
@@ -69,14 +69,15 @@ HistoryHTMLBuilder::HistoryHTMLBuilder()
startedTime = time(0);
}
-bool HistoryHTMLBuilder::isDbEventShown(DBEVENTINFO *dbei)
+bool HistoryHTMLBuilder::isDbEventShown(const DB::EventInfo &dbei)
{
- switch (dbei->eventType) {
+ switch (dbei.eventType) {
case EVENTTYPE_MESSAGE:
case EVENTTYPE_FILE:
return 1;
+
default:
- return Utils::DbEventIsForHistory(dbei);
+ return dbei.isHistory();
}
}
diff --git a/plugins/IEView/src/HistoryHTMLBuilder.h b/plugins/IEView/src/HistoryHTMLBuilder.h
index f5023d7884..83b3f0e4b7 100644
--- a/plugins/IEView/src/HistoryHTMLBuilder.h
+++ b/plugins/IEView/src/HistoryHTMLBuilder.h
@@ -30,7 +30,7 @@ class HistoryHTMLBuilder :public TemplateHTMLBuilder
protected:
void loadMsgDlgFont(const char *, LOGFONTA *lf, COLORREF *colour, COLORREF *bkgColour);
char *timestampToString(time_t check);
- bool isDbEventShown(DBEVENTINFO *dbei);
+ bool isDbEventShown(const DB::EventInfo &dbei);
void appendEventNonTemplate(IEView *, IEVIEWEVENT *event);
const char *getTemplateFilename(ProtocolSettings *);
int getFlags(ProtocolSettings *);
diff --git a/plugins/IEView/src/ScriverHTMLBuilder.cpp b/plugins/IEView/src/ScriverHTMLBuilder.cpp
index 19c3e85fae..76e8487fc1 100644
--- a/plugins/IEView/src/ScriverHTMLBuilder.cpp
+++ b/plugins/IEView/src/ScriverHTMLBuilder.cpp
@@ -68,15 +68,15 @@ ScriverHTMLBuilder::ScriverHTMLBuilder()
startedTime = time(0);
}
-bool ScriverHTMLBuilder::isDbEventShown(DBEVENTINFO *dbei)
+bool ScriverHTMLBuilder::isDbEventShown(const DB::EventInfo &dbei)
{
- switch (dbei->eventType) {
+ switch (dbei.eventType) {
case EVENTTYPE_MESSAGE:
return 1;
case EVENTTYPE_FILE:
return 1;
default:
- return Utils::DbEventIsForMsgWindow(dbei);
+ return dbei.isSrmm();
}
}
diff --git a/plugins/IEView/src/ScriverHTMLBuilder.h b/plugins/IEView/src/ScriverHTMLBuilder.h
index 5b9d7170d0..45f138effb 100644
--- a/plugins/IEView/src/ScriverHTMLBuilder.h
+++ b/plugins/IEView/src/ScriverHTMLBuilder.h
@@ -30,7 +30,7 @@ class ScriverHTMLBuilder :public TemplateHTMLBuilder
protected:
void loadMsgDlgFont(int i, LOGFONTA * lf, COLORREF * colour);
char *timestampToString(uint32_t dwFlags, time_t check, int groupStart);
- bool isDbEventShown(DBEVENTINFO * dbei);
+ bool isDbEventShown(const DB::EventInfo &dbei);
void appendEventNonTemplate(IEView *, IEVIEWEVENT *event);
public:
ScriverHTMLBuilder();
diff --git a/plugins/IEView/src/TabSRMMHTMLBuilder.cpp b/plugins/IEView/src/TabSRMMHTMLBuilder.cpp
index 85e6b8859e..a731831527 100644
--- a/plugins/IEView/src/TabSRMMHTMLBuilder.cpp
+++ b/plugins/IEView/src/TabSRMMHTMLBuilder.cpp
@@ -82,9 +82,9 @@ TabSRMMHTMLBuilder::TabSRMMHTMLBuilder()
startedTime = time(0);
}
-bool TabSRMMHTMLBuilder::isDbEventShown(uint32_t dwFlags, DBEVENTINFO *dbei)
+bool TabSRMMHTMLBuilder::isDbEventShown(uint32_t dwFlags, const DB::EventInfo &dbei)
{
- switch (dbei->eventType) {
+ switch (dbei.eventType) {
case EVENTTYPE_MESSAGE:
return 1;
case EVENTTYPE_FILE:
@@ -96,12 +96,12 @@ bool TabSRMMHTMLBuilder::isDbEventShown(uint32_t dwFlags, DBEVENTINFO *dbei)
case EVENTTYPE_AUTHREQUEST:
return 0;
default:
- return Utils::DbEventIsForMsgWindow(dbei);
+ return dbei.isSrmm();
}
return 1;
}
-bool TabSRMMHTMLBuilder::isDbEventShown(DBEVENTINFO * dbei)
+bool TabSRMMHTMLBuilder::isDbEventShown(const DB::EventInfo &dbei)
{
uint32_t dwFlags2 = db_get_b(0, SRMSGMOD_T, SRMSGSET_SHOWURLS, 0) ? MWF_SHOW_URLEVENTS : 0;
dwFlags2 |= db_get_b(0, SRMSGMOD_T, SRMSGSET_SHOWFILES, 0) ? MWF_SHOW_FILEEVENTS : 0;
diff --git a/plugins/IEView/src/TabSRMMHTMLBuilder.h b/plugins/IEView/src/TabSRMMHTMLBuilder.h
index bfc7deb6ac..e2ffeed6f4 100644
--- a/plugins/IEView/src/TabSRMMHTMLBuilder.h
+++ b/plugins/IEView/src/TabSRMMHTMLBuilder.h
@@ -31,8 +31,8 @@ protected:
virtual void loadMsgDlgFont(int i, LOGFONTA * lf, COLORREF * colour);
char *timestampToString(uint32_t dwFlags, time_t check, int isGroupBreak);
time_t getStartedTime();
- virtual bool isDbEventShown(uint32_t dwFlags, DBEVENTINFO * dbei);
- bool isDbEventShown(DBEVENTINFO * dbei);
+ virtual bool isDbEventShown(uint32_t dwFlags, const DB::EventInfo &dbei);
+ bool isDbEventShown(const DB::EventInfo &dbei);
void appendEventNonTemplate(IEView *, IEVIEWEVENT *event);
public:
TabSRMMHTMLBuilder();
diff --git a/plugins/IEView/src/Utils.cpp b/plugins/IEView/src/Utils.cpp
index c29b4b3b21..ce3ebee636 100644
--- a/plugins/IEView/src/Utils.cpp
+++ b/plugins/IEView/src/Utils.cpp
@@ -115,15 +115,3 @@ void Utils::appendIcon(CMStringA &str, const char *iconFile)
{
str.AppendFormat("<img class=\"img\" src=\"file://%s/plugins/ieview/%s\"/> ", workingDirUtf8, iconFile);
}
-
-bool Utils::DbEventIsForMsgWindow(DBEVENTINFO *dbei)
-{
- DBEVENTTYPEDESCR *et = DbEvent_GetType(dbei->szModule, dbei->eventType);
- return et && (et->flags & DETF_MSGWINDOW);
-}
-
-bool Utils::DbEventIsForHistory(DBEVENTINFO *dbei)
-{
- DBEVENTTYPEDESCR *et = DbEvent_GetType(dbei->szModule, dbei->eventType);
- return et && (et->flags & DETF_HISTORY);
-}
diff --git a/plugins/IEView/src/Utils.h b/plugins/IEView/src/Utils.h
index 031e400bf4..173b451fc1 100644
--- a/plugins/IEView/src/Utils.h
+++ b/plugins/IEView/src/Utils.h
@@ -30,9 +30,7 @@ namespace Utils
void convertPath(char *path);
void convertPath(wchar_t *path);
char *escapeString(const char *a);
- int detectURL(const wchar_t *text);
- bool DbEventIsForMsgWindow(DBEVENTINFO *dbei);
- bool DbEventIsForHistory(DBEVENTINFO *dbei);
+ int detectURL(const wchar_t *text);
};
#endif
diff --git a/plugins/Scriver/src/msgdialog.cpp b/plugins/Scriver/src/msgdialog.cpp
index 4112c792de..1eab95ef1a 100644
--- a/plugins/Scriver/src/msgdialog.cpp
+++ b/plugins/Scriver/src/msgdialog.cpp
@@ -1071,8 +1071,7 @@ INT_PTR CMsgDialog::DlgProc(UINT msg, WPARAM wParam, LPARAM lParam)
MEVENT hDbEvent = m_hDbUnreadEventFirst;
m_hDbUnreadEventFirst = 0;
while (hDbEvent != 0) {
- DBEVENTINFO dbei = {};
- db_event_get(hDbEvent, &dbei);
+ DB::EventInfo dbei(hDbEvent, false);
if (!(dbei.flags & DBEF_SENT) && DbEventIsMessageOrCustom(dbei))
g_clistApi.pfnRemoveEvent(m_hContact, hDbEvent);
hDbEvent = db_event_next(m_hContact, hDbEvent);
diff --git a/plugins/Scriver/src/msglog.cpp b/plugins/Scriver/src/msglog.cpp
index 0359c1cdf7..891edbcbeb 100644
--- a/plugins/Scriver/src/msglog.cpp
+++ b/plugins/Scriver/src/msglog.cpp
@@ -52,18 +52,12 @@ struct LogStreamData
static DWORD CALLBACK LogStreamInEvents(DWORD_PTR dwCookie, LPBYTE pbBuff, LONG cb, LONG *pcb);
-bool DbEventIsCustomForMsgWindow(const DBEVENTINFO &dbei)
+bool DbEventIsMessageOrCustom(const DB::EventInfo &dbei)
{
- DBEVENTTYPEDESCR *et = DbEvent_GetType(dbei.szModule, dbei.eventType);
- return et && (et->flags & DETF_MSGWINDOW);
+ return dbei.eventType == EVENTTYPE_MESSAGE || dbei.eventType == EVENTTYPE_FILE || dbei.isSrmm();
}
-bool DbEventIsMessageOrCustom(const DBEVENTINFO &dbei)
-{
- return dbei.eventType == EVENTTYPE_MESSAGE || dbei.eventType == EVENTTYPE_FILE || DbEventIsCustomForMsgWindow(dbei);
-}
-
-bool DbEventIsShown(const DBEVENTINFO &dbei)
+bool DbEventIsShown(const DB::EventInfo &dbei)
{
switch (dbei.eventType) {
case EVENTTYPE_MESSAGE:
@@ -75,7 +69,7 @@ bool DbEventIsShown(const DBEVENTINFO &dbei)
return 0;
}
- return DbEventIsCustomForMsgWindow(dbei);
+ return dbei.isSrmm();
}
static void AppendUnicodeToBuffer(CMStringA &buf, const wchar_t *line)
@@ -861,7 +855,7 @@ static DWORD CALLBACK LogStreamInEvents(DWORD_PTR dwCookie, LPBYTE pbBuff, LONG
if (dbei && DbEventIsShown(dbei)) {
dat->buffer = dat->pLog->CreateRTFFromEvent(dbei, dat);
- if (!(dbei.flags & DBEF_SENT) && (dbei.eventType == EVENTTYPE_MESSAGE || DbEventIsCustomForMsgWindow(dbei))) {
+ if (!(dbei.flags & DBEF_SENT) && (dbei.eventType == EVENTTYPE_MESSAGE || dbei.isSrmm())) {
db_event_markRead(dat->hContact, dat->hDbEvent);
g_clistApi.pfnRemoveEvent(dat->hContact, dat->hDbEvent);
}
diff --git a/plugins/Scriver/src/msgs.cpp b/plugins/Scriver/src/msgs.cpp
index b3e0026f77..0bbd71f0c7 100644
--- a/plugins/Scriver/src/msgs.cpp
+++ b/plugins/Scriver/src/msgs.cpp
@@ -84,8 +84,8 @@ static int MessageEventAdded(WPARAM hContact, LPARAM hDbEvent)
if (hContact == 0 || Contact::IsGroupChat(hContact))
return 0;
- DBEVENTINFO dbei = {};
- if (db_event_get(hDbEvent, &dbei))
+ DB::EventInfo dbei(hDbEvent, false);
+ if (!dbei)
return 0;
if (dbei.eventType == EVENTTYPE_MESSAGE && (dbei.flags & DBEF_READ))
@@ -236,8 +236,8 @@ static void RestoreUnreadMessageAlerts(void)
for (auto &hContact : Contacts()) {
for (MEVENT hDbEvent = db_event_firstUnread(hContact); hDbEvent; hDbEvent = db_event_next(hContact, hDbEvent)) {
- DBEVENTINFO dbei = {};
- if (db_event_get(hDbEvent, &dbei))
+ DB::EventInfo dbei(hDbEvent, false);
+ if (!dbei)
continue;
if (dbei.markedRead() || !DbEventIsMessageOrCustom(dbei) || !Proto_GetBaseAccountName(hContact))
continue;
diff --git a/plugins/Scriver/src/msgs.h b/plugins/Scriver/src/msgs.h
index ce0e5c082c..36b036f77c 100644
--- a/plugins/Scriver/src/msgs.h
+++ b/plugins/Scriver/src/msgs.h
@@ -131,7 +131,7 @@ public:
void CloseTab() override;
void DrawNickList(USERINFO *ui, DRAWITEMSTRUCT *dis) override;
- void EventAdded(MEVENT, const DBEVENTINFO &dbei) override;
+ void EventAdded(MEVENT, const DB::EventInfo &dbei) override;
bool GetFirstEvent() override;
void LoadSettings() override;
void SetStatusText(const wchar_t *, HICON) override;
@@ -192,9 +192,8 @@ public:
#define EVENTTYPE_JABBER_CHATSTATES 2000
#define EVENTTYPE_JABBER_PRESENCE 2001
-bool DbEventIsShown(const DBEVENTINFO &dbei);
-bool DbEventIsCustomForMsgWindow(const DBEVENTINFO &dbei);
-bool DbEventIsMessageOrCustom(const DBEVENTINFO &dbei);
+bool DbEventIsShown(const DB::EventInfo &dbei);
+bool DbEventIsMessageOrCustom(const DB::EventInfo &dbei);
void LoadMsgLogIcons(void);
void FreeMsgLogIcons(void);
int IsAutoPopup(MCONTACT hContact);
diff --git a/plugins/Scriver/src/msgutils.cpp b/plugins/Scriver/src/msgutils.cpp
index b2abbe2a55..c0ed8bca78 100644
--- a/plugins/Scriver/src/msgutils.cpp
+++ b/plugins/Scriver/src/msgutils.cpp
@@ -73,7 +73,7 @@ void CMsgDialog::DrawNickList(USERINFO *ui, DRAWITEMSTRUCT *dis)
SelectObject(dis->hDC, hOldFont);
}
-void CMsgDialog::EventAdded(MEVENT hDbEvent, const DBEVENTINFO &dbei)
+void CMsgDialog::EventAdded(MEVENT hDbEvent, const DB::EventInfo &dbei)
{
if (m_hDbEventFirst == 0)
m_hDbEventFirst = hDbEvent;
@@ -101,7 +101,7 @@ void CMsgDialog::EventAdded(MEVENT hDbEvent, const DBEVENTINFO &dbei)
else
SendMessage(m_hwnd, DM_REMAKELOG, 0, 0);
- if (!(dbei.flags & DBEF_SENT) && !DbEventIsCustomForMsgWindow(dbei)) {
+ if (!(dbei.flags & DBEF_SENT) && !dbei.isSrmm()) {
if (!bIsActive) {
m_iShowUnread = 1;
UpdateIcon();
@@ -121,15 +121,14 @@ bool CMsgDialog::GetFirstEvent()
// This finds the first message to display, it works like shit
m_hDbEventFirst = db_event_firstUnread(m_hContact);
if (m_hDbEventFirst != 0) {
- DBEVENTINFO dbei = {};
- db_event_get(m_hDbEventFirst, &dbei);
+ DB::EventInfo dbei(m_hDbEventFirst, false);
if (DbEventIsMessageOrCustom(dbei) && !(dbei.flags & DBEF_READ) && !(dbei.flags & DBEF_SENT))
notifyUnread = true;
}
DB::ECPTR pCursor(DB::EventsRev(m_hContact, m_hDbEventFirst));
- DBEVENTINFO dbei = {};
+ DB::EventInfo dbei;
MEVENT hPrevEvent;
switch (historyMode) {
case LOADHISTORY_COUNT:
diff --git a/plugins/TabSRMM/src/functions.h b/plugins/TabSRMM/src/functions.h
index e7311632d2..08178c67c1 100644
--- a/plugins/TabSRMM/src/functions.h
+++ b/plugins/TabSRMM/src/functions.h
@@ -84,8 +84,7 @@ void TSAPI CacheMsgLogIcons();
void TSAPI CacheLogFonts();
void TSAPI LoadIconTheme();
-bool DbEventIsForMsgWindow(const DBEVENTINFO *dbei);
-bool DbEventIsShown(const DBEVENTINFO *dbei);
+bool DbEventIsShown(const DB::EventInfo &dbei);
// custom tab control
diff --git a/plugins/TabSRMM/src/mim.cpp b/plugins/TabSRMM/src/mim.cpp
index 434472f9b3..07ad8f5f68 100644
--- a/plugins/TabSRMM/src/mim.cpp
+++ b/plugins/TabSRMM/src/mim.cpp
@@ -373,15 +373,14 @@ int CMimAPI::MessageEventAdded(WPARAM hContact, LPARAM hDbEvent)
if (hContact == 0 || Contact::IsGroupChat(hContact))
return 0;
- DBEVENTINFO dbei = {};
- db_event_get(hDbEvent, &dbei);
+ DB::EventInfo dbei(hDbEvent, false);
auto *pDlg = Srmm_FindDialog(hContact);
if (pDlg == nullptr)
pDlg = Srmm_FindDialog(db_event_getContact(hDbEvent));
BOOL isCustomEvent = IsCustomEvent(dbei.eventType);
- bool isShownCustomEvent = DbEventIsForMsgWindow(&dbei);
+ bool isShownCustomEvent = dbei.isSrmm();
if (dbei.markedRead() || (isCustomEvent && !isShownCustomEvent))
return 0;
diff --git a/plugins/TabSRMM/src/msgdlgother.cpp b/plugins/TabSRMM/src/msgdlgother.cpp
index abf577fd40..2360894d31 100644
--- a/plugins/TabSRMM/src/msgdlgother.cpp
+++ b/plugins/TabSRMM/src/msgdlgother.cpp
@@ -538,7 +538,7 @@ void CMsgDialog::EnableSending(bool bMode) const
/////////////////////////////////////////////////////////////////////////////////////////
-void CMsgDialog::EventAdded(MEVENT hDbEvent, const DBEVENTINFO &dbei)
+void CMsgDialog::EventAdded(MEVENT hDbEvent, const DB::EventInfo &dbei)
{
if (m_hDbEventFirst == 0)
m_hDbEventFirst = hDbEvent;
@@ -546,7 +546,7 @@ void CMsgDialog::EventAdded(MEVENT hDbEvent, const DBEVENTINFO &dbei)
bool bIsStatusChangeEvent = IsStatusEvent(dbei.eventType);
bool bDisableNotify = (dbei.eventType == EVENTTYPE_MESSAGE && (dbei.flags & DBEF_READ));
- if (!DbEventIsShown(&dbei))
+ if (!DbEventIsShown(dbei))
return;
if (dbei.eventType == EVENTTYPE_MESSAGE && !(dbei.flags & (DBEF_SENT))) {
@@ -655,7 +655,7 @@ bool CMsgDialog::GetFirstEvent()
if (m_bActualHistory)
historyMode = LOADHISTORY_COUNT;
- DBEVENTINFO dbei = {};
+ DB::EventInfo dbei;
DB::ECPTR pCursor(DB::EventsRev(m_hContact, m_hDbEventFirst));
switch (historyMode) {
@@ -676,7 +676,7 @@ bool CMsgDialog::GetFirstEvent()
dbei.cbBlob = 0;
m_hDbEventFirst = hPrevEvent;
db_event_get(m_hDbEventFirst, &dbei);
- if (!DbEventIsShown(&dbei))
+ if (!DbEventIsShown(dbei))
i++;
}
break;
diff --git a/plugins/TabSRMM/src/msglog.cpp b/plugins/TabSRMM/src/msglog.cpp
index 36c76a92ad..ca45b886fb 100644
--- a/plugins/TabSRMM/src/msglog.cpp
+++ b/plugins/TabSRMM/src/msglog.cpp
@@ -405,18 +405,12 @@ static char *CreateRTFTail()
return mir_strdup("}");
}
-bool DbEventIsShown(const DBEVENTINFO *dbei)
+bool DbEventIsShown(const DB::EventInfo &dbei)
{
- if (!IsCustomEvent(dbei->eventType) || DbEventIsForMsgWindow(dbei))
+ if (!IsCustomEvent(dbei.eventType) || dbei.isSrmm())
return 1;
- return IsStatusEvent(dbei->eventType);
-}
-
-bool DbEventIsForMsgWindow(const DBEVENTINFO *dbei)
-{
- DBEVENTTYPEDESCR *et = DbEvent_GetType(dbei->szModule, dbei->eventType);
- return et && (et->flags & DETF_MSGWINDOW);
+ return IsStatusEvent(dbei.eventType);
}
static DWORD CALLBACK LogStreamInEvents(DWORD_PTR dwCookie, LPBYTE pbBuff, LONG cb, LONG *pcb)
@@ -637,7 +631,7 @@ char* CLogWindow::CreateRTFFromDbEvent(LogStreamData *streamData)
else {
dbei.cbBlob = -1;
db_event_get(streamData->hDbEvent, &dbei);
- if (!DbEventIsShown(&dbei))
+ if (!DbEventIsShown(dbei))
return nullptr;
}
@@ -647,7 +641,7 @@ char* CLogWindow::CreateRTFFromDbEvent(LogStreamData *streamData)
BOOL isSent = (dbei.flags & DBEF_SENT);
BOOL bIsStatusChangeEvent = IsStatusEvent(dbei.eventType);
- if (!isSent && (bIsStatusChangeEvent || dbei.eventType == EVENTTYPE_MESSAGE || DbEventIsForMsgWindow(&dbei))) {
+ if (!isSent && (bIsStatusChangeEvent || dbei.eventType == EVENTTYPE_MESSAGE || dbei.isSrmm())) {
db_event_markRead(streamData->hContact, streamData->hDbEvent);
g_clistApi.pfnRemoveEvent(streamData->hContact, streamData->hDbEvent);
}
diff --git a/plugins/TabSRMM/src/msgs.h b/plugins/TabSRMM/src/msgs.h
index d3bdec4c3d..ba0af19cfd 100644
--- a/plugins/TabSRMM/src/msgs.h
+++ b/plugins/TabSRMM/src/msgs.h
@@ -596,7 +596,7 @@ public:
void AddLog() override;
void CloseTab() override;
void DrawNickList(USERINFO *ui, DRAWITEMSTRUCT *dis) override;
- void EventAdded(MEVENT, const DBEVENTINFO &dbei) override;
+ void EventAdded(MEVENT, const DB::EventInfo &dbei) override;
bool GetFirstEvent() override;
bool IsActive() const override;
void LoadSettings() override;