From 6071fb87a02cd13fd68671086194a5757204f70d Mon Sep 17 00:00:00 2001 From: George Hazan Date: Fri, 21 Sep 2018 17:55:32 +0300 Subject: old crutch removed: error messages to go in Unicode --- src/core/stdmsg/src/cmdlist.cpp | 10 +++++----- src/core/stdmsg/src/cmdlist.h | 2 +- src/core/stdmsg/src/globals.cpp | 2 +- src/core/stdmsg/src/msgtimedout.cpp | 6 +++--- 4 files changed, 10 insertions(+), 10 deletions(-) (limited to 'src/core') diff --git a/src/core/stdmsg/src/cmdlist.cpp b/src/core/stdmsg/src/cmdlist.cpp index b15cc9b8ef..a8fc3446ae 100644 --- a/src/core/stdmsg/src/cmdlist.cpp +++ b/src/core/stdmsg/src/cmdlist.cpp @@ -25,7 +25,7 @@ static LIST msgQueue(5, NumericKeySortT); static mir_cs csMsgQueue; static UINT_PTR timerId; -void MessageFailureProcess(TMsgQueue *item, const char* err); +void MessageFailureProcess(TMsgQueue *item, const wchar_t *err); static VOID CALLBACK MsgTimer(HWND, UINT, UINT_PTR, DWORD dwTime) { @@ -41,7 +41,7 @@ static VOID CALLBACK MsgTimer(HWND, UINT, UINT_PTR, DWORD dwTime) } for (auto &it : arTimedOut) - MessageFailureProcess(it, LPGEN("The message send timed out.")); + MessageFailureProcess(it, TranslateT("The message send timed out.")); } void msgQueue_add(MCONTACT hContact, int id, char *szMsg, int flags) @@ -77,14 +77,14 @@ TMsgQueue* msgQueue_find(MCONTACT hContact, int id) return nullptr; } -void msgQueue_processack(MCONTACT hContact, int id, BOOL success, const char *lParam) +void msgQueue_processack(MCONTACT hContact, int id, BOOL success, LPARAM lParam) { TMsgQueue *p = msgQueue_find(hContact, id); if (p == nullptr) return; if (!success) { - MessageFailureProcess(p, lParam); + MessageFailureProcess(p, (wchar_t*)lParam); return; } @@ -99,7 +99,7 @@ void msgQueue_processack(MCONTACT hContact, int id, BOOL success, const char *lP MessageWindowEvent evt = { id, hContact, &dbei }; MEVENT hNewEvent = NotifyEventHooks(g_chatApi.hevPreCreate, 0, (LPARAM)&evt); if (hNewEvent && lParam) - db_event_setId(dbei.szModule, hNewEvent, lParam); + db_event_setId(dbei.szModule, hNewEvent, (char*)lParam); p->szMsg = (char*)dbei.pBlob; diff --git a/src/core/stdmsg/src/cmdlist.h b/src/core/stdmsg/src/cmdlist.h index 4d5f1e38d5..ae77352fd7 100644 --- a/src/core/stdmsg/src/cmdlist.h +++ b/src/core/stdmsg/src/cmdlist.h @@ -32,7 +32,7 @@ struct TMsgQueue }; void msgQueue_add(MCONTACT hContact, int id, char *szMsg, int flags); -void msgQueue_processack(MCONTACT hContact, int id, BOOL success, const char* szErr); +void msgQueue_processack(MCONTACT hContact, int id, BOOL success, LPARAM szErr); void msgQueue_destroy(void); #endif diff --git a/src/core/stdmsg/src/globals.cpp b/src/core/stdmsg/src/globals.cpp index 43e116e720..8c53924a1a 100644 --- a/src/core/stdmsg/src/globals.cpp +++ b/src/core/stdmsg/src/globals.cpp @@ -79,7 +79,7 @@ static int ackevent(WPARAM, LPARAM lParam) { ACKDATA *pAck = (ACKDATA *)lParam; if (pAck && pAck->type == ACKTYPE_MESSAGE) { - msgQueue_processack(pAck->hContact, (INT_PTR)pAck->hProcess, pAck->result == ACKRESULT_SUCCESS, (char*)pAck->lParam); + msgQueue_processack(pAck->hContact, (INT_PTR)pAck->hProcess, pAck->result == ACKRESULT_SUCCESS, pAck->lParam); if (pAck->result == ACKRESULT_SUCCESS) Skin_PlaySound("SendMsg"); diff --git a/src/core/stdmsg/src/msgtimedout.cpp b/src/core/stdmsg/src/msgtimedout.cpp index 6175957d49..4d62a17b84 100644 --- a/src/core/stdmsg/src/msgtimedout.cpp +++ b/src/core/stdmsg/src/msgtimedout.cpp @@ -24,7 +24,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. struct ErrorDlgParam { - const char *szMsg; + const wchar_t *szMsg; TMsgQueue *item; }; @@ -44,7 +44,7 @@ INT_PTR CALLBACK ErrorDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lPar if (!param->szMsg || !param->szMsg[0]) SetDlgItemText(hwndDlg, IDC_ERRORTEXT, TranslateT("An unknown error has occurred.")); else - SetDlgItemText(hwndDlg, IDC_ERRORTEXT, ptrW(Langpack_PcharToTchar(param->szMsg))); + SetDlgItemText(hwndDlg, IDC_ERRORTEXT, param->szMsg); SetDlgItemText(hwndDlg, IDC_MSGTEXT, ptrW(mir_utf8decodeW(item->szMsg))); @@ -81,7 +81,7 @@ INT_PTR CALLBACK ErrorDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lPar return FALSE; } -void MessageFailureProcess(TMsgQueue *item, const char* err) +void MessageFailureProcess(TMsgQueue *item, const wchar_t *err) { MCONTACT hContact = db_mc_tryMeta(item->hContact); -- cgit v1.2.3