From bd1545cafd2da7fa2ce5c64c73ec79766dc9e53c Mon Sep 17 00:00:00 2001 From: George Hazan Date: Wed, 19 Apr 2023 20:25:08 +0300 Subject: StdMsg: minor code cleaning --- src/core/stdmsg/src/msgdialog.cpp | 28 ++++++++++++++-------------- src/core/stdmsg/src/msglog.cpp | 2 +- src/core/stdmsg/src/msgs.cpp | 1 + 3 files changed, 16 insertions(+), 15 deletions(-) (limited to 'src/core/stdmsg') diff --git a/src/core/stdmsg/src/msgdialog.cpp b/src/core/stdmsg/src/msgdialog.cpp index 7c87170fcc..492af0aede 100644 --- a/src/core/stdmsg/src/msgdialog.cpp +++ b/src/core/stdmsg/src/msgdialog.cpp @@ -166,20 +166,6 @@ bool CMsgDialog::OnInitDialog() OnOptionsApplied(false); - // restore saved msg if any... - if (m_hContact) { - DBVARIANT dbv; - if (!db_get_ws(m_hContact, SRMSGMOD, DBSAVEDMSG, &dbv)) { - if (dbv.pwszVal[0]) { - m_message.SetText(dbv.pwszVal); - m_btnOk.Enable(true); - UpdateReadChars(); - PostMessage(m_message.GetHwnd(), EM_SETSEL, -1, -1); - } - db_free(&dbv); - } - } - uint32_t dwFlags = SWP_NOMOVE | SWP_NOSIZE; if (!g_Settings.bTabsEnable) dwFlags |= SWP_SHOWWINDOW; @@ -197,6 +183,20 @@ bool CMsgDialog::OnInitDialog() UpdateAvatar(); } + // restore saved msg if any... + if (m_hContact) { + DBVARIANT dbv; + if (!db_get_ws(m_hContact, SRMSGMOD, DBSAVEDMSG, &dbv)) { + if (dbv.pwszVal[0]) { + m_message.SetText(dbv.pwszVal); + m_btnOk.Enable(true); + UpdateReadChars(); + PostMessage(m_message.GetHwnd(), EM_SETSEL, -1, -1); + } + db_free(&dbv); + } + } + NotifyEvent(MSG_WINDOW_EVT_OPEN); return true; } diff --git a/src/core/stdmsg/src/msglog.cpp b/src/core/stdmsg/src/msglog.cpp index 6331b6ec30..4e69be9a09 100644 --- a/src/core/stdmsg/src/msglog.cpp +++ b/src/core/stdmsg/src/msglog.cpp @@ -290,7 +290,7 @@ public: buf.Append("\\f0\\fs14"); buf.Append(pLogIconBmpBits[i]); - if (dbei.eventType == EVENTTYPE_MESSAGE && dbei.flags & (DBEF_SECURE | DBEF_SECURE_STRONG)) { + if ((dbei.eventType == EVENTTYPE_MESSAGE || dbei.eventType == EVENTTYPE_FILE) && dbei.flags & (DBEF_SECURE | DBEF_SECURE_STRONG)) { buf.Append("\\f0\\fs14"); buf.Append(pLogIconBmpBits[dbei.flags & DBEF_SECURE ? 3 : 4]); } diff --git a/src/core/stdmsg/src/msgs.cpp b/src/core/stdmsg/src/msgs.cpp index c0e216c262..88cf6f656a 100644 --- a/src/core/stdmsg/src/msgs.cpp +++ b/src/core/stdmsg/src/msgs.cpp @@ -509,6 +509,7 @@ int LoadSendRecvMessageModule(void) HookEvent(ME_CLIST_PREBUILDCONTACTMENU, PrebuildContactMenu); HookEvent(ME_DB_EVENT_ADDED, MessageEventAdded); + HookEvent(ME_DB_EVENT_EDITED, MessageEventAdded); HookEvent(ME_DB_CONTACT_SETTINGCHANGED, MessageSettingChanged); HookEvent(ME_DB_CONTACT_DELETED, ContactDeleted); HookEvent(ME_OPT_INITIALISE, OptInitialise); -- cgit v1.2.3