summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--include/m_database.h3
-rw-r--r--include/m_srmm_int.h2
-rw-r--r--libs/win32/mir_app.libbin246684 -> 247240 bytes
-rw-r--r--libs/win64/mir_app.libbin243818 -> 244384 bytes
-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
-rw-r--r--src/core/stdmsg/src/msgdialog.cpp10
-rw-r--r--src/core/stdmsg/src/msglog.cpp14
-rw-r--r--src/core/stdmsg/src/msgs.cpp13
-rw-r--r--src/core/stdmsg/src/msgs.h5
-rw-r--r--src/mir_app/src/chat_svc.cpp4
-rw-r--r--src/mir_app/src/db_events.cpp14
-rw-r--r--src/mir_app/src/mir_app.def2
-rw-r--r--src/mir_app/src/mir_app64.def2
32 files changed, 91 insertions, 108 deletions
diff --git a/include/m_database.h b/include/m_database.h
index 28e0d78c17..e927084bed 100644
--- a/include/m_database.h
+++ b/include/m_database.h
@@ -685,6 +685,9 @@ namespace DB
__forceinline operator bool() const { return bValid; }
+ bool isSrmm() const; // could be displayed in a SRMM window
+ bool isHistory() const; // could be displayed in a history window
+
wchar_t* getString(const char *str) const;
};
diff --git a/include/m_srmm_int.h b/include/m_srmm_int.h
index 9e3b8e0c7a..dc1d2303fd 100644
--- a/include/m_srmm_int.h
+++ b/include/m_srmm_int.h
@@ -256,7 +256,7 @@ public:
virtual void AddLog();
virtual void CloseTab() {}
virtual void DrawNickList(USERINFO *ui, DRAWITEMSTRUCT *dis) PURE;
- virtual void EventAdded(MEVENT, const DBEVENTINFO &dbei) PURE;
+ virtual void EventAdded(MEVENT, const DB::EventInfo &dbei) PURE;
virtual bool GetFirstEvent() PURE;
virtual bool IsActive() const PURE;
virtual void LoadSettings() PURE;
diff --git a/libs/win32/mir_app.lib b/libs/win32/mir_app.lib
index 89d18b715f..e3cbf06fe8 100644
--- a/libs/win32/mir_app.lib
+++ b/libs/win32/mir_app.lib
Binary files differ
diff --git a/libs/win64/mir_app.lib b/libs/win64/mir_app.lib
index 67a4e37d53..e81866f711 100644
--- a/libs/win64/mir_app.lib
+++ b/libs/win64/mir_app.lib
Binary files differ
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;
diff --git a/src/core/stdmsg/src/msgdialog.cpp b/src/core/stdmsg/src/msgdialog.cpp
index cfeca501ef..ef28b8fd99 100644
--- a/src/core/stdmsg/src/msgdialog.cpp
+++ b/src/core/stdmsg/src/msgdialog.cpp
@@ -1209,14 +1209,14 @@ void CMsgDialog::DrawNickList(USERINFO *ui, DRAWITEMSTRUCT *dis)
/////////////////////////////////////////////////////////////////////////////////////////
-void CMsgDialog::EventAdded(MEVENT hDbEvent, const DBEVENTINFO &dbei)
+void CMsgDialog::EventAdded(MEVENT hDbEvent, const DB::EventInfo &dbei)
{
if (m_hDbEventFirst == 0)
m_hDbEventFirst = hDbEvent;
bool isMessage = (dbei.eventType == EVENTTYPE_MESSAGE), isSent = ((dbei.flags & DBEF_SENT) != 0);
bool isActive = IsActive();
- if (DbEventIsShown(&dbei)) {
+ if (DbEventIsShown(dbei)) {
// Sounds *only* for sent messages, not for custom events
if (isMessage && !isSent) {
if (isActive)
@@ -1255,10 +1255,10 @@ bool CMsgDialog::GetFirstEvent()
if (hPrevEvent == 0)
break;
- DBEVENTINFO dbei = {};
m_hDbEventFirst = hPrevEvent;
- db_event_get(hPrevEvent, &dbei);
- if (!DbEventIsShown(&dbei))
+
+ DB::EventInfo dbei(hPrevEvent, false);
+ if (!DbEventIsShown(dbei))
i++;
}
break;
diff --git a/src/core/stdmsg/src/msglog.cpp b/src/core/stdmsg/src/msglog.cpp
index d9c7c5f69b..063c990114 100644
--- a/src/core/stdmsg/src/msglog.cpp
+++ b/src/core/stdmsg/src/msglog.cpp
@@ -189,15 +189,9 @@ static void SetToStyle(int style, CMStringA &dest)
dest.AppendFormat("\\f%u\\cf%u\\b%d\\i%d\\fs%u ", style, style, lf.lfWeight >= FW_BOLD ? 1 : 0, lf.lfItalic, 2 * abs(lf.lfHeight) * 74 / logPixelSY);
}
-bool DbEventIsForMsgWindow(const DBEVENTINFO *dbei)
+bool DbEventIsShown(const DB::EventInfo &dbei)
{
- DBEVENTTYPEDESCR *et = DbEvent_GetType(dbei->szModule, dbei->eventType);
- return et && (et->flags & DETF_MSGWINDOW);
-}
-
-bool DbEventIsShown(const DBEVENTINFO *dbei)
-{
- return dbei->eventType == EVENTTYPE_MESSAGE || dbei->eventType == EVENTTYPE_FILE || DbEventIsForMsgWindow(dbei);
+ return dbei.eventType == EVENTTYPE_MESSAGE || dbei.eventType == EVENTTYPE_FILE || dbei.isSrmm();
}
#define RTFPICTHEADERMAXSIZE 78
@@ -288,10 +282,10 @@ public:
if (!dbei)
return false;
- if (!DbEventIsShown(&dbei))
+ if (!DbEventIsShown(dbei))
return false;
- if (!(dbei.flags & DBEF_SENT) && (dbei.eventType == EVENTTYPE_MESSAGE || DbEventIsForMsgWindow(&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/src/core/stdmsg/src/msgs.cpp b/src/core/stdmsg/src/msgs.cpp
index c7303ce01d..c0e216c262 100644
--- a/src/core/stdmsg/src/msgs.cpp
+++ b/src/core/stdmsg/src/msgs.cpp
@@ -70,11 +70,11 @@ 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.flags & (DBEF_SENT | DBEF_READ) || !(dbei.eventType == EVENTTYPE_MESSAGE || DbEventIsForMsgWindow(&dbei)))
+ if (dbei.markedRead() || !DbEventIsShown(dbei))
return 0;
bool bPopup = false;
@@ -265,12 +265,11 @@ static void RestoreUnreadMessageAlerts(void)
for (MEVENT hDbEvent = db_event_firstUnread(hContact); hDbEvent; hDbEvent = db_event_next(hContact, hDbEvent)) {
bool autoPopup = false;
- DBEVENTINFO dbei = {};
- dbei.cbBlob = 0;
- if (db_event_get(hDbEvent, &dbei))
+ DB::EventInfo dbei(hDbEvent, false);
+ if (!dbei)
continue;
- if (!dbei.markedRead() && (dbei.eventType == EVENTTYPE_MESSAGE || DbEventIsForMsgWindow(&dbei))) {
+ if (!dbei.markedRead() && DbEventIsShown(dbei)) {
int windowAlreadyExists = Srmm_FindWindow(hContact) != nullptr;
if (windowAlreadyExists)
continue;
diff --git a/src/core/stdmsg/src/msgs.h b/src/core/stdmsg/src/msgs.h
index 2dc98a0e66..ce79ce26fa 100644
--- a/src/core/stdmsg/src/msgs.h
+++ b/src/core/stdmsg/src/msgs.h
@@ -138,7 +138,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;
bool IsActive() const override;
void LoadSettings() override;
@@ -158,8 +158,7 @@ extern LIST<CMsgDialog> g_arDialogs;
/////////////////////////////////////////////////////////////////////////////////////////
-bool DbEventIsForMsgWindow(const DBEVENTINFO *dbei);
-bool DbEventIsShown(const DBEVENTINFO *dbei);
+bool DbEventIsShown(const DB::EventInfo &dbei);
int SendMessageDirect(const wchar_t *szMsg, MCONTACT hContact);
INT_PTR SendMessageCmd(MCONTACT hContact, wchar_t *msg);
diff --git a/src/mir_app/src/chat_svc.cpp b/src/mir_app/src/chat_svc.cpp
index e1257c5ea2..0e590cdeb3 100644
--- a/src/mir_app/src/chat_svc.cpp
+++ b/src/mir_app/src/chat_svc.cpp
@@ -842,8 +842,8 @@ static int OnEventAdded(WPARAM hContact, LPARAM hDbEvent)
else {
g_clistApi.pfnRemoveEvent(hContact, 1);
- DBEVENTINFO dbei = {};
- if (!db_event_get(hDbEvent, &dbei)) {
+ DB::EventInfo dbei(hDbEvent, false);
+ if (dbei) {
if (auto *pDlg = Srmm_FindDialog(hContact))
pDlg->EventAdded(hDbEvent, dbei);
diff --git a/src/mir_app/src/db_events.cpp b/src/mir_app/src/db_events.cpp
index 29436c5f51..25b7cf0da8 100644
--- a/src/mir_app/src/db_events.cpp
+++ b/src/mir_app/src/db_events.cpp
@@ -273,6 +273,20 @@ DB::EventInfo::~EventInfo()
mir_free(pBlob);
}
+// could be displayed in a SRMM window
+bool DB::EventInfo::isSrmm() const
+{
+ auto *et = DbEvent_GetType(szModule, eventType);
+ return et && et->flags & DETF_MSGWINDOW;
+}
+
+// could be displayed in a history window
+bool DB::EventInfo::isHistory() const
+{
+ auto *et = DbEvent_GetType(szModule, eventType);
+ return et && et->flags & DETF_HISTORY;
+}
+
wchar_t* DB::EventInfo::getString(const char *str) const
{
if (flags & DBEF_UTF)
diff --git a/src/mir_app/src/mir_app.def b/src/mir_app/src/mir_app.def
index 021694711d..6086dfd503 100644
--- a/src/mir_app/src/mir_app.def
+++ b/src/mir_app/src/mir_app.def
@@ -851,3 +851,5 @@ Chat_IsMuted @941 NONAME
?getString@EventInfo@DB@@QBEPA_WPBD@Z @967 NONAME
?InsertFileLink@CRtfLogWindow@@IAEXAAV?$CMStringT@DV?$ChTraitsCRT@D@@@@IABVFILE_BLOB@DB@@@Z @968 NONAME
?GetDialog@CSrmmLogWindow@@QBEAAVCMsgDialog@@XZ @969 NONAME
+?isHistory@EventInfo@DB@@QBE_NXZ @970 NONAME
+?isSrmm@EventInfo@DB@@QBE_NXZ @971 NONAME
diff --git a/src/mir_app/src/mir_app64.def b/src/mir_app/src/mir_app64.def
index b888eb1a3b..678dd85842 100644
--- a/src/mir_app/src/mir_app64.def
+++ b/src/mir_app/src/mir_app64.def
@@ -851,3 +851,5 @@ Chat_IsMuted @941 NONAME
?getString@EventInfo@DB@@QEBAPEA_WPEBD@Z @967 NONAME
?InsertFileLink@CRtfLogWindow@@IEAAXAEAV?$CMStringT@DV?$ChTraitsCRT@D@@@@IAEBVFILE_BLOB@DB@@@Z @968 NONAME
?GetDialog@CSrmmLogWindow@@QEBAAEAVCMsgDialog@@XZ @969 NONAME
+?isHistory@EventInfo@DB@@QEBA_NXZ @970 NONAME
+?isSrmm@EventInfo@DB@@QEBA_NXZ @971 NONAME