summaryrefslogtreecommitdiff
path: root/protocols
diff options
context:
space:
mode:
authorGeorge Hazan <ghazan@miranda.im>2020-03-17 22:52:32 +0300
committerGeorge Hazan <ghazan@miranda.im>2020-03-17 22:52:38 +0300
commite5158b1b3c71329732dd3625f2ec048c9316df7f (patch)
tree490d64fcaf1a4e967f263c50e09468cee25cbbcd /protocols
parent30d7018e0c6b31ad7a30add2cb127a084333eba5 (diff)
Jabber: fix for Chinese in error messages
Diffstat (limited to 'protocols')
-rw-r--r--protocols/JabberG/src/jabber_message_handlers.cpp16
-rwxr-xr-xprotocols/JabberG/src/jabber_util.cpp5
2 files changed, 11 insertions, 10 deletions
diff --git a/protocols/JabberG/src/jabber_message_handlers.cpp b/protocols/JabberG/src/jabber_message_handlers.cpp
index eb00c11636..f0002ddeac 100644
--- a/protocols/JabberG/src/jabber_message_handlers.cpp
+++ b/protocols/JabberG/src/jabber_message_handlers.cpp
@@ -38,14 +38,16 @@ bool CJabberProto::OnMessageError(const TiXmlElement *node, ThreadData*, CJabber
if (id != -1)
ProtoBroadcastAck(pInfo->GetHContact(), ACKTYPE_MESSAGE, ACKRESULT_FAILED, (HANDLE)id, (LPARAM)szErrText.c_str());
else {
- wchar_t buf[512];
- auto *body = XmlGetChildText(node, "body");
- if (body)
- mir_snwprintf(buf, L"%s:\n%s\n%s", pInfo->GetFrom(), body, szErrText.c_str());
- else
- mir_snwprintf(buf, L"%s:\n%s", pInfo->GetFrom(), szErrText.c_str());
+ CMStringW wszErrorText(Utf2T(pInfo->GetFrom()));
+ wszErrorText.Append(L":\n");
- MsgPopup(0, buf, TranslateT("Error"));
+ if (auto *body = XmlGetChildText(node, "body")) {
+ wszErrorText.Append(Utf2T(body));
+ wszErrorText.AppendChar('\n');
+ }
+
+ wszErrorText += szErrText;
+ MsgPopup(0, wszErrorText, TranslateT("Error"));
}
}
return true;
diff --git a/protocols/JabberG/src/jabber_util.cpp b/protocols/JabberG/src/jabber_util.cpp
index 6e69251042..ec09d029ec 100755
--- a/protocols/JabberG/src/jabber_util.cpp
+++ b/protocols/JabberG/src/jabber_util.cpp
@@ -284,10 +284,9 @@ CMStringW JabberErrorMsg(const TiXmlElement *errorNode, int *pErrorCode)
}
}
+ ret.Format(L"%s %d: %s", TranslateT("Error"), errorCode, TranslateW(JabberErrorStr(errorCode)));
if (str != nullptr)
- ret.Format(L"%s %d: %s\r\n%s", TranslateT("Error"), errorCode, TranslateW(JabberErrorStr(errorCode)), Utf2T(str).get());
- else
- ret.Format(L"%s %d: %s", TranslateT("Error"), errorCode, TranslateW(JabberErrorStr(errorCode)));
+ ret.AppendFormat(L"\r\n%s", Utf2T(str).get());
if (pErrorCode)
*pErrorCode = errorCode;