From a142d261af1f740156898be29c3724b8a517a77a Mon Sep 17 00:00:00 2001 From: George Hazan Date: Mon, 23 Feb 2015 19:08:20 +0000 Subject: DoRtfToTags fixed & moved into the core git-svn-id: http://svn.miranda-ng.org/main/trunk@12252 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c --- plugins/Scriver/src/chat/window.cpp | 19 +++++++++++++------ 1 file changed, 13 insertions(+), 6 deletions(-) (limited to 'plugins/Scriver/src/chat/window.cpp') diff --git a/plugins/Scriver/src/chat/window.cpp b/plugins/Scriver/src/chat/window.cpp index a642d0719a..9e5bdf5861 100644 --- a/plugins/Scriver/src/chat/window.cpp +++ b/plugins/Scriver/src/chat/window.cpp @@ -1702,7 +1702,13 @@ LABEL_SHOWWINDOW: case IDOK: if (IsWindowEnabled(GetDlgItem(hwndDlg, IDOK))) { - char *pszRtf = GetRichTextRTF(GetDlgItem(hwndDlg, IDC_CHAT_MESSAGE)); + ptrA pszRtf(GetRichTextRTF(GetDlgItem(hwndDlg, IDC_CHAT_MESSAGE))); + if (pszRtf == NULL) + break; + + MODULEINFO *mi = pci->MM_FindModule(si->pszModule); + if (mi == NULL) + break; TCmdList *cmdListNew = tcmdlist_last(si->cmdList); while (cmdListNew != NULL && cmdListNew->temporary) { @@ -1711,10 +1717,13 @@ LABEL_SHOWWINDOW: } si->cmdList = tcmdlist_append(si->cmdList, pszRtf, 20, FALSE); - TCHAR *ptszText = DoRtfToTags(pszRtf, si); - rtrimt(ptszText); - if (pci->MM_FindModule(si->pszModule)->bAckMsg) { + CMString ptszText(ptrT(mir_utf8decodeT(pszRtf))); + pci->DoRtfToTags(ptszText, mi->nColorCount, mi->crColors); + ptszText.Trim(); + ptszText.Replace(_T("%"), _T("%%")); + + if (mi->bAckMsg) { EnableWindow(GetDlgItem(hwndDlg, IDC_CHAT_MESSAGE), FALSE); SendDlgItemMessage(hwndDlg, IDC_CHAT_MESSAGE, EM_SETREADONLY, TRUE, 0); } @@ -1723,8 +1732,6 @@ LABEL_SHOWWINDOW: EnableWindow(GetDlgItem(hwndDlg, IDOK), FALSE); pci->DoEventHookAsync(hwndDlg, si->ptszID, si->pszModule, GC_USER_MESSAGE, NULL, ptszText, 0); - mir_free(pszRtf); - mir_free(ptszText); SetFocus(GetDlgItem(hwndDlg, IDC_CHAT_MESSAGE)); } break; -- cgit v1.2.3