From 7101bc5c14b738fb783dfd5a7f6f7d11762cbe2a Mon Sep 17 00:00:00 2001 From: George Hazan Date: Tue, 26 May 2015 22:32:12 +0000 Subject: - crazy hack for the srmm icons sort order fixed; - unused parameter removed git-svn-id: http://svn.miranda-ng.org/main/trunk@13854 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c --- plugins/TabSRMM/src/msgdialog.cpp | 55 ++++++++++++++++++--------------------- plugins/TabSRMM/src/msgs.h | 2 +- plugins/TabSRMM/src/sendqueue.cpp | 8 +++--- plugins/TabSRMM/src/sendqueue.h | 2 +- 4 files changed, 32 insertions(+), 35 deletions(-) diff --git a/plugins/TabSRMM/src/msgdialog.cpp b/plugins/TabSRMM/src/msgdialog.cpp index 6ff33acddf..559023dd4b 100644 --- a/plugins/TabSRMM/src/msgdialog.cpp +++ b/plugins/TabSRMM/src/msgdialog.cpp @@ -2664,40 +2664,37 @@ INT_PTR CALLBACK DlgProcMessage(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lP if (final_sendformat) DoRtfToTags(dat, decoded, SIZEOF(rtfDefColors), rtfDefColors); decoded.TrimRight(); - int bufSize = WideCharToMultiByte(dat->codePage, 0, decoded, -1, dat->sendBuffer, 0, 0, 0); + + T2Utf utfResult(decoded); + size_t memRequired = mir_strlen(utfResult) + 1; + + // try to detect RTL + HWND hwndEdit = GetDlgItem(hwndDlg, IDC_MESSAGE); + SendMessage(hwndEdit, WM_SETREDRAW, FALSE, 0); + + PARAFORMAT2 pf2; + memset(&pf2, 0, sizeof(PARAFORMAT2)); + pf2.cbSize = sizeof(pf2); + pf2.dwMask = PFM_RTLPARA; + SendMessage(hwndEdit, EM_SETSEL, 0, -1); + SendMessage(hwndEdit, EM_GETPARAFORMAT, 0, (LPARAM)&pf2); int flags = 0; - size_t memRequired; - { - T2Utf utfResult(decoded); - memRequired = mir_strlen(utfResult) + 1; - - // try to detect RTL - HWND hwndEdit = GetDlgItem(hwndDlg, IDC_MESSAGE); - SendMessage(hwndEdit, WM_SETREDRAW, FALSE, 0); - - PARAFORMAT2 pf2; - memset(&pf2, 0, sizeof(PARAFORMAT2)); - pf2.cbSize = sizeof(pf2); - pf2.dwMask = PFM_RTLPARA; - SendMessage(hwndEdit, EM_SETSEL, 0, -1); - SendMessage(hwndEdit, EM_GETPARAFORMAT, 0, (LPARAM)&pf2); - if (pf2.wEffects & PFE_RTLPARA) - if (SendQueue::RTL_Detect(decoded)) - flags |= PREF_RTL; - - SendMessage(hwndEdit, WM_SETREDRAW, TRUE, 0); - SendMessage(hwndEdit, EM_SETSEL, -1, -1); - InvalidateRect(hwndEdit, NULL, FALSE); - - if (memRequired > dat->iSendBufferSize) { - dat->sendBuffer = (char *)mir_realloc(dat->sendBuffer, memRequired); - dat->iSendBufferSize = memRequired; - } + if (pf2.wEffects & PFE_RTLPARA) + if (SendQueue::RTL_Detect(decoded)) + flags |= PREF_RTL; + + SendMessage(hwndEdit, WM_SETREDRAW, TRUE, 0); + SendMessage(hwndEdit, EM_SETSEL, -1, -1); + InvalidateRect(hwndEdit, NULL, FALSE); - memcpy(dat->sendBuffer, (char*)utfResult, memRequired); + if (memRequired > dat->iSendBufferSize) { + dat->sendBuffer = (char *)mir_realloc(dat->sendBuffer, memRequired); + dat->iSendBufferSize = memRequired; } + memcpy(dat->sendBuffer, (char*)utfResult, memRequired); + if (memRequired == 0 || dat->sendBuffer[0] == 0) break; diff --git a/plugins/TabSRMM/src/msgs.h b/plugins/TabSRMM/src/msgs.h index 8af86b04ac..b56df6d3c1 100644 --- a/plugins/TabSRMM/src/msgs.h +++ b/plugins/TabSRMM/src/msgs.h @@ -956,7 +956,7 @@ struct TABSRMM_SessionInfo { * encryption status bar indicator */ -#define MSG_ICON_MODULE "\x01TabSrmm" +#define MSG_ICON_MODULE " TabSrmm" #define MSG_ICON_SESSION 0 #define MSG_ICON_UTN 1 diff --git a/plugins/TabSRMM/src/sendqueue.cpp b/plugins/TabSRMM/src/sendqueue.cpp index 2795233135..82b37b01fd 100644 --- a/plugins/TabSRMM/src/sendqueue.cpp +++ b/plugins/TabSRMM/src/sendqueue.cpp @@ -207,7 +207,7 @@ static void DoSplitSendA(LPVOID param) ///////////////////////////////////////////////////////////////////////////////////////// // return effective length of the message in bytes (utf-8 encoded) -size_t SendQueue::getSendLength(const int iEntry, int sendMode) +size_t SendQueue::getSendLength(const int iEntry) { SendJob &p = m_jobs[iEntry]; p.iSendLength = mir_strlen(p.szSendBuffer); @@ -230,7 +230,7 @@ int SendQueue::sendQueued(TWindowData *dat, const int iEntry) m_jobs[iEntry].hContact = ccActive->getActiveContact(); m_jobs[iEntry].hOwnerWnd = hwndDlg; - size_t iSendLength = getSendLength(iEntry, dat->sendMode); + size_t iSendLength = getSendLength(iEntry); for (MCONTACT hContact = db_find_first(); hContact; hContact = db_find_next(hContact)) { HANDLE hItem = (HANDLE)SendDlgItemMessage(hwndDlg, IDC_CLIST, CLM_FINDCONTACT, hContact, 0); @@ -276,7 +276,7 @@ int SendQueue::sendQueued(TWindowData *dat, const int iEntry) if (M.GetByte("autosplit", 0) && !(dat->sendMode & SMODE_SENDLATER)) { // determine send buffer length BOOL fSplit = FALSE; - if (getSendLength(iEntry, dat->sendMode) >= dat->nMax) + if (getSendLength(iEntry) >= dat->nMax) fSplit = true; if (!fSplit) @@ -301,7 +301,7 @@ int SendQueue::sendQueued(TWindowData *dat, const int iEntry) if (dat->sendMode & SMODE_SENDLATER) { TCHAR tszError[256]; - size_t iSendLength = getSendLength(iEntry, dat->sendMode); + size_t iSendLength = getSendLength(iEntry); if (iSendLength >= dat->nMax) { mir_sntprintf(tszError, SIZEOF(tszError), TranslateT("The message cannot be sent delayed or to multiple contacts, because it exceeds the maximum allowed message length of %d bytes"), dat->nMax); SendMessage(dat->hwnd, DM_ACTIVATETOOLTIP, IDC_MESSAGE, LPARAM(tszError)); diff --git a/plugins/TabSRMM/src/sendqueue.h b/plugins/TabSRMM/src/sendqueue.h index 1cfab48128..af28046116 100644 --- a/plugins/TabSRMM/src/sendqueue.h +++ b/plugins/TabSRMM/src/sendqueue.h @@ -89,7 +89,7 @@ public: void handleError(TWindowData *dat, const int iEntry) const; int addTo(TWindowData *dat, size_t iLen, int dwFlags); int sendQueued(TWindowData *dat, const int iEntry); - size_t getSendLength(const int iEntry, const int sendMode); + size_t getSendLength(const int iEntry); void checkQueue(const TWindowData *dat) const; void logError(const TWindowData *dat, int iSendJobIndex, const TCHAR *szErrMsg) const; void recallFailed(const TWindowData *dat, int iEntry) const; -- cgit v1.2.3