summaryrefslogtreecommitdiff
path: root/plugins
diff options
context:
space:
mode:
authorGeorge Hazan <george.hazan@gmail.com>2023-12-19 18:44:33 +0300
committerGeorge Hazan <george.hazan@gmail.com>2023-12-19 18:44:33 +0300
commitd07eff4fb66e8484a03514ea1725f4feb2004519 (patch)
tree7f75d3d426e28d1c3634429195118b861d3b3a2d /plugins
parent427e4097ebfe1a3e38cbaa69e1e2af5c881deb67 (diff)
fixes #4057 (SmileyAdd пытается работать с журналом NewStory, как с RTF)
Diffstat (limited to 'plugins')
-rw-r--r--plugins/SmileyAdd/src/dlgboxsubclass.cpp19
-rw-r--r--plugins/SmileyAdd/src/richcall.cpp4
2 files changed, 17 insertions, 6 deletions
diff --git a/plugins/SmileyAdd/src/dlgboxsubclass.cpp b/plugins/SmileyAdd/src/dlgboxsubclass.cpp
index 6a560a4127..4f0618b49b 100644
--- a/plugins/SmileyAdd/src/dlgboxsubclass.cpp
+++ b/plugins/SmileyAdd/src/dlgboxsubclass.cpp
@@ -122,11 +122,21 @@ int SmileyButtonPressed(WPARAM, LPARAM lParam)
/////////////////////////////////////////////////////////////////////////////////////////
// window hook
+static HWND checkRichEdit(HWND hwnd)
+{
+ wchar_t wszClass[200];
+ if (GetClassNameW(hwnd, wszClass, _countof(wszClass)))
+ if (!wcsicmp(wszClass, L"RICHEDIT50W"))
+ return hwnd;
+
+ return nullptr;
+}
+
static int MsgDlgHook(WPARAM uType, LPARAM lParam)
{
auto *pDlg = (CSrmmBaseDialog *)lParam;
- auto hwndLog = pDlg->log()->GetHwnd();
- auto hwndInput = pDlg->GetInput();
+ auto hwndLog = checkRichEdit(pDlg->log()->GetHwnd());
+ auto hwndInput = checkRichEdit(pDlg->GetInput());
switch (uType) {
case MSG_WINDOW_EVT_OPENING:
@@ -157,10 +167,7 @@ static int MsgDlgHook(WPARAM uType, LPARAM lParam)
break;
case MSG_WINDOW_EVT_CLOSE:
- if (hwndLog) {
- CloseRichCallback(hwndLog);
- CloseRichOwnerCallback(pDlg->GetHwnd());
- }
+ CloseRichOwnerCallback(pDlg->GetHwnd());
mir_cslock lck(csWndList);
g_MsgWndList.remove((MsgWndData *)&pDlg);
diff --git a/plugins/SmileyAdd/src/richcall.cpp b/plugins/SmileyAdd/src/richcall.cpp
index ed0c886ae1..da9323e633 100644
--- a/plugins/SmileyAdd/src/richcall.cpp
+++ b/plugins/SmileyAdd/src/richcall.cpp
@@ -328,6 +328,9 @@ bool SetRichCallback(HWND hwnd, MCONTACT hContact, bool subany, bool subnew)
void CloseRichCallback(HWND hwnd)
{
+ if (!hwnd)
+ return;
+
RichEditData *rdt;
{
mir_cslock lck(csLists);
@@ -342,6 +345,7 @@ void CloseRichCallback(HWND hwnd)
if (rdt->hToolTip)
DestroyWindow(rdt->hToolTip);
delete rdt;
+
mir_unsubclassWindow(hwnd, RichEditSubclass);
}