summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--main.cpp6
-rw-r--r--utilities.cpp4
2 files changed, 7 insertions, 3 deletions
diff --git a/main.cpp b/main.cpp
index 7a189e2..ebe5ed8 100644
--- a/main.cpp
+++ b/main.cpp
@@ -1726,7 +1726,6 @@ void ImportKey()
if(metaIsProtoMetaContacts(hContact))
if(MessageBox(0, _T("Do you want load key for all subcontacts ?"), _T("Metacontact detected"), MB_YESNO) == IDYES)
for_all_sub = true;
-
if(metaIsProtoMetaContacts(hContact))
{
HANDLE hcnt = NULL;
@@ -1760,7 +1759,10 @@ void ImportKey()
_tcscat(tmp2, _T("temporary_exported.asc"));
DeleteFile(tmp2);
wfstream f(tmp2, std::ios::out);
- ptmp = UniGetContactSettingUtf(hContact, szGPGModuleName, "GPGPubKey", _T(""));
+ if(metaIsProtoMetaContacts(hContact))
+ ptmp = UniGetContactSettingUtf(metaGetCurrent(hContact), szGPGModuleName, "GPGPubKey", _T(""));
+ else
+ ptmp = UniGetContactSettingUtf(hContact, szGPGModuleName, "GPGPubKey", _T(""));
wstring new_key = ptmp;
mir_free(ptmp);
f<<new_key.c_str();
diff --git a/utilities.cpp b/utilities.cpp
index 4f594cb..66389f0 100644
--- a/utilities.cpp
+++ b/utilities.cpp
@@ -934,7 +934,9 @@ int returnNoError(HANDLE hContact) {
string toUTF8(wstring str)
{
string ustr;
- utf8::utf16to8(str.begin(), str.end(), back_inserter(ustr));
+ wstring tmpstr;
+ utf8::replace_invalid(str.begin(), str.end(), back_inserter(tmpstr));
+ utf8::utf16to8(tmpstr.begin(), tmpstr.end(), back_inserter(ustr));
return ustr;
}