From a346491026d5df1ffe0d41e4881613a47ca6ca47 Mon Sep 17 00:00:00 2001 From: George Hazan Date: Sat, 20 Apr 2013 14:25:52 +0000 Subject: end of the city legend that PSS_MESSAGEW ever existed git-svn-id: http://svn.miranda-ng.org/main/trunk@4482 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c --- plugins/Scriver/src/msgdialog.cpp | 46 +++++++++++++++++++-------------------- 1 file changed, 22 insertions(+), 24 deletions(-) (limited to 'plugins/Scriver/src/msgdialog.cpp') diff --git a/plugins/Scriver/src/msgdialog.cpp b/plugins/Scriver/src/msgdialog.cpp index 0149cbd1a5..084a91145f 100644 --- a/plugins/Scriver/src/msgdialog.cpp +++ b/plugins/Scriver/src/msgdialog.cpp @@ -1579,13 +1579,12 @@ INT_PTR CALLBACK DlgProcMessage(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lP item->flags = msi->flags; item->codepage = dat->windowData.codePage; if ( IsUtfSendAvailable( dat->windowData.hContact )) { - char* szMsgUtf; - szMsgUtf = mir_utf8encodeW( (TCHAR *)&msi->sendBuffer[strlen(msi->sendBuffer) + 1] ); + char *szMsgUtf = mir_utf8encodeW( (TCHAR *)&msi->sendBuffer[strlen(msi->sendBuffer) + 1] ); item->flags &= ~PREF_UNICODE; if (!szMsgUtf) { break; } - if (*szMsgUtf == 0) { + if (*szMsgUtf == 0) { mir_free(szMsgUtf); break; } @@ -1726,24 +1725,23 @@ INT_PTR CALLBACK DlgProcMessage(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lP break; if (dat->windowData.hContact != NULL) { - GETTEXTEX gt = {0}; - PARAFORMAT2 pf2; - MessageSendQueueItem msi = { 0 }; - int bufSize; int ansiBufSize = GetRichTextLength(GetDlgItem(hwndDlg, IDC_MESSAGE), dat->windowData.codePage, TRUE) + 1; - bufSize = ansiBufSize; + int bufSize = ansiBufSize + GetRichTextLength(GetDlgItem(hwndDlg, IDC_MESSAGE), 1200, TRUE) + 2; + + PARAFORMAT2 pf2; ZeroMemory((void *)&pf2, sizeof(pf2)); pf2.cbSize = sizeof(pf2); pf2.dwMask = PFM_RTLPARA; SendDlgItemMessage(hwndDlg, IDC_MESSAGE, EM_GETPARAFORMAT, 0, (LPARAM)&pf2); + + MessageSendQueueItem msi = { 0 }; + msi.flags = PREF_TCHAR; if (pf2.wEffects & PFE_RTLPARA) msi.flags |= PREF_RTL; - bufSize += GetRichTextLength(GetDlgItem(hwndDlg, IDC_MESSAGE), 1200, TRUE) + 2; - msi.sendBufferSize = bufSize; msi.sendBuffer = (char *) mir_alloc(msi.sendBufferSize); - msi.flags |= PREF_TCHAR; + GETTEXTEX gt = {0}; gt.flags = GT_USECRLF; gt.cb = ansiBufSize; gt.codepage = dat->windowData.codePage; @@ -1758,20 +1756,20 @@ INT_PTR CALLBACK DlgProcMessage(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lP mir_free (msi.sendBuffer); break; } - { - /* Store messaging history */ - char *msgText = GetRichTextEncoded(GetDlgItem(hwndDlg, IDC_MESSAGE), dat->windowData.codePage); - TCmdList *cmdListNew = tcmdlist_last(dat->windowData.cmdList); - while (cmdListNew != NULL && cmdListNew->temporary) { - dat->windowData.cmdList = tcmdlist_remove(dat->windowData.cmdList, cmdListNew); - cmdListNew = tcmdlist_last(dat->windowData.cmdList); - } - if (msgText != NULL) { - dat->windowData.cmdList = tcmdlist_append(dat->windowData.cmdList, msgText, 20, FALSE); - mir_free(msgText); - } - dat->windowData.cmdListCurrent = NULL; + + /* Store messaging history */ + char *msgText = GetRichTextEncoded(GetDlgItem(hwndDlg, IDC_MESSAGE), dat->windowData.codePage); + TCmdList *cmdListNew = tcmdlist_last(dat->windowData.cmdList); + while (cmdListNew != NULL && cmdListNew->temporary) { + dat->windowData.cmdList = tcmdlist_remove(dat->windowData.cmdList, cmdListNew); + cmdListNew = tcmdlist_last(dat->windowData.cmdList); } + if (msgText != NULL) { + dat->windowData.cmdList = tcmdlist_append(dat->windowData.cmdList, msgText, 20, FALSE); + mir_free(msgText); + } + dat->windowData.cmdListCurrent = NULL; + if (dat->nTypeMode == PROTOTYPE_SELFTYPING_ON) NotifyTyping(dat, PROTOTYPE_SELFTYPING_OFF); -- cgit v1.2.3