summaryrefslogtreecommitdiff
path: root/plugins/Scriver/src/chat/window.cpp
diff options
context:
space:
mode:
authorGeorge Hazan <george.hazan@gmail.com>2015-02-23 19:08:20 +0000
committerGeorge Hazan <george.hazan@gmail.com>2015-02-23 19:08:20 +0000
commita142d261af1f740156898be29c3724b8a517a77a (patch)
tree11b676ec044683474ca15813f704a02f801ba927 /plugins/Scriver/src/chat/window.cpp
parent46bbde150e727df9a08eadf0c87454c40d364f3e (diff)
DoRtfToTags fixed & moved into the core
git-svn-id: http://svn.miranda-ng.org/main/trunk@12252 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'plugins/Scriver/src/chat/window.cpp')
-rw-r--r--plugins/Scriver/src/chat/window.cpp19
1 files changed, 13 insertions, 6 deletions
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;