summaryrefslogtreecommitdiff
path: root/plugins/TabSRMM/src
diff options
context:
space:
mode:
Diffstat (limited to 'plugins/TabSRMM/src')
-rw-r--r--plugins/TabSRMM/src/chat.h1
-rw-r--r--plugins/TabSRMM/src/chat_log.cpp4
-rw-r--r--plugins/TabSRMM/src/chat_tools.cpp8
-rw-r--r--plugins/TabSRMM/src/chat_window.cpp14
-rw-r--r--plugins/TabSRMM/src/contactcache.cpp38
-rw-r--r--plugins/TabSRMM/src/contactcache.h2
-rw-r--r--plugins/TabSRMM/src/controls.cpp11
-rw-r--r--plugins/TabSRMM/src/generic_msghandlers.cpp6
-rw-r--r--plugins/TabSRMM/src/msgdialog.cpp21
-rw-r--r--plugins/TabSRMM/src/msgdlgutils.cpp44
-rw-r--r--plugins/TabSRMM/src/msgdlgutils.h1
-rw-r--r--plugins/TabSRMM/src/msgs.h3
-rw-r--r--plugins/TabSRMM/src/sendqueue.cpp4
-rw-r--r--plugins/TabSRMM/src/utils.cpp21
-rw-r--r--plugins/TabSRMM/src/utils.h1
15 files changed, 69 insertions, 110 deletions
diff --git a/plugins/TabSRMM/src/chat.h b/plugins/TabSRMM/src/chat.h
index a18054cc5e..e42674d2d0 100644
--- a/plugins/TabSRMM/src/chat.h
+++ b/plugins/TabSRMM/src/chat.h
@@ -125,7 +125,6 @@ int UM_CompareItem(USERINFO *u1, const wchar_t* pszNick, WORD wStatus);
BOOL DoSoundsFlashPopupTrayStuff(SESSION_INFO *si, GCEVENT *gce, BOOL bHighlight, int bManyFix);
int Chat_GetColorIndex(const char* pszModule, COLORREF cr);
wchar_t* my_strstri(const wchar_t* s1, const wchar_t* s2);
-int GetRichTextLength(HWND hwnd);
bool IsHighlighted(SESSION_INFO *si, GCEVENT *pszText);
char GetIndicator(SESSION_INFO *si, LPCTSTR ptszNick, int *iNickIndex);
void Chat_SetFilters(SESSION_INFO *si);
diff --git a/plugins/TabSRMM/src/chat_log.cpp b/plugins/TabSRMM/src/chat_log.cpp
index 037d457fd7..10e0d74476 100644
--- a/plugins/TabSRMM/src/chat_log.cpp
+++ b/plugins/TabSRMM/src/chat_log.cpp
@@ -866,7 +866,7 @@ void CChatRoomDlg::StreamInEvents(LOGINFO *lin, bool bRedraw)
m_log.SendMsg(WM_SETREDRAW, FALSE, 0);
// set the insertion point at the bottom
- sel.cpMin = sel.cpMax = GetRichTextLength(m_log.GetHwnd());
+ sel.cpMin = sel.cpMax = m_log.GetRichTextLength();
m_log.SendMsg(EM_EXSETSEL, 0, (LPARAM)&sel);
// fix for the indent... must be a M$ bug
@@ -983,7 +983,7 @@ void CChatRoomDlg::StreamInEvents(LOGINFO *lin, bool bRedraw)
// need to invalidate the window
if (bFlag) {
- sel.cpMin = sel.cpMax = GetRichTextLength(m_log.GetHwnd());
+ sel.cpMin = sel.cpMax = m_log.GetRichTextLength();
m_log.SendMsg(EM_EXSETSEL, 0, (LPARAM)&sel);
m_log.SendMsg(WM_SETREDRAW, TRUE, 0);
InvalidateRect(m_log.GetHwnd(), nullptr, TRUE);
diff --git a/plugins/TabSRMM/src/chat_tools.cpp b/plugins/TabSRMM/src/chat_tools.cpp
index a3fe2d7e42..256648b33c 100644
--- a/plugins/TabSRMM/src/chat_tools.cpp
+++ b/plugins/TabSRMM/src/chat_tools.cpp
@@ -28,14 +28,6 @@
#include "stdafx.h"
-int GetRichTextLength(HWND hwnd)
-{
- GETTEXTLENGTHEX gtl;
- gtl.flags = GTL_PRECISE;
- gtl.codepage = CP_ACP;
- return (int)SendMessage(hwnd, EM_GETTEXTLENGTHEX, (WPARAM)&gtl, 0);
-}
-
static void __stdcall ShowRoomFromPopup(void *pi)
{
SESSION_INFO *si = (SESSION_INFO*)pi;
diff --git a/plugins/TabSRMM/src/chat_window.cpp b/plugins/TabSRMM/src/chat_window.cpp
index 8b24b7526c..4d45b95a44 100644
--- a/plugins/TabSRMM/src/chat_window.cpp
+++ b/plugins/TabSRMM/src/chat_window.cpp
@@ -636,7 +636,7 @@ void CChatRoomDlg::onClick_OK(CCtrlButton*)
if (mi == nullptr)
return;
- ptrA pszRtf(Message_GetFromStream(m_message.GetHwnd()));
+ ptrA pszRtf(m_message.GetRichTextRtf());
pci->SM_AddCommand(m_si->ptszID, m_si->pszModule, pszRtf);
CMStringW ptszText(ptrW(mir_utf8decodeW(pszRtf)));
@@ -715,8 +715,8 @@ void CChatRoomDlg::onChange_Message(CCtrlEdit*)
UpdateReadChars();
m_dwLastActivity = GetTickCount();
m_pContainer->dwLastActivity = m_dwLastActivity;
- m_btnOk.SendMsg(BUTTONSETASNORMAL, GetRichTextLength(m_message.GetHwnd()) != 0, 0);
- m_btnOk.Enable(GetRichTextLength(m_message.GetHwnd()) != 0);
+ m_btnOk.SendMsg(BUTTONSETASNORMAL, m_message.GetRichTextLength() != 0, 0);
+ m_btnOk.Enable(m_message.GetRichTextLength() != 0);
// Typing support for GCW_PRIVMESS sessions
if (m_si->iType == GCW_PRIVMESS) {
@@ -996,7 +996,7 @@ LRESULT CChatRoomDlg::WndProc_Log(UINT msg, WPARAM wParam, LPARAM lParam)
return CSkin::DrawRichEditFrame(m_log.GetHwnd(), this, ID_EXTBKHISTORY, msg, wParam, lParam, stubLogProc);
case WM_COPY:
- return Utils::WMCopyHandler(m_log.GetHwnd(), stubLogProc, msg, wParam, lParam);
+ return WMCopyHandler(msg, wParam, lParam);
case WM_SETCURSOR:
if (g_Settings.bClickableNicks && (LOWORD(lParam) == HTCLIENT)) {
@@ -1041,7 +1041,7 @@ LRESULT CChatRoomDlg::WndProc_Log(UINT msg, WPARAM wParam, LPARAM lParam)
return TRUE;
}
if (wParam == VK_INSERT && GetKeyState(VK_CONTROL) & 0x8000)
- return Utils::WMCopyHandler(m_log.GetHwnd(), stubLogProc, msg, wParam, lParam);
+ return WMCopyHandler(msg, wParam, lParam);
break;
case WM_SYSKEYUP:
@@ -1070,7 +1070,7 @@ LRESULT CChatRoomDlg::WndProc_Log(UINT msg, WPARAM wParam, LPARAM lParam)
bool isCtrl, isShift, isAlt;
KbdState(isShift, isCtrl, isAlt);
if (wParam == 0x03 && isCtrl) // Ctrl+C
- return Utils::WMCopyHandler(m_log.GetHwnd(), stubLogProc, msg, wParam, lParam);
+ return WMCopyHandler(msg, wParam, lParam);
break;
}
@@ -1333,7 +1333,7 @@ LRESULT CChatRoomDlg::WndProc_Message(UINT msg, WPARAM wParam, LPARAM lParam)
if (!m_si->lpCurrentCommand || !m_si->lpCurrentCommand->last) {
// Next command is not defined. It means currently entered text is not saved in the history and it
// need to be saved in the window context.
- char *enteredText = Message_GetFromStream(m_hwnd);
+ char *enteredText = m_message.GetRichTextRtf();
if (m_enteredText)
mir_free(m_enteredText);
diff --git a/plugins/TabSRMM/src/contactcache.cpp b/plugins/TabSRMM/src/contactcache.cpp
index 12c3361463..b612be884a 100644
--- a/plugins/TabSRMM/src/contactcache.cpp
+++ b/plugins/TabSRMM/src/contactcache.cpp
@@ -229,24 +229,25 @@ void CContactCache::setWindowData(CSrmmWindow *dat)
// saves message to the input history.
// it's using streamout in UTF8 format - no unicode "issues" and all RTF formatting is saved to the history.
-void CContactCache::saveHistory(WPARAM wParam, LPARAM)
+void CContactCache::saveHistory(int iHistorySize)
{
if (m_dat == nullptr)
return;
int oldTop = 0;
- if (wParam) {
+ if (iHistorySize) {
oldTop = m_iHistoryTop;
- m_iHistoryTop = (int)wParam;
+ m_iHistoryTop = iHistorySize;
}
- char *szFromStream = ::Message_GetFromStream(GetDlgItem(m_dat->GetHwnd(), IDC_SRMM_MESSAGE), SF_RTFNOOBJS | SFF_PLAINRTF | SF_NCRFORNONASCII);
+ CCtrlRichEdit &pEntry = m_dat->GetEntry();
+ ptrA szFromStream(pEntry.GetRichTextRtf());
if (szFromStream != nullptr) {
- size_t iLength = 0, iStreamLength = 0;
- iLength = iStreamLength = (mir_strlen(szFromStream) + 1);
+ size_t iLength, iStreamLength;
+ iLength = iStreamLength = mir_strlen(szFromStream) + 1;
if (iLength > 0 && m_history != nullptr) { // XXX: iLength > 1 ?
- if ((m_iHistoryTop == m_iHistorySize) && oldTop == 0) { // shift the stack down...
+ if (m_iHistoryTop == m_iHistorySize && oldTop == 0) { // shift the stack down...
TInputHistory ihTemp = m_history[0];
m_iHistoryTop--;
::memmove((void*)&m_history[0], (void*)&m_history[1], (m_iHistorySize - 1) * sizeof(TInputHistory));
@@ -274,7 +275,6 @@ void CContactCache::saveHistory(WPARAM wParam, LPARAM)
}
}
}
- mir_free(szFromStream);
}
if (oldTop)
m_iHistoryTop = oldTop;
@@ -290,13 +290,14 @@ void CContactCache::inputHistoryEvent(WPARAM wParam)
return;
if (m_history != nullptr && m_history[0].szText != nullptr) { // at least one entry needs to be alloced, otherwise we get a nice infinite loop ;)
- HWND hwndEdit = ::GetDlgItem(m_dat->GetHwnd(), IDC_SRMM_MESSAGE);
+ CCtrlRichEdit &pEntry = m_dat->GetEntry();
+
SETTEXTEX stx = { ST_DEFAULT, CP_UTF8 };
if (m_dat->m_dwFlags & MWF_NEEDHISTORYSAVE) {
m_iHistoryCurrent = m_iHistoryTop;
- if (::GetWindowTextLength(hwndEdit) > 0)
- saveHistory(m_iHistorySize, 0);
+ if (::GetWindowTextLength(pEntry.GetHwnd()) > 0)
+ saveHistory(m_iHistorySize);
else
m_history[m_iHistorySize].szText[0] = (wchar_t)'\0';
}
@@ -312,20 +313,19 @@ void CContactCache::inputHistoryEvent(WPARAM wParam)
}
if (m_iHistoryCurrent == m_iHistoryTop) {
if (m_history[m_iHistorySize].szText != nullptr) { // replace the temp buffer
- ::SetWindowText(hwndEdit, L"");
- ::SendMessage(hwndEdit, EM_SETTEXTEX, (WPARAM)&stx, (LPARAM)m_history[m_iHistorySize].szText);
- ::SendMessage(hwndEdit, EM_SETSEL, -1, -1);
+ pEntry.SetText(L"");
+ pEntry.SendMsg(EM_SETTEXTEX, (WPARAM)&stx, (LPARAM)m_history[m_iHistorySize].szText);
+ pEntry.SendMsg(EM_SETSEL, -1, -1);
}
}
else {
+ pEntry.SetText(L"");
if (m_history[m_iHistoryCurrent].szText != nullptr) {
- ::SetWindowText(hwndEdit, L"");
- ::SendMessage(hwndEdit, EM_SETTEXTEX, (WPARAM)&stx, (LPARAM)m_history[m_iHistoryCurrent].szText);
- ::SendMessage(hwndEdit, EM_SETSEL, -1, -1);
+ pEntry.SendMsg(EM_SETTEXTEX, (WPARAM)&stx, (LPARAM)m_history[m_iHistoryCurrent].szText);
+ pEntry.SendMsg(EM_SETSEL, -1, -1);
}
- else ::SetWindowText(hwndEdit, L"");
}
- ::SendMessage(m_dat->GetHwnd(), WM_COMMAND, MAKEWPARAM(::GetDlgCtrlID(hwndEdit), EN_CHANGE), (LPARAM)hwndEdit);
+ pEntry.OnChange(&pEntry);
m_dat->m_dwFlags &= ~MWF_NEEDHISTORYSAVE;
}
}
diff --git a/plugins/TabSRMM/src/contactcache.h b/plugins/TabSRMM/src/contactcache.h
index 8dbe60e8d6..226c6d0a4e 100644
--- a/plugins/TabSRMM/src/contactcache.h
+++ b/plugins/TabSRMM/src/contactcache.h
@@ -116,7 +116,7 @@ struct CContactCache : public MZeroedObject
/*
* input history
*/
- void saveHistory(WPARAM wParam, LPARAM lParam);
+ void saveHistory(int iHistorySize = 0);
void inputHistoryEvent(WPARAM wParam);
static CContactCache* getContactCache(MCONTACT hContact);
diff --git a/plugins/TabSRMM/src/controls.cpp b/plugins/TabSRMM/src/controls.cpp
index b53bd9faf3..b780f28f2e 100644
--- a/plugins/TabSRMM/src/controls.cpp
+++ b/plugins/TabSRMM/src/controls.cpp
@@ -987,17 +987,12 @@ LONG_PTR CALLBACK CTabBaseDlg::StatusBarSubclassProc(HWND hWnd, UINT msg, WPARAM
}
SendMessage(hWnd, SB_GETRECT, 1, (LPARAM)&rc);
if (PtInRect(&rc, pt)) {
- int iLength = 0;
- GETTEXTLENGTHEX gtxl = { 0 };
int iQueued = db_get_dw(dat->m_hContact, "SendLater", "count", 0);
- gtxl.codepage = CP_UTF8;
- gtxl.flags = GTL_DEFAULT | GTL_PRECISE | GTL_NUMBYTES;
- iLength = SendDlgItemMessage(dat->GetHwnd(), IDC_SRMM_MESSAGE, EM_GETTEXTLENGTHEX, (WPARAM)&gtxl, 0);
tooltip_active = TRUE;
- const wchar_t *szFormat = TranslateT("There are %d pending send jobs. Message length: %d bytes, message length limit: %d bytes\n\n%d messages are queued for later delivery");
-
- mir_snwprintf(wBuf, szFormat, dat->m_iOpenJobs, iLength, dat->m_nMax ? dat->m_nMax : 20000, iQueued);
+ mir_snwprintf(wBuf,
+ TranslateT("There are %d pending send jobs. Message length: %d bytes, message length limit: %d bytes\n\n%d messages are queued for later delivery"),
+ dat->m_iOpenJobs, dat->m_message.GetRichTextLength(CP_UTF8), dat->m_nMax ? dat->m_nMax : 20000, iQueued);
CallService("mToolTip/ShowTipW", (WPARAM)wBuf, (LPARAM)&ti);
}
diff --git a/plugins/TabSRMM/src/generic_msghandlers.cpp b/plugins/TabSRMM/src/generic_msghandlers.cpp
index 0137a4ce52..7cc4f4c7ee 100644
--- a/plugins/TabSRMM/src/generic_msghandlers.cpp
+++ b/plugins/TabSRMM/src/generic_msghandlers.cpp
@@ -534,7 +534,7 @@ void CTabBaseDlg::DM_InitRichEdit()
char *szStreamOut = nullptr;
if (!fIsChat && GetWindowTextLength(m_message.GetHwnd()) > 0)
- szStreamOut = Message_GetFromStream(m_message.GetHwnd());
+ szStreamOut = m_message.GetRichTextRtf();
SetWindowText(m_message.GetHwnd(), L"");
m_log.SendMsg(EM_SETBKGNDCOLOR, 0, colour);
@@ -1475,7 +1475,7 @@ void CTabBaseDlg::DM_ErrorDetected(int type, int flag)
case MSGERROR_CANCEL:
case MSGERROR_SENDLATER:
if (m_dwFlags & MWF_ERRORSTATE) {
- m_cache->saveHistory(0, 0);
+ m_cache->saveHistory();
if (type == MSGERROR_SENDLATER)
sendQueue->doSendLater(m_iCurrentQueueError, this); // to be implemented at a later time
m_iOpenJobs--;
@@ -1497,7 +1497,7 @@ void CTabBaseDlg::DM_ErrorDetected(int type, int flag)
if (m_dwFlags & MWF_ERRORSTATE) {
int resent = 0;
- m_cache->saveHistory(0, 0);
+ m_cache->saveHistory();
if (m_iCurrentQueueError >= 0 && m_iCurrentQueueError < SendQueue::NR_SENDJOBS) {
SendJob *job = sendQueue->getJobByIndex(m_iCurrentQueueError);
if (job->iSendId == 0 && job->hContact == 0)
diff --git a/plugins/TabSRMM/src/msgdialog.cpp b/plugins/TabSRMM/src/msgdialog.cpp
index da9531b32f..512d30b786 100644
--- a/plugins/TabSRMM/src/msgdialog.cpp
+++ b/plugins/TabSRMM/src/msgdialog.cpp
@@ -891,7 +891,7 @@ void CSrmmWindow::OnDestroy()
Skin_LoadProtoIcon(m_cache->getActiveProto(), m_cache->getActiveStatus()), 1, PluginConfig.g_hMenuRecent);
if (m_hContact) {
if (!m_bEditNotesActive) {
- char *msg = Message_GetFromStream(m_message.GetHwnd(), SF_TEXT);
+ char *msg = m_message.GetRichTextRtf(true);
if (msg) {
db_set_utf(m_hContact, SRMSGMOD, "SavedMsg", msg);
mir_free(msg);
@@ -1095,7 +1095,7 @@ void CSrmmWindow::onClick_Ok(CCtrlButton*)
if (GetSendButtonState(m_hwnd) == PBS_DISABLED)
return;
- ptrA streamOut(Message_GetFromStream(m_message.GetHwnd(), final_sendformat ? 0 : SF_TEXT));
+ ptrA streamOut(m_message.GetRichTextRtf(!final_sendformat));
if (streamOut == nullptr)
return;
@@ -1142,7 +1142,7 @@ void CSrmmWindow::onClick_Ok(CCtrlButton*)
if (m_sendMode & SMODE_CONTAINER && m_pContainer->m_hwndActive == m_hwnd && GetForegroundWindow() == m_pContainer->m_hwnd) {
int tabCount = TabCtrl_GetItemCount(m_hwndParent);
- ptrA szFromStream(Message_GetFromStream(m_message.GetHwnd(), m_SendFormat ? 0 : SF_TEXT));
+ ptrA szFromStream(m_message.GetRichTextRtf(!m_SendFormat));
TCITEM tci = {};
tci.mask = TCIF_PARAM;
@@ -1264,7 +1264,7 @@ void CSrmmWindow::onClick_Quote(CCtrlButton*)
mir_free(szConverted);
}
else {
- ptrA szFromStream(Message_GetFromStream(m_log.GetHwnd(), SF_TEXT | SFF_SELECTION));
+ ptrA szFromStream(m_log.GetRichTextRtf(true, true));
ptrW converted(mir_utf8decodeW(szFromStream));
Utils::FilterEventMarkers(converted);
ptrW szQuoted(QuoteText(converted));
@@ -1812,15 +1812,10 @@ int CSrmmWindow::OnFilter(MSGFILTER *pFilter)
cr.cpMin = cr.cpMax;
if (isCtrl) {
SETTEXTEX stx = { ST_KEEPUNDO | ST_SELECTION, CP_UTF8 };
- char *streamOut = nullptr;
- if (isAlt)
- streamOut = Message_GetFromStream(m_log.GetHwnd(), SF_RTFNOOBJS | SFF_PLAINRTF | SFF_SELECTION);
- else
- streamOut = Message_GetFromStream(m_log.GetHwnd(), SF_TEXT | SFF_SELECTION);
+ ptrA streamOut(m_log.GetRichTextRtf(!isAlt, true));
if (streamOut) {
Utils::FilterEventMarkers(streamOut);
m_message.SendMsg(EM_SETTEXTEX, (WPARAM)&stx, (LPARAM)streamOut);
- mir_free(streamOut);
}
SetFocus(m_message.GetHwnd());
}
@@ -1870,7 +1865,7 @@ LRESULT CSrmmWindow::WndProc_Log(UINT msg, WPARAM wParam, LPARAM lParam)
case WM_CHAR:
KbdState(isShift, isCtrl, isAlt);
if (wParam == 0x03 && isCtrl) // Ctrl+C
- return Utils::WMCopyHandler(m_log.GetHwnd(), stubLogProc, msg, wParam, lParam);
+ return WMCopyHandler(msg, wParam, lParam);
if (wParam == 0x11 && isCtrl) // Ctrl+Q
m_btnQuote.OnClick(&m_btnQuote);
break;
@@ -1900,11 +1895,11 @@ LRESULT CSrmmWindow::WndProc_Log(UINT msg, WPARAM wParam, LPARAM lParam)
case WM_KEYDOWN:
KbdState(isShift, isCtrl, isAlt);
if (wParam == VK_INSERT && isCtrl)
- return Utils::WMCopyHandler(m_log.GetHwnd(), stubLogProc, msg, wParam, lParam);
+ return WMCopyHandler(msg, wParam, lParam);
break;
case WM_COPY:
- return Utils::WMCopyHandler(m_log.GetHwnd(), stubLogProc, msg, wParam, lParam);
+ return WMCopyHandler(msg, wParam, lParam);
case WM_NCCALCSIZE:
return CSkin::NcCalcRichEditFrame(m_log.GetHwnd(), this, ID_EXTBKHISTORY, msg, wParam, lParam, stubLogProc);
diff --git a/plugins/TabSRMM/src/msgdlgutils.cpp b/plugins/TabSRMM/src/msgdlgutils.cpp
index a00131b43c..a05ad3a6f1 100644
--- a/plugins/TabSRMM/src/msgdlgutils.cpp
+++ b/plugins/TabSRMM/src/msgdlgutils.cpp
@@ -786,29 +786,6 @@ void CTabBaseDlg::FlashOnClist(MEVENT hEvent, DBEVENTINFO *dbei)
}
/////////////////////////////////////////////////////////////////////////////////////////
-// retrieve contents of the richedit control by streaming.Used to get the
-// typed message before sending it.
-// caller must mir_free the returned pointer.
-// UNICODE version returns UTF-8 encoded string.
-
-char* TSAPI Message_GetFromStream(HWND hwndRtf, DWORD dwPassedFlags)
-{
- if (hwndRtf == 0)
- return nullptr;
-
- DWORD dwFlags = (CP_UTF8 << 16) | SF_USECODEPAGE;
- if (dwPassedFlags == 0)
- dwFlags |= (SF_RTFNOOBJS | SFF_PLAINRTF);
- else
- dwFlags |= dwPassedFlags;
-
- char *pszText = nullptr;
- EDITSTREAM stream = { 0 };
- stream.pfnCallback = Srmm_MessageStreamCallback;
- stream.dwCookie = (DWORD_PTR)&pszText; // pass pointer to pointer
- SendMessage(hwndRtf, EM_STREAMOUT, dwFlags, (LPARAM)&stream);
- return pszText; // pszText contains the text
-}
static wchar_t tszRtfBreaks[] = L" \\\n\r";
@@ -1703,6 +1680,27 @@ void CTabBaseDlg::KbdState(bool &isShift, bool &isControl, bool &isAlt)
}
/////////////////////////////////////////////////////////////////////////////////////////
+// generic handler for the WM_COPY message in message log/chat history richedit control(s).
+// it filters out the invisible event boundary markers from the text copied to the clipboard.
+// WINE Fix: overwrite clippboad data from original control data
+
+LRESULT CTabBaseDlg::WMCopyHandler(UINT msg, WPARAM wParam, LPARAM lParam)
+{
+ LRESULT result = mir_callNextSubclass(m_log.GetHwnd(), stubLogProc, msg, wParam, lParam);
+
+ ptrA szFromStream(m_log.GetRichTextRtf(true, true));
+ if (szFromStream != nullptr) {
+ ptrW converted(mir_utf8decodeW(szFromStream));
+ if (converted != nullptr) {
+ Utils::FilterEventMarkers(converted);
+ Utils::CopyToClipBoard(converted, m_log.GetHwnd());
+ }
+ }
+
+ return result;
+}
+
+/////////////////////////////////////////////////////////////////////////////////////////
// calculate the minimum required client height for the given message
// window layout
//
diff --git a/plugins/TabSRMM/src/msgdlgutils.h b/plugins/TabSRMM/src/msgdlgutils.h
index 452dc2502f..cd2362ca59 100644
--- a/plugins/TabSRMM/src/msgdlgutils.h
+++ b/plugins/TabSRMM/src/msgdlgutils.h
@@ -33,7 +33,6 @@
void TSAPI ProcessAvatarChange(HWND hwnd, LPARAM lParam);
int TSAPI CheckValidSmileyPack(const char *szProto, MCONTACT hContact);
wchar_t* TSAPI QuoteText(const wchar_t *text);
-char* TSAPI Message_GetFromStream(HWND hwndRtf, DWORD dwPassedFlags = 0);
UINT TSAPI GetIEViewMode(MCONTACT hContact);
void TSAPI LoadOverrideTheme(TContainerData *pContainer);
void TSAPI LoadThemeDefaults(TContainerData *pContainer);
diff --git a/plugins/TabSRMM/src/msgs.h b/plugins/TabSRMM/src/msgs.h
index 434f785275..a735db1f04 100644
--- a/plugins/TabSRMM/src/msgs.h
+++ b/plugins/TabSRMM/src/msgs.h
@@ -256,6 +256,7 @@ protected:
bool IsAutoSplitEnabled() const;
void ResizeIeView();
void ShowPopupMenu(const CCtrlBase&, POINT pt);
+ LRESULT WMCopyHandler(UINT uMsg, WPARAM wParam, LPARAM lParam);
public:
DWORD m_dwFlags;
@@ -370,6 +371,8 @@ public:
static LONG_PTR CALLBACK StatusBarSubclassProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam);
+ __forceinline CCtrlRichEdit& GetEntry() { return m_message; }
+
HWND DM_CreateClist();
void DM_EventAdded(WPARAM wParam, LPARAM lParam);
void DM_InitRichEdit();
diff --git a/plugins/TabSRMM/src/sendqueue.cpp b/plugins/TabSRMM/src/sendqueue.cpp
index 6e54e8d65e..8c7557a11f 100644
--- a/plugins/TabSRMM/src/sendqueue.cpp
+++ b/plugins/TabSRMM/src/sendqueue.cpp
@@ -103,7 +103,7 @@ entry_found:
HWND hwndDlg = dat->GetHwnd();
- dat->m_cache->saveHistory(0, 0);
+ dat->m_cache->saveHistory();
::SetDlgItemText(hwndDlg, IDC_SRMM_MESSAGE, L"");
::SetFocus(GetDlgItem(hwndDlg, IDC_SRMM_MESSAGE));
@@ -581,7 +581,7 @@ int SendQueue::doSendLater(int iJobIndex, CTabBaseDlg *dat, MCONTACT hContact, b
dat->StreamInEvents(0, 1, 1, &dbei);
if (dat->m_hDbEventFirst == 0)
SendMessage(dat->GetHwnd(), DM_REMAKELOG, 0, 0);
- dat->m_cache->saveHistory(0, 0);
+ dat->m_cache->saveHistory();
dat->EnableSendButton(false);
if (dat->m_pContainer->m_hwndActive == dat->GetHwnd())
dat->UpdateReadChars();
diff --git a/plugins/TabSRMM/src/utils.cpp b/plugins/TabSRMM/src/utils.cpp
index 1e66c60cc8..fe5302d2fd 100644
--- a/plugins/TabSRMM/src/utils.cpp
+++ b/plugins/TabSRMM/src/utils.cpp
@@ -976,27 +976,6 @@ size_t Utils::CopyToClipBoard(const wchar_t *str, const HWND hwndOwner)
}
/////////////////////////////////////////////////////////////////////////////////////////
-// generic handler for the WM_COPY message in message log/chat history richedit control(s).
-// it filters out the invisible event boundary markers from the text copied to the clipboard.
-// WINE Fix: overwrite clippboad data from original control data
-
-LRESULT Utils::WMCopyHandler(HWND hwnd, WNDPROC oldWndProc, UINT msg, WPARAM wParam, LPARAM lParam)
-{
- LRESULT result = mir_callNextSubclass(hwnd, oldWndProc, msg, wParam, lParam);
-
- ptrA szFromStream(Message_GetFromStream(hwnd, SF_TEXT | SFF_SELECTION));
- if (szFromStream != nullptr) {
- ptrW converted(mir_utf8decodeW(szFromStream));
- if (converted != nullptr) {
- Utils::FilterEventMarkers(converted);
- Utils::CopyToClipBoard(converted, hwnd);
- }
- }
-
- return result;
-}
-
-/////////////////////////////////////////////////////////////////////////////////////////
// file list handler
void Utils::AddToFileList(wchar_t ***pppFiles, int *totalCount, LPCTSTR szFilename)
diff --git a/plugins/TabSRMM/src/utils.h b/plugins/TabSRMM/src/utils.h
index 4af0af042a..f35963f505 100644
--- a/plugins/TabSRMM/src/utils.h
+++ b/plugins/TabSRMM/src/utils.h
@@ -88,7 +88,6 @@ public:
static LPTSTR extractURLFromRichEdit(const ENLINK* _e, const HWND hwndRich);
static size_t CopyToClipBoard(const wchar_t *str, const HWND hwndOwner);
- static LRESULT WMCopyHandler(HWND hwnd, WNDPROC oldWndProc, UINT uMsg, WPARAM wParam, LPARAM lParam);
static void AddToFileList(wchar_t ***pppFiles, int *totalCount, LPCTSTR szFilename);