From 54dff9bda866e580e3be4e202adc3c8cdb368228 Mon Sep 17 00:00:00 2001 From: George Hazan Date: Tue, 1 Oct 2024 15:09:57 +0300 Subject: code cleaning --- plugins/TabSRMM/src/msgdialog.cpp | 27 +++++++++------------------ plugins/TabSRMM/src/msgdlgother.cpp | 2 +- 2 files changed, 10 insertions(+), 19 deletions(-) (limited to 'plugins/TabSRMM/src') diff --git a/plugins/TabSRMM/src/msgdialog.cpp b/plugins/TabSRMM/src/msgdialog.cpp index f21c2431ce..d510320768 100644 --- a/plugins/TabSRMM/src/msgdialog.cpp +++ b/plugins/TabSRMM/src/msgdialog.cpp @@ -894,25 +894,16 @@ void CMsgDialog::onClick_Quote(CCtrlButton*) if (selected != nullptr) szQuoted = Srmm_Quote(selected, iOutputWidth); else { - MEVENT hDBEvent = db_event_last(m_hContact); - if (hDBEvent == 0) - return; - - if (m_iLogMode == WANT_BUILTIN_LOG) { - CHARRANGE sel; - LOG()->WndProc(EM_EXGETSEL, 0, (LPARAM)&sel); - if (sel.cpMin != sel.cpMax) { - ptrA szFromStream(LOG()->RTF().GetRichTextRtf(true, true)); - ptrW converted(mir_utf8decodeW(szFromStream)); - Utils::FilterEventMarkers(converted); - szQuoted = Srmm_Quote(converted, iOutputWidth); - } - } + ptrW wszSelection(m_pLog->GetSelectedText()); + if (mir_wstrlen(wszSelection)) + szQuoted = Srmm_Quote(wszSelection, iOutputWidth); if (szQuoted.IsEmpty()) { - DB::EventInfo dbei(hDBEvent); - if (dbei) - szQuoted = Srmm_Quote(ptrW(dbei.getText()), iOutputWidth); + if (MEVENT hDBEvent = db_event_last(m_hContact)) { + DB::EventInfo dbei(hDBEvent); + if (dbei) + szQuoted = Srmm_Quote(ptrW(dbei.getText()), iOutputWidth); + } } } @@ -1458,7 +1449,7 @@ int CMsgDialog::OnFilter(MSGFILTER *pFilter) File::Send(m_hContact); return _dlgReturn(m_hwnd, 1); case TABSRMM_HK_QUOTEMSG: - SendMessage(m_hwnd, WM_COMMAND, IDC_QUOTE, 0); + m_btnQuote.Click(); return _dlgReturn(m_hwnd, 1); case TABSRMM_HK_CLEARMSG: m_message.SetText(L""); diff --git a/plugins/TabSRMM/src/msgdlgother.cpp b/plugins/TabSRMM/src/msgdlgother.cpp index 1317a38f3c..d4f8e5a196 100644 --- a/plugins/TabSRMM/src/msgdlgother.cpp +++ b/plugins/TabSRMM/src/msgdlgother.cpp @@ -1910,7 +1910,7 @@ void CMsgDialog::ShowPopupMenu(const CCtrlBase &pCtrl, POINT pt) pCtrl.SendMsg(EM_PASTESPECIAL, (iSelection == IDM_PASTE) ? CF_UNICODETEXT : 0, 0); break; case IDM_QUOTE: - SendMessage(m_hwnd, WM_COMMAND, IDC_QUOTE, 0); + m_btnQuote.Click(); break; case IDM_SELECTALL: pCtrl.SendMsg(EM_EXSETSEL, 0, (LPARAM)& all); -- cgit v1.2.3