summaryrefslogtreecommitdiff
path: root/src/core/stdmsg
diff options
context:
space:
mode:
authorGeorge Hazan <ghazan@miranda.im>2023-04-17 21:08:49 +0300
committerGeorge Hazan <ghazan@miranda.im>2023-04-17 21:08:49 +0300
commitb6bb2574a234f205b4809aa3b4a37788a8a85063 (patch)
tree0a39715ec76a7d44fe6bdec7a4e2f2367384a297 /src/core/stdmsg
parent84f1eac98d46db881cc5c1cb09939bdae67224a9 (diff)
Jabber: more OMEMO related fixes
Diffstat (limited to 'src/core/stdmsg')
-rw-r--r--src/core/stdmsg/res/private.icobin0 -> 1150 bytes
-rw-r--r--src/core/stdmsg/res/resource.rc4
-rw-r--r--src/core/stdmsg/res/unverified.icobin0 -> 1150 bytes
-rw-r--r--src/core/stdmsg/src/globals.cpp8
-rw-r--r--src/core/stdmsg/src/msgdialog.cpp41
-rw-r--r--src/core/stdmsg/src/msglog.cpp7
-rw-r--r--src/core/stdmsg/src/msgs.h1
-rw-r--r--src/core/stdmsg/src/resource.h2
8 files changed, 59 insertions, 4 deletions
diff --git a/src/core/stdmsg/res/private.ico b/src/core/stdmsg/res/private.ico
new file mode 100644
index 0000000000..ff23d39b5f
--- /dev/null
+++ b/src/core/stdmsg/res/private.ico
Binary files differ
diff --git a/src/core/stdmsg/res/resource.rc b/src/core/stdmsg/res/resource.rc
index caf2ea092c..d6cb78f4b7 100644
--- a/src/core/stdmsg/res/resource.rc
+++ b/src/core/stdmsg/res/resource.rc
@@ -412,6 +412,10 @@ IDI_NICKLIST2 ICON "nicklist2.ico"
IDI_FILTER2 ICON "filter2.ico"
+IDI_SECURE ICON "unverified.ico"
+
+IDI_SECURE_STRONG ICON "private.ico"
+
/////////////////////////////////////////////////////////////////////////////
//
diff --git a/src/core/stdmsg/res/unverified.ico b/src/core/stdmsg/res/unverified.ico
new file mode 100644
index 0000000000..0595776a28
--- /dev/null
+++ b/src/core/stdmsg/res/unverified.ico
Binary files differ
diff --git a/src/core/stdmsg/src/globals.cpp b/src/core/stdmsg/src/globals.cpp
index 38ea6641d2..73972a2312 100644
--- a/src/core/stdmsg/src/globals.cpp
+++ b/src/core/stdmsg/src/globals.cpp
@@ -23,9 +23,11 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
IconItem iconList[] =
{
- { LPGEN("Incoming message (10x10)"), "INCOMING", IDI_INCOMING, 10 },
- { LPGEN("Outgoing message (10x10)"), "OUTGOING", IDI_OUTGOING, 10 },
- { LPGEN("Notice (10x10)"), "NOTICE", IDI_NOTICE, 10 },
+ { LPGEN("Incoming message (10x10)"), "INCOMING", IDI_INCOMING, 10 },
+ { LPGEN("Outgoing message (10x10)"), "OUTGOING", IDI_OUTGOING, 10 },
+ { LPGEN("Notice (10x10)"), "NOTICE", IDI_NOTICE, 10 },
+ { LPGEN("Encrypted (10x10)"), "UNVERIFIED", IDI_SECURE, 10 },
+ { LPGEN("Encrypted verified (10x10)"), "PRIVATE", IDI_SECURE_STRONG, 10 },
};
static void InitIcons(void)
diff --git a/src/core/stdmsg/src/msgdialog.cpp b/src/core/stdmsg/src/msgdialog.cpp
index ef28b8fd99..d9c5acbb39 100644
--- a/src/core/stdmsg/src/msgdialog.cpp
+++ b/src/core/stdmsg/src/msgdialog.cpp
@@ -727,6 +727,40 @@ static const CHARRANGE rangeAll = { 0, -1 };
LRESULT CMsgDialog::WndProc_Message(UINT msg, WPARAM wParam, LPARAM lParam)
{
switch (msg) {
+ case WM_NCPAINT:
+ if (!m_sEncryption.IsEmpty()) {
+ RECT rect;
+ GetWindowRect(m_message.GetHwnd(), &rect);
+ HRGN region = NULL;
+ if (wParam == NULLREGION) {
+ region = CreateRectRgn(rect.left, rect.top, rect.right, rect.bottom);
+ HRGN region2 = CreateRectRgn(rect.left + 1, rect.top + 1, rect.right - 1, rect.bottom - 1);
+ CombineRgn(region, region, (HRGN)region2, RGN_DIFF);
+ }
+ else {
+ HRGN copy = CreateRectRgn(0, 0, 0, 0);
+ if (CombineRgn(copy, (HRGN)wParam, NULL, RGN_COPY))
+ region = copy;
+ else
+ DeleteObject(copy);
+ }
+
+ HDC dc = GetDCEx(m_message.GetHwnd(), region, DCX_WINDOW | DCX_CACHE | DCX_INTERSECTRGN | DCX_LOCKWINDOWUPDATE);
+ if (region)
+ DeleteObject(region);
+
+ HPEN pen = CreatePen(PS_INSIDEFRAME, 1, RGB(0, 220, 0));
+ HGDIOBJ old = SelectObject(dc, pen);
+ int width = rect.right - rect.left;
+ int height = rect.bottom - rect.top;
+ Rectangle(dc, 0, 0, width, height);
+ SelectObject(dc, old);
+ ReleaseDC(m_message.GetHwnd(), dc);
+ DeleteObject(pen);
+ return 0;
+ }
+ break;
+
case EM_REPLACESEL:
PostMessage(m_message.GetHwnd(), EM_ACTIVATE, 0, 0);
break;
@@ -856,6 +890,13 @@ LRESULT CMsgDialog::WndProc_Message(UINT msg, WPARAM wParam, LPARAM lParam)
}
break;
+ case WM_SETFOCUS: {
+ const char* enc = (const char*)CallProtoService(m_szProto, PS_GETCAPS, PFLAG_GETCURRENTENCRYPTION, m_hContact);
+ if (!m_sEncryption.IsEmpty() ^ (bool)enc)
+ RedrawWindow(m_message.GetHwnd(), NULL, NULL, RDW_FRAME | RDW_INVALIDATE);
+ m_sEncryption = enc;
+ }
+
case WM_KEYDOWN:
bool isShift = (GetKeyState(VK_SHIFT) & 0x8000) != 0;
bool isCtrl = (GetKeyState(VK_CONTROL) & 0x8000) != 0;
diff --git a/src/core/stdmsg/src/msglog.cpp b/src/core/stdmsg/src/msglog.cpp
index 568dec4a5a..ba0d25e44a 100644
--- a/src/core/stdmsg/src/msglog.cpp
+++ b/src/core/stdmsg/src/msglog.cpp
@@ -27,7 +27,7 @@ extern IconItem iconList[];
#define LOGICON_MSG_OUT 1
#define LOGICON_MSG_NOTICE 2
-static char *pLogIconBmpBits[3];
+static char *pLogIconBmpBits[5];
struct RtfLogStreamData : public RtfLogStreamBase
{
@@ -290,6 +290,11 @@ public:
buf.Append("\\f0\\fs14");
buf.Append(pLogIconBmpBits[i]);
+
+ if (dbei.eventType == EVENTTYPE_MESSAGE && dbei.flags & (DBEF_SECURE | DBEF_SECURE_STRONG)) {
+ buf.Append("\\f0\\fs14");
+ buf.Append(pLogIconBmpBits[dbei.flags & DBEF_SECURE ? 3 : 4]);
+ }
}
int showColon = 0;
diff --git a/src/core/stdmsg/src/msgs.h b/src/core/stdmsg/src/msgs.h
index ce79ce26fa..ec67524d0c 100644
--- a/src/core/stdmsg/src/msgs.h
+++ b/src/core/stdmsg/src/msgs.h
@@ -81,6 +81,7 @@ class CMsgDialog : public CSrmmBaseDialog
uint16_t m_wMinute = 0;
bool m_bIsMeta = false, m_bWindowCascaded = false, m_bNoActivate = false;
int m_iBBarHeight = 28;
+ CMStringA m_sEncryption;
public:
CMsgDialog(CTabbedWindow *pOwner, MCONTACT hContact);
diff --git a/src/core/stdmsg/src/resource.h b/src/core/stdmsg/src/resource.h
index 457d5b3e3b..ba7a9f0c3a 100644
--- a/src/core/stdmsg/src/resource.h
+++ b/src/core/stdmsg/src/resource.h
@@ -42,6 +42,8 @@
#define IDI_OVERLAY 160
#define IDI_NICKLIST2 161
#define IDI_FILTER2 162
+#define IDI_SECURE 163
+#define IDI_SECURE_STRONG 164
#define IDR_CONTEXT 180
#define IDC_DROP 183
#define IDC_HYPERLINKHAND 214