summaryrefslogtreecommitdiff
path: root/protocols
diff options
context:
space:
mode:
authorGeorge Hazan <ghazan@miranda.im>2018-09-21 17:55:32 +0300
committerGeorge Hazan <ghazan@miranda.im>2018-09-21 17:55:32 +0300
commit6071fb87a02cd13fd68671086194a5757204f70d (patch)
tree844c880927a7acbf3f26a8baa4515aa778bd0cb6 /protocols
parent4dd0f6f3dbd938c48c9eee40bcb4b4b6943f9810 (diff)
old crutch removed: error messages to go in Unicode
Diffstat (limited to 'protocols')
-rw-r--r--protocols/Discord/src/proto.cpp2
-rw-r--r--protocols/Dummy/src/dummy_proto.cpp5
-rw-r--r--protocols/EmLanProto/src/mlan.cpp2
-rw-r--r--protocols/FacebookRM/src/messages.cpp8
-rw-r--r--protocols/IRCG/src/ircproto.cpp4
-rw-r--r--protocols/JabberG/src/jabber_message_handlers.cpp10
-rw-r--r--protocols/MRA/src/MraProto.cpp4
-rw-r--r--protocols/MSN/src/msn_errors.cpp3
-rw-r--r--protocols/SkypeWeb/src/skype_messages.cpp8
-rw-r--r--protocols/Steam/src/steam_messages.cpp2
-rw-r--r--protocols/Steam/src/steam_proto.cpp2
-rw-r--r--protocols/Tox/src/tox_messages.cpp6
12 files changed, 25 insertions, 31 deletions
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;
}