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 --- plugins/Scriver/src/globals.cpp | 2 +- plugins/TabSRMM/src/sendqueue.cpp | 2 +- protocols/Discord/src/proto.cpp | 2 +- protocols/Dummy/src/dummy_proto.cpp | 5 +++-- protocols/EmLanProto/src/mlan.cpp | 2 +- protocols/FacebookRM/src/messages.cpp | 8 ++++---- protocols/IRCG/src/ircproto.cpp | 4 ++-- protocols/JabberG/src/jabber_message_handlers.cpp | 10 +++------- protocols/MRA/src/MraProto.cpp | 4 ++-- protocols/MSN/src/msn_errors.cpp | 3 +-- protocols/SkypeWeb/src/skype_messages.cpp | 8 +++----- protocols/Steam/src/steam_messages.cpp | 2 +- protocols/Steam/src/steam_proto.cpp | 2 +- protocols/Tox/src/tox_messages.cpp | 6 +++--- 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 +++--- src/mir_app/src/meta_services.cpp | 6 ++---- 19 files changed, 39 insertions(+), 47 deletions(-) diff --git a/plugins/Scriver/src/globals.cpp b/plugins/Scriver/src/globals.cpp index a878f8a2ae..9b1595f466 100644 --- a/plugins/Scriver/src/globals.cpp +++ b/plugins/Scriver/src/globals.cpp @@ -134,7 +134,7 @@ static int ackevent(WPARAM, LPARAM lParam) if (hwndSender != nullptr) { SendMessage(hwndSender, DM_STOPMESSAGESENDING, 0, 0); - CErrorDlg *pDlg = new CErrorDlg(_A2T((char *)pAck->lParam), hwndSender, item); + CErrorDlg *pDlg = new CErrorDlg((wchar_t*)pAck->lParam, hwndSender, item); SendMessage(hwndSender, DM_SHOWERRORMESSAGE, 0, (LPARAM)pDlg); } else RemoveSendQueueItem(item); diff --git a/plugins/TabSRMM/src/sendqueue.cpp b/plugins/TabSRMM/src/sendqueue.cpp index f45475448f..f97c96341a 100644 --- a/plugins/TabSRMM/src/sendqueue.cpp +++ b/plugins/TabSRMM/src/sendqueue.cpp @@ -444,7 +444,7 @@ int SendQueue::ackMessage(CTabBaseDlg *dat, WPARAM wParam, LPARAM lParam) if (!nen_options.iNoSounds && !(m_pContainer->dwFlags & CNT_NOSOUND)) Skin_PlaySound("SendError"); - mir_snwprintf(job.szErrorMsg, TranslateT("Delivery failure: %s"), _A2T((char *)ack->lParam)); + mir_snwprintf(job.szErrorMsg, TranslateT("Delivery failure: %s"), (wchar_t*)ack->lParam)); job.iStatus = SQ_ERROR; KillTimer(dat->GetHwnd(), TIMERID_MSGSEND + iFound); if (!(dat->m_dwFlags & MWF_ERRORSTATE)) diff --git a/protocols/Discord/src/proto.cpp b/protocols/Discord/src/proto.cpp index b9acdbf101..386f9c8844 100644 --- a/protocols/Discord/src/proto.cpp +++ b/protocols/Discord/src/proto.cpp @@ -368,7 +368,7 @@ MEVENT CDiscordProto::RecvMsg(MCONTACT hContact, PROTORECVEVENT *evt) void __cdecl CDiscordProto::SendMessageAckThread(void *param) { Sleep(100); - ProtoBroadcastAck((UINT_PTR)param, ACKTYPE_MESSAGE, ACKRESULT_FAILED, (HANDLE)1, (LPARAM)Translate("Protocol is offline or user isn't authorized yet")); + ProtoBroadcastAck((UINT_PTR)param, ACKTYPE_MESSAGE, ACKRESULT_FAILED, (HANDLE)1, (LPARAM)TranslateT("Protocol is offline or user isn't authorized yet")); } int CDiscordProto::SendMsg(MCONTACT hContact, int /*flags*/, const char *pszSrc) diff --git a/protocols/Dummy/src/dummy_proto.cpp b/protocols/Dummy/src/dummy_proto.cpp index d891531220..57b893f5e2 100644 --- a/protocols/Dummy/src/dummy_proto.cpp +++ b/protocols/Dummy/src/dummy_proto.cpp @@ -27,9 +27,10 @@ void CDummyProto::SendMsgAck(void *p) Sleep(100); if (getByte(DUMMY_KEY_ALLOW_SENDING, 0)) - ProtoBroadcastAck(data->hContact, ACKTYPE_MESSAGE, ACKRESULT_SUCCESS, (HANDLE)data->msgid, 0); + ProtoBroadcastAck(data->hContact, ACKTYPE_MESSAGE, ACKRESULT_SUCCESS, (HANDLE)data->msgid); else - ProtoBroadcastAck(data->hContact, ACKTYPE_MESSAGE, ACKRESULT_FAILED, (HANDLE)data->msgid, (LPARAM)Translate("This Dummy account has disabled sending messages. Enable it in account options.")); + ProtoBroadcastAck(data->hContact, ACKTYPE_MESSAGE, ACKRESULT_FAILED, (HANDLE)data->msgid, + (LPARAM)TranslateT("This Dummy account has disabled sending messages. Enable it in account options.")); delete data; } diff --git a/protocols/EmLanProto/src/mlan.cpp b/protocols/EmLanProto/src/mlan.cpp index 168600e4eb..3091a274ed 100644 --- a/protocols/EmLanProto/src/mlan.cpp +++ b/protocols/EmLanProto/src/mlan.cpp @@ -486,7 +486,7 @@ void CMLan::SendMessageExt(TDataHolder *hold) Sleep(0); if (db_get_w(hold->hContact, PROTONAME, "Status", ID_STATUS_OFFLINE) == ID_STATUS_OFFLINE) { Sleep(20); - ProtoBroadcastAck(PROTONAME, hold->hContact, (hold->op == LEXT_SENDURL) ? ACKTYPE_URL : ACKTYPE_MESSAGE, ACKRESULT_FAILED, (HANDLE)hold->id, 0); + ProtoBroadcastAck(PROTONAME, hold->hContact, (hold->op == LEXT_SENDURL) ? ACKTYPE_URL : ACKTYPE_MESSAGE, ACKRESULT_FAILED, (HANDLE)hold->id); } else { TPacket pak; diff --git a/protocols/FacebookRM/src/messages.cpp b/protocols/FacebookRM/src/messages.cpp index 015ec134f9..895628386d 100644 --- a/protocols/FacebookRM/src/messages.cpp +++ b/protocols/FacebookRM/src/messages.cpp @@ -39,9 +39,9 @@ void FacebookProto::SendMsgWorker(void *p) ptrA id(getStringA(data->hContact, FACEBOOK_KEY_ID)); if (!isOnline()) - ProtoBroadcastAck(data->hContact, ACKTYPE_MESSAGE, ACKRESULT_FAILED, (HANDLE)data->msgid, (LPARAM)Translate("You cannot send messages when you are offline.")); + ProtoBroadcastAck(data->hContact, ACKTYPE_MESSAGE, ACKRESULT_FAILED, (HANDLE)data->msgid, (LPARAM)TranslateT("You cannot send messages when you are offline.")); else if (id == nullptr) - ProtoBroadcastAck(data->hContact, ACKTYPE_MESSAGE, ACKRESULT_FAILED, (HANDLE)data->msgid, 0); + ProtoBroadcastAck(data->hContact, ACKTYPE_MESSAGE, ACKRESULT_FAILED, (HANDLE)data->msgid); else { int tries = getByte(FACEBOOK_KEY_SEND_MESSAGE_TRIES, 1); tries = min(max(tries, 1), 5); @@ -52,12 +52,12 @@ void FacebookProto::SendMsgWorker(void *p) result = facy.send_message(data->msgid, data->hContact, data->msg, &error_text); if (result == SEND_MESSAGE_OK) { - ProtoBroadcastAck(data->hContact, ACKTYPE_MESSAGE, ACKRESULT_SUCCESS, (HANDLE)data->msgid, 0); + ProtoBroadcastAck(data->hContact, ACKTYPE_MESSAGE, ACKRESULT_SUCCESS, (HANDLE)data->msgid); // Remove from "readers" list and clear statusbar facy.erase_reader(data->hContact); } - else ProtoBroadcastAck(data->hContact, ACKTYPE_MESSAGE, ACKRESULT_FAILED, (HANDLE)data->msgid, (LPARAM)error_text.c_str()); + else ProtoBroadcastAck(data->hContact, ACKTYPE_MESSAGE, ACKRESULT_FAILED, (HANDLE)data->msgid, (LPARAM)_A2T(error_text.c_str())); } delete data; diff --git a/protocols/IRCG/src/ircproto.cpp b/protocols/IRCG/src/ircproto.cpp index 7bb0a1c882..9c45c532ee 100644 --- a/protocols/IRCG/src/ircproto.cpp +++ b/protocols/IRCG/src/ircproto.cpp @@ -647,13 +647,13 @@ struct TFakeAckParam void __cdecl CIrcProto::AckMessageFail(void *info) { Thread_SetName("IRC: AckMessageFail"); - ProtoBroadcastAck((UINT_PTR)info, ACKTYPE_MESSAGE, ACKRESULT_FAILED, nullptr, (LPARAM)Translate("The protocol is not online")); + ProtoBroadcastAck((UINT_PTR)info, ACKTYPE_MESSAGE, ACKRESULT_FAILED, nullptr, (LPARAM)TranslateT("The protocol is not online")); } void __cdecl CIrcProto::AckMessageFailDcc(void *info) { Thread_SetName("IRC: AckMessageFailDcc"); - ProtoBroadcastAck((UINT_PTR)info, ACKTYPE_MESSAGE, ACKRESULT_FAILED, nullptr, (LPARAM)Translate("The dcc chat connection is not active")); + ProtoBroadcastAck((UINT_PTR)info, ACKTYPE_MESSAGE, ACKRESULT_FAILED, nullptr, (LPARAM)TranslateT("The dcc chat connection is not active")); } void __cdecl CIrcProto::AckMessageSuccess(void *info) diff --git a/protocols/JabberG/src/jabber_message_handlers.cpp b/protocols/JabberG/src/jabber_message_handlers.cpp index c8732e273b..d9f7c0fd9f 100644 --- a/protocols/JabberG/src/jabber_message_handlers.cpp +++ b/protocols/JabberG/src/jabber_message_handlers.cpp @@ -34,12 +34,9 @@ BOOL CJabberProto::OnMessageError(HXML node, ThreadData*, CJabberMessageInfo* pI if (item == nullptr) item = ListGetItemPtr(LIST_CHATROOM, pInfo->GetFrom()); if (item != nullptr) { // yes, it is - wchar_t *szErrText = JabberErrorMsg(pInfo->GetChildNode()); - if (id != -1) { - char *errText = mir_u2a(szErrText); - ProtoBroadcastAck(pInfo->GetHContact(), ACKTYPE_MESSAGE, ACKRESULT_FAILED, (HANDLE)id, (LPARAM)errText); - mir_free(errText); - } + ptrW szErrText(JabberErrorMsg(pInfo->GetChildNode())); + if (id != -1) + ProtoBroadcastAck(pInfo->GetHContact(), ACKTYPE_MESSAGE, ACKRESULT_FAILED, (HANDLE)id, szErrText); else { wchar_t buf[512]; HXML bodyNode = XmlGetChild(node, "body"); @@ -50,7 +47,6 @@ BOOL CJabberProto::OnMessageError(HXML node, ThreadData*, CJabberMessageInfo* pI MsgPopup(0, buf, TranslateT("Jabber Error")); } - mir_free(szErrText); } return TRUE; } diff --git a/protocols/MRA/src/MraProto.cpp b/protocols/MRA/src/MraProto.cpp index 5988573c33..d5335f9066 100644 --- a/protocols/MRA/src/MraProto.cpp +++ b/protocols/MRA/src/MraProto.cpp @@ -371,14 +371,14 @@ HANDLE CMraProto::SendFile(MCONTACT hContact, const wchar_t*, wchar_t **ppszFile int CMraProto::SendMsg(MCONTACT hContact, int, const char *lpszMessage) { if (!m_bLoggedIn) { - ProtoBroadcastAck(hContact, ACKTYPE_MESSAGE, ACKRESULT_FAILED, nullptr, (LPARAM)"You cannot send when you are offline."); + ProtoBroadcastAck(hContact, ACKTYPE_MESSAGE, ACKRESULT_FAILED, nullptr, (LPARAM)TranslateT("You cannot send when you are offline.")); return 0; } DWORD dwFlags = 0; CMStringW wszMessage(ptrW(mir_utf8decodeW(lpszMessage))); if (wszMessage.IsEmpty()) { - ProtoBroadcastAck(hContact, ACKTYPE_MESSAGE, ACKRESULT_FAILED, nullptr, (LPARAM)"Cant allocate buffer for convert to unicode."); + ProtoBroadcastAck(hContact, ACKTYPE_MESSAGE, ACKRESULT_FAILED, nullptr, (LPARAM)TranslateT("Cant allocate buffer for convert to unicode.")); return 0; } diff --git a/protocols/MSN/src/msn_errors.cpp b/protocols/MSN/src/msn_errors.cpp index 9b87373684..4bcec90205 100644 --- a/protocols/MSN/src/msn_errors.cpp +++ b/protocols/MSN/src/msn_errors.cpp @@ -96,8 +96,7 @@ int CMsnProto::MSN_HandleErrors(ThreadData* info, char* cmdString) case ERR_NOT_ONLINE: if (info->mInitialContactWLID) - ProtoBroadcastAck(MSN_HContactFromEmail(info->mInitialContactWLID), ACKTYPE_MESSAGE, ACKRESULT_FAILED, - (HANDLE)999999, (LPARAM)Translate("User not online")); + ProtoBroadcastAck(MSN_HContactFromEmail(info->mInitialContactWLID), ACKTYPE_MESSAGE, ACKRESULT_FAILED, (HANDLE)999999, (LPARAM)TranslateT("User not online")); else MSN_ShowError("User not online"); diff --git a/protocols/SkypeWeb/src/skype_messages.cpp b/protocols/SkypeWeb/src/skype_messages.cpp index b5df2ffea4..7daad29062 100644 --- a/protocols/SkypeWeb/src/skype_messages.cpp +++ b/protocols/SkypeWeb/src/skype_messages.cpp @@ -48,7 +48,7 @@ struct SendMessageParam int CSkypeProto::OnSendMessage(MCONTACT hContact, int, const char *szMessage) { if (!IsOnline()) { - ProtoBroadcastAck(hContact, ACKTYPE_MESSAGE, ACKRESULT_FAILED, NULL, (LPARAM)Translate("You cannot send when you are offline.")); + ProtoBroadcastAck(hContact, ACKTYPE_MESSAGE, ACKRESULT_FAILED, NULL, (LPARAM)TranslateT("You cannot send when you are offline.")); return 0; } @@ -105,12 +105,10 @@ void CSkypeProto::OnMessageSent(const NETLIBHTTPREQUEST *response, void *arg) } } - ProtoBroadcastAck(hContact, ACKTYPE_MESSAGE, ACKRESULT_FAILED, hMessage, (LPARAM)strError.c_str()); + ProtoBroadcastAck(hContact, ACKTYPE_MESSAGE, ACKRESULT_FAILED, hMessage, _A2T(strError.c_str())); } } - else { - ProtoBroadcastAck(hContact, ACKTYPE_MESSAGE, ACKRESULT_FAILED, hMessage, (LPARAM)(Translate("Network error!"))); - } + else ProtoBroadcastAck(hContact, ACKTYPE_MESSAGE, ACKRESULT_FAILED, hMessage, (LPARAM)TranslateT("Network error!")); } // preparing message/action to writing into db diff --git a/protocols/Steam/src/steam_messages.cpp b/protocols/Steam/src/steam_messages.cpp index e4d90643be..f2111e03aa 100644 --- a/protocols/Steam/src/steam_messages.cpp +++ b/protocols/Steam/src/steam_messages.cpp @@ -52,7 +52,7 @@ void CSteamProto::OnMessageSent(const HttpResponse &response, void *arg) if (mir_strcmpi(error.c_str(), "OK") != 0) { debugLogA(__FUNCTION__ ": failed to send message for %s (%s)", steamId, error.c_str()); - ProtoBroadcastAck(param->hContact, ACKTYPE_MESSAGE, ACKRESULT_FAILED, param->hMessage, (LPARAM)error.c_str()); + ProtoBroadcastAck(param->hContact, ACKTYPE_MESSAGE, ACKRESULT_FAILED, param->hMessage, _A2T(error.c_str())); } else { diff --git a/protocols/Steam/src/steam_proto.cpp b/protocols/Steam/src/steam_proto.cpp index e1e115af3f..4988470c66 100644 --- a/protocols/Steam/src/steam_proto.cpp +++ b/protocols/Steam/src/steam_proto.cpp @@ -244,7 +244,7 @@ HANDLE CSteamProto::SearchByName(const wchar_t* nick, const wchar_t* firstName, int CSteamProto::SendMsg(MCONTACT hContact, int, const char *message) { if (!IsOnline()) { - ProtoBroadcastAck(hContact, ACKTYPE_MESSAGE, ACKRESULT_FAILED, nullptr, (LPARAM)Translate("You cannot send messages when you are offline.")); + ProtoBroadcastAck(hContact, ACKTYPE_MESSAGE, ACKRESULT_FAILED, nullptr, (LPARAM)TranslateT("You cannot send messages when you are offline.")); return 0; } diff --git a/protocols/Tox/src/tox_messages.cpp b/protocols/Tox/src/tox_messages.cpp index 7d53d4b19e..ef75bfaf38 100644 --- a/protocols/Tox/src/tox_messages.cpp +++ b/protocols/Tox/src/tox_messages.cpp @@ -85,7 +85,7 @@ void CToxProto::SendMessageAsync(void *arg) int32_t friendNumber = GetToxFriendNumber(param->hContact); if (friendNumber == UINT32_MAX) - ProtoBroadcastAck(param->hContact, ACKTYPE_MESSAGE, ACKRESULT_FAILED, (HANDLE)param->hMessage, (LPARAM)_T2A(ToxErrorToString(TOX_ERR_FRIEND_SEND_MESSAGE_FRIEND_NOT_FOUND))); + ProtoBroadcastAck(param->hContact, ACKTYPE_MESSAGE, ACKRESULT_FAILED, (HANDLE)param->hMessage, (LPARAM)ToxErrorToString(TOX_ERR_FRIEND_SEND_MESSAGE_FRIEND_NOT_FOUND)); size_t msgLen = mir_strlen(param->message); uint8_t *msg = (uint8_t*)param->message; @@ -99,7 +99,7 @@ void CToxProto::SendMessageAsync(void *arg) int messageNumber = tox_friend_send_message(m_tox, friendNumber, type, msg, msgLen, &sendError); if (sendError != TOX_ERR_FRIEND_SEND_MESSAGE_OK) { debugLogA(__FUNCTION__": failed to send message for %d (%d)", friendNumber, sendError); - ProtoBroadcastAck(param->hContact, ACKTYPE_MESSAGE, ACKRESULT_FAILED, (HANDLE)param->hMessage, (LPARAM)_T2A(ToxErrorToString(sendError))); + ProtoBroadcastAck(param->hContact, ACKTYPE_MESSAGE, ACKRESULT_FAILED, (HANDLE)param->hMessage, (LPARAM)ToxErrorToString(sendError)); } uint64_t messageId = (((int64_t)friendNumber) << 32) | ((int64_t)messageNumber); messages[messageId] = param->hMessage; @@ -111,7 +111,7 @@ void CToxProto::SendMessageAsync(void *arg) int CToxProto::OnSendMessage(MCONTACT hContact, const char *szMessage) { if (!IsOnline()) { - ProtoBroadcastAck(hContact, ACKTYPE_MESSAGE, ACKRESULT_FAILED, nullptr, (LPARAM)Translate("You cannot send when you are offline.")); + ProtoBroadcastAck(hContact, ACKTYPE_MESSAGE, ACKRESULT_FAILED, nullptr, (LPARAM)TranslateT("You cannot send when you are offline.")); return 0; } 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); diff --git a/src/mir_app/src/meta_services.cpp b/src/mir_app/src/meta_services.cpp index d5da2e557c..8e00dc8fe8 100644 --- a/src/mir_app/src/meta_services.cpp +++ b/src/mir_app/src/meta_services.cpp @@ -185,7 +185,6 @@ struct TFakeAckParams HANDLE hEvent; MCONTACT hContact; LONG id; - char msg[512]; }; static void __cdecl sttFakeAckFail(TFakeAckParams *tParam) @@ -193,7 +192,7 @@ static void __cdecl sttFakeAckFail(TFakeAckParams *tParam) WaitForSingleObject(tParam->hEvent, INFINITE); Sleep(100); - ProtoBroadcastAck(META_PROTO, tParam->hContact, ACKTYPE_MESSAGE, ACKRESULT_FAILED, (HANDLE)tParam->id, (WPARAM)tParam->msg); + ProtoBroadcastAck(META_PROTO, tParam->hContact, ACKTYPE_MESSAGE, ACKRESULT_FAILED, (HANDLE)tParam->id, (WPARAM)TranslateT("No online contacts found.")); CloseHandle(tParam->hEvent); mir_free(tParam); @@ -240,9 +239,8 @@ INT_PTR Meta_SendMessage(WPARAM wParam, LPARAM lParam) tfap->hContact = ccs->hContact; tfap->hEvent = hEvent; tfap->id = 10; - strncpy(tfap->msg, Translate("No online contacts found."), _countof(tfap->msg) - 1); - mir_forkThread(sttFakeAckFail, tfap); + SetEvent(hEvent); return 10; } -- cgit v1.2.3