summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGluzskiy Alexandr <sss123next@list.ru>2011-03-22 01:22:10 +0200
committerGluzskiy Alexandr <sss123next@list.ru>2011-03-22 01:22:10 +0200
commit31b78ae77e9dba2afbb2979c7b84631e03869398 (patch)
tree3c8a27ec67c8701038982af19984f17a83d72a9e
parented8a4f7a485a222ebdf30aa6fd2e7c2344ec27f0 (diff)
fixed toUTF8 fuction crash //thx iexploe
-rw-r--r--messages.cpp4
-rw-r--r--utilities.cpp12
-rw-r--r--utilities.h1
3 files changed, 3 insertions, 14 deletions
diff --git a/messages.cpp b/messages.cpp
index a0389a7..dbb87c2 100644
--- a/messages.cpp
+++ b/messages.cpp
@@ -245,7 +245,7 @@ int RecvMsgSvc(WPARAM w, LPARAM l)
}
mir_free(caps);
if(str.find(_T("GPG_Key_Auto_Exchange:0")) != string::npos)
- CallContactService(hContact, PSS_MESSAGE, (WPARAM)PREF_UTF, (LPARAM)"-----PGP KEY REQUEST-----");
+ CallContactService(hContact, PSS_MESSAGE, (WPARAM)0, (LPARAM)"-----PGP KEY REQUEST-----");
}
}
}
@@ -488,7 +488,7 @@ int RecvMsgSvc(WPARAM w, LPARAM l)
{
string str = pre->szMessage;
mir_free((void**)pre->szMessage);
- str.insert(0, "Failed to decrypt GPG encrypted message.\nReceived unencrypted message:\n");
+ str.insert(0, "Failed to decrypt GPG encrypted message.\nMessage body for manual decryption:\n");
debuglog<<time_str()<<": info: Failed to decrypt GPG encrypted message.\n";
pre->szMessage = mir_strdup(str.c_str());
return CallService(MS_PROTO_CHAINRECV, w, (LPARAM)ccs);
diff --git a/utilities.cpp b/utilities.cpp
index 82a30bf..0ba8e12 100644
--- a/utilities.cpp
+++ b/utilities.cpp
@@ -975,20 +975,10 @@ int returnNoError(HANDLE hContact) {
string toUTF8(wstring str)
{
string ustr;
- wstring tmpstr;
- utf8::replace_invalid(str.begin(), str.end(), back_inserter(tmpstr));
- utf8::utf16to8(tmpstr.begin(), tmpstr.end(), back_inserter(ustr));
+ utf8::utf16to8(str.begin(), str.end(), back_inserter(ustr));
return ustr;
}
-string toUTF8(string str)
-{
- string ustr;
- wstring tmpstr;
- utf8::replace_invalid(str.begin(), str.end(), back_inserter(tmpstr));
- utf8::utf16to8(tmpstr.begin(), tmpstr.end(), back_inserter(ustr));
- return ustr;
-}
wstring toUTF16(string str) //convert as much as possible
diff --git a/utilities.h b/utilities.h
index 58a23b9..bb4b459 100644
--- a/utilities.h
+++ b/utilities.h
@@ -32,7 +32,6 @@ bool isContactHaveKey(HANDLE hContact);
bool isGPGConfigured();
const bool StriStr(const char *str, const char *substr);
string toUTF8(wstring str);
-string toUTF8(string str);
wstring toUTF16(string str);
string get_random(int length);
string time_str();