summaryrefslogtreecommitdiff
path: root/plugins/Scriver/src
diff options
context:
space:
mode:
authorGeorge Hazan <george.hazan@gmail.com>2023-09-05 15:35:12 +0300
committerGeorge Hazan <george.hazan@gmail.com>2023-09-05 15:35:12 +0300
commit28c2eb96831f1e6088e4b498f8125b050585dd3b (patch)
tree2bff3cbedb270fdba4288c0eacf2b5381a77b4c9 /plugins/Scriver/src
parenta074799eaf3218c979fa07d8a76525aa0ec7b9fd (diff)
SRMM: quoting unification
Diffstat (limited to 'plugins/Scriver/src')
-rw-r--r--plugins/Scriver/src/msgdialog.cpp45
-rw-r--r--plugins/Scriver/src/msglog.cpp3
2 files changed, 5 insertions, 43 deletions
diff --git a/plugins/Scriver/src/msgdialog.cpp b/plugins/Scriver/src/msgdialog.cpp
index 1e2f63cbb6..22bd7c8a08 100644
--- a/plugins/Scriver/src/msgdialog.cpp
+++ b/plugins/Scriver/src/msgdialog.cpp
@@ -25,42 +25,6 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
/////////////////////////////////////////////////////////////////////////////////////////
-static CMStringW GetQuotedTextW(wchar_t *text)
-{
- CMStringW res;
- bool newLine = true;
- bool wasCR = false;
- for (; *text; text++) {
- if (*text == '\r') {
- wasCR = newLine = true;
- res.AppendChar('\r');
- if (text[1] != '\n')
- res.AppendChar('\n');
- }
- else if (*text == '\n') {
- newLine = true;
- if (!wasCR)
- res.AppendChar('\r');
-
- res.AppendChar('\n');
- wasCR = false;
- }
- else {
- if (newLine) {
- res.AppendChar('>');
- res.AppendChar(' ');
- }
- wasCR = newLine = false;
- res.AppendChar(*text);
- }
- }
- res.AppendChar('\r');
- res.AppendChar('\n');
- return res;
-}
-
-/////////////////////////////////////////////////////////////////////////////////////////
-
static INT_PTR CALLBACK ConfirmSendAllDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM)
{
switch (msg) {
@@ -412,7 +376,8 @@ void CMsgDialog::onClick_UserMenu(CCtrlButton *pButton)
void CMsgDialog::onClick_Quote(CCtrlButton*)
{
- if (m_hDbEventLast == 0)
+ MEVENT hDbEventLast = db_event_last(m_hContact);
+ if (!hDbEventLast)
return;
SETTEXTEX st;
@@ -421,19 +386,19 @@ void CMsgDialog::onClick_Quote(CCtrlButton*)
wchar_t *buffer = m_pLog->GetSelection();
if (buffer != nullptr) {
- CMStringW quotedBuffer(GetQuotedTextW(buffer));
+ CMStringW quotedBuffer(Srmm_Quote(buffer));
m_message.SendMsg(EM_SETTEXTEX, (WPARAM)&st, (LPARAM)quotedBuffer.c_str());
mir_free(buffer);
}
else {
- DB::EventInfo dbei(m_hDbEventLast);
+ DB::EventInfo dbei(hDbEventLast);
if (!dbei)
return;
if (DbEventIsMessageOrCustom(dbei)) {
buffer = DbEvent_GetTextW(&dbei, CP_ACP);
if (buffer != nullptr) {
- CMStringW quotedBuffer(GetQuotedTextW(buffer));
+ CMStringW quotedBuffer(Srmm_Quote(buffer));
m_message.SendMsg(EM_SETTEXTEX, (WPARAM)&st, (LPARAM)quotedBuffer.c_str());
mir_free(buffer);
}
diff --git a/plugins/Scriver/src/msglog.cpp b/plugins/Scriver/src/msglog.cpp
index c653e4f93a..d747909527 100644
--- a/plugins/Scriver/src/msglog.cpp
+++ b/plugins/Scriver/src/msglog.cpp
@@ -580,7 +580,6 @@ public:
RtfLogStreamData streamData = {};
streamData.hContact = m_pDlg.m_hContact;
streamData.hDbEvent = hDbEventFirst;
- streamData.hDbEventLast = m_pDlg.m_hDbEventLast;
streamData.pLog = this;
streamData.eventsToInsert = count;
streamData.isFirst = bAppend ? m_rtf.GetRichTextLength() == 0 : 1;
@@ -656,8 +655,6 @@ public:
ScrollToBottom();
RedrawWindow(m_rtf.GetHwnd(), nullptr, nullptr, RDW_INVALIDATE | RDW_UPDATENOW);
}
-
- m_pDlg.m_hDbEventLast = streamData.hDbEventLast;
}
////////////////////////////////////////////////////////////////////////////////////////