summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGeorge Hazan <george.hazan@gmail.com>2024-03-24 15:22:00 +0300
committerGeorge Hazan <george.hazan@gmail.com>2024-03-24 15:22:00 +0300
commit9774715b1914ac65ada1211322bfd080af694af9 (patch)
tree639b14e2201ffa0ebe5c514114ca30f23d1f8c70
parentb873a2605a28bbf43e9cc6679562cf6bbabad601 (diff)
code cleaning
-rw-r--r--plugins/IEView/src/HTMLBuilder.cpp11
-rw-r--r--plugins/IEView/src/ScriverHTMLBuilder.cpp9
-rw-r--r--plugins/Scriver/src/msgdialog.cpp4
-rw-r--r--plugins/Scriver/src/msglog.cpp9
-rw-r--r--plugins/Scriver/src/msgs.cpp4
-rw-r--r--plugins/Scriver/src/msgs.h1
-rw-r--r--plugins/Scriver/src/msgutils.cpp2
-rw-r--r--src/core/stdmsg/src/msglog.cpp2
-rw-r--r--src/core/stdmsg/src/stdafx.h3
-rw-r--r--src/mir_app/src/chat_log.cpp2
-rw-r--r--src/mir_app/src/srmm_log_rtf.cpp2
11 files changed, 16 insertions, 33 deletions
diff --git a/plugins/IEView/src/HTMLBuilder.cpp b/plugins/IEView/src/HTMLBuilder.cpp
index c561a94f74..6ea13100b7 100644
--- a/plugins/IEView/src/HTMLBuilder.cpp
+++ b/plugins/IEView/src/HTMLBuilder.cpp
@@ -228,17 +228,18 @@ void HTMLBuilder::appendEventOld(IEView *view, IEVIEWEVENT *event)
eventData->szNick.w = getContactName(event->hContact, szProto);
eventData->bIsMe = FALSE;
}
- if (dbei.eventType == EVENTTYPE_MESSAGE || dbei.isSrmm()) {
+
+ if (dbei.eventType == EVENTTYPE_FILE) {
+ eventData->szText.w = DbEvent_GetTextW(&dbei);
+ eventData->iType = IEED_EVENT_FILE;
+ }
+ else if (dbei.isSrmm()) {
eventData->szText.w = DbEvent_GetTextW(&dbei);
if (dbei.eventType == EVENTTYPE_MESSAGE)
eventData->iType = IEED_EVENT_MESSAGE;
else
eventData->iType = IEED_EVENT_STATUSCHANGE;
}
- else if (dbei.eventType == EVENTTYPE_FILE) {
- eventData->szText.w = DbEvent_GetTextW(&dbei);
- eventData->iType = IEED_EVENT_FILE;
- }
else if (dbei.eventType == EVENTTYPE_AUTHREQUEST) {
// blob is: uin(uint32_t), hContact(uint32_t), nick(ASCIIZ), first(ASCIIZ), last(ASCIIZ), email(ASCIIZ)
eventData->szText.w = mir_wstrdup(TranslateT(" requested authorization"));
diff --git a/plugins/IEView/src/ScriverHTMLBuilder.cpp b/plugins/IEView/src/ScriverHTMLBuilder.cpp
index d0fc1d3d3e..51f0c6fa6a 100644
--- a/plugins/IEView/src/ScriverHTMLBuilder.cpp
+++ b/plugins/IEView/src/ScriverHTMLBuilder.cpp
@@ -70,14 +70,7 @@ ScriverHTMLBuilder::ScriverHTMLBuilder()
bool ScriverHTMLBuilder::isDbEventShown(const DB::EventInfo &dbei)
{
- switch (dbei.eventType) {
- case EVENTTYPE_MESSAGE:
- return 1;
- case EVENTTYPE_FILE:
- return 1;
- default:
- return dbei.isSrmm();
- }
+ return dbei.isSrmm();
}
void ScriverHTMLBuilder::loadMsgDlgFont(int i, LOGFONTA *lf, COLORREF *colour)
diff --git a/plugins/Scriver/src/msgdialog.cpp b/plugins/Scriver/src/msgdialog.cpp
index 55e47e594d..426ff11eab 100644
--- a/plugins/Scriver/src/msgdialog.cpp
+++ b/plugins/Scriver/src/msgdialog.cpp
@@ -381,7 +381,7 @@ void CMsgDialog::onClick_Quote(CCtrlButton*)
if (!dbei)
return;
- if (DbEventIsMessageOrCustom(dbei)) {
+ if (dbei.isSrmm()) {
ptrW wszText(DbEvent_GetTextW(&dbei));
SetMessageText(Srmm_Quote(wszText));
}
@@ -910,7 +910,7 @@ INT_PTR CMsgDialog::DlgProc(UINT msg, WPARAM wParam, LPARAM lParam)
m_hDbUnreadEventFirst = 0;
while (hDbEvent != 0) {
DB::EventInfo dbei(hDbEvent, false);
- if (!(dbei.flags & DBEF_SENT) && DbEventIsMessageOrCustom(dbei))
+ if (!(dbei.flags & DBEF_SENT) && dbei.isSrmm())
Clist_RemoveEvent(-1, hDbEvent);
hDbEvent = db_event_next(m_hContact, hDbEvent);
}
diff --git a/plugins/Scriver/src/msglog.cpp b/plugins/Scriver/src/msglog.cpp
index cf68b2a7cc..f5566ea31c 100644
--- a/plugins/Scriver/src/msglog.cpp
+++ b/plugins/Scriver/src/msglog.cpp
@@ -39,18 +39,9 @@ struct RtfLogStreamData : public RtfLogStreamBase
GlobalMessageData *gdat;
};
-bool DbEventIsMessageOrCustom(const DB::EventInfo &dbei)
-{
- return dbei.eventType == EVENTTYPE_MESSAGE || dbei.eventType == EVENTTYPE_FILE || dbei.isSrmm();
-}
-
bool DbEventIsShown(const DB::EventInfo &dbei)
{
switch (dbei.eventType) {
- case EVENTTYPE_MESSAGE:
- case EVENTTYPE_FILE:
- return 1;
-
case EVENTTYPE_JABBER_CHATSTATES:
case EVENTTYPE_JABBER_PRESENCE:
return 0;
diff --git a/plugins/Scriver/src/msgs.cpp b/plugins/Scriver/src/msgs.cpp
index 1ed017280d..799dc68cec 100644
--- a/plugins/Scriver/src/msgs.cpp
+++ b/plugins/Scriver/src/msgs.cpp
@@ -124,7 +124,7 @@ static int MessageEventAdded(WPARAM hContact, LPARAM hDbEvent)
if (dbei.eventType == EVENTTYPE_MESSAGE && (dbei.flags & DBEF_READ))
return 0;
- if (dbei.flags & DBEF_SENT || !DbEventIsMessageOrCustom(dbei))
+ if (dbei.flags & DBEF_SENT || !dbei.isSrmm())
return 0;
Utils_InvokeAsync(new CAutoPpopup(hContact, hDbEvent));
@@ -256,7 +256,7 @@ static void RestoreUnreadMessageAlerts(void)
DB::EventInfo dbei(hDbEvent, false);
if (!dbei)
continue;
- if (dbei.markedRead() || !DbEventIsMessageOrCustom(dbei) || !Proto_GetBaseAccountName(hContact))
+ if (dbei.markedRead() || !dbei.isSrmm() || !Proto_GetBaseAccountName(hContact))
continue;
int windowAlreadyExists = Srmm_FindWindow(hContact) != nullptr;
diff --git a/plugins/Scriver/src/msgs.h b/plugins/Scriver/src/msgs.h
index 78f75add4f..28ec396099 100644
--- a/plugins/Scriver/src/msgs.h
+++ b/plugins/Scriver/src/msgs.h
@@ -192,7 +192,6 @@ public:
#define EVENTTYPE_JABBER_PRESENCE 2001
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 2132d124f4..9167a4f3dd 100644
--- a/plugins/Scriver/src/msgutils.cpp
+++ b/plugins/Scriver/src/msgutils.cpp
@@ -122,7 +122,7 @@ bool CMsgDialog::GetFirstEvent()
m_hDbEventFirst = db_event_firstUnread(m_hContact);
if (m_hDbEventFirst != 0) {
DB::EventInfo dbei(m_hDbEventFirst, false);
- if (DbEventIsMessageOrCustom(dbei) && !(dbei.flags & DBEF_READ) && !(dbei.flags & DBEF_SENT))
+ if (dbei.isSrmm() && !(dbei.flags & DBEF_READ) && !(dbei.flags & DBEF_SENT))
notifyUnread = true;
}
diff --git a/src/core/stdmsg/src/msglog.cpp b/src/core/stdmsg/src/msglog.cpp
index 83c1f79ac9..62cf73ca53 100644
--- a/src/core/stdmsg/src/msglog.cpp
+++ b/src/core/stdmsg/src/msglog.cpp
@@ -144,7 +144,7 @@ static void SetToStyle(int style, CMStringA &dest)
bool DbEventIsShown(const DB::EventInfo &dbei)
{
- return dbei.eventType == EVENTTYPE_MESSAGE || dbei.eventType == EVENTTYPE_FILE || dbei.isSrmm();
+ return dbei.isSrmm();
}
/////////////////////////////////////////////////////////////////////////////////////////
diff --git a/src/core/stdmsg/src/stdafx.h b/src/core/stdmsg/src/stdafx.h
index 7d8cb2f962..27a9c076e3 100644
--- a/src/core/stdmsg/src/stdafx.h
+++ b/src/core/stdmsg/src/stdafx.h
@@ -201,8 +201,7 @@ void Load_ChatModule(void);
void InitGlobals(void);
// log.cpp
-char* Log_CreateRtfHeader(void);
-CSrmmLogWindow *logBuilder(CMsgDialog &pDlg);
+CSrmmLogWindow* logBuilder(CMsgDialog &pDlg);
// window.cpp
SESSION_INFO* SM_GetPrevWindow(SESSION_INFO *si);
diff --git a/src/mir_app/src/chat_log.cpp b/src/mir_app/src/chat_log.cpp
index b5479987b1..32bd10bcc3 100644
--- a/src/mir_app/src/chat_log.cpp
+++ b/src/mir_app/src/chat_log.cpp
@@ -319,7 +319,7 @@ 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.isSrmm())
m_pDlg.MarkEventRead(dbei);
if (dbei.eventType == EVENTTYPE_FILE) {
diff --git a/src/mir_app/src/srmm_log_rtf.cpp b/src/mir_app/src/srmm_log_rtf.cpp
index 164f8cb559..0531b3e445 100644
--- a/src/mir_app/src/srmm_log_rtf.cpp
+++ b/src/mir_app/src/srmm_log_rtf.cpp
@@ -335,7 +335,7 @@ static bool CreateRtfFromDbEvent(RtfLogStreamData *dat)
return false;
if (!(dbei.flags & DBEF_SENT)) {
- if (dbei.eventType == EVENTTYPE_MESSAGE || dbei.isSrmm())
+ if (dbei.isSrmm())
dat->pLog->GetDialog().MarkEventRead(dbei);
else if (dbei.eventType == EVENTTYPE_FILE) {