diff options
author | Alexander Gluzsky <sss123next@list.ru> | 2013-02-06 11:29:05 +0000 |
---|---|---|
committer | Alexander Gluzsky <sss123next@list.ru> | 2013-02-06 11:29:05 +0000 |
commit | 557320085b66813a1f6f525bf0730ed0006ec05c (patch) | |
tree | f60e457be9814eb071134b44f554a0c2c1bba0e3 /plugins/New_GPG/src/utilities.cpp | |
parent | 17e0fba79292d01fa529bb11962132ebe7df09f5 (diff) |
srmm friendly event handling (may cause problems need testing)
git-svn-id: http://svn.miranda-ng.org/main/trunk@3455 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'plugins/New_GPG/src/utilities.cpp')
-rwxr-xr-x | plugins/New_GPG/src/utilities.cpp | 25 |
1 files changed, 13 insertions, 12 deletions
diff --git a/plugins/New_GPG/src/utilities.cpp b/plugins/New_GPG/src/utilities.cpp index 49df88a301..558e7f6875 100755 --- a/plugins/New_GPG/src/utilities.cpp +++ b/plugins/New_GPG/src/utilities.cpp @@ -1314,11 +1314,11 @@ int SendBroadcast( HANDLE hContact, int type, int result, HANDLE hProcess, LPARA ACKDATA ack;
memset(&ack,0,sizeof(ack));
ack.cbSize = sizeof( ACKDATA );
- ack.szModule = szGPGModuleName;// GetContactProto(hContact);
+ ack.szModule = GetContactProto(hContact);//szGPGModuleName;
ack.hContact = hContact;
ack.type = type;
ack.result = result;
- ack.hProcess = hProcess;
+ ack.hProcess = (HANDLE)777;//hProcess;
ack.lParam = lParam;
return CallService( MS_PROTO_BROADCASTACK, 0, ( LPARAM )&ack );
}
@@ -1857,25 +1857,26 @@ INT_PTR ImportGpGKeys(WPARAM w, LPARAM l) }
if(found)
{
- wstring cmd;
- TCHAR tmp2[MAX_PATH] = {0};
+ wstring cmd, path;
TCHAR *ptmp;
string output;
DWORD exitcode;
{
HANDLE hcnt = hContact;
ptmp = UniGetContactSettingUtf(NULL, szGPGModuleName, "szHomePath", _T(""));
- _tcscpy(tmp2, ptmp);
+ path = ptmp;
mir_free(ptmp);
- _tcscat(tmp2, _T("\\"));
- _tcscat(tmp2, _T("temporary_exported.asc"));
- boost::filesystem::remove(tmp2);
- wfstream f(tmp2, std::ios::out);
+ mir_free(ptmp);
+ wstring rand = toUTF16(get_random(10));
+ path += L"\\";
+ path += rand;
+ boost::filesystem::remove(path);
+ wfstream f(path, std::ios::out);
f<<toUTF16(key).c_str();
f.close();
cmd += _T(" --batch ");
cmd += _T(" --import \"");
- cmd += tmp2;
+ cmd += path;
cmd += _T("\"");
}
gpg_execution_params params;
@@ -1903,7 +1904,7 @@ INT_PTR ImportGpGKeys(WPARAM w, LPARAM l) if(output.find("already in secret keyring") != string::npos)
{
MessageBox(0, TranslateT("Key already in scret key ring."), TranslateT("Info"), MB_OK);
- boost::filesystem::remove(tmp2);
+ boost::filesystem::remove(path);
break;
}
char *tmp2;
@@ -1971,7 +1972,7 @@ INT_PTR ImportGpGKeys(WPARAM w, LPARAM l) DBWriteContactSettingByte(hContact, szGPGModuleName, "GPGEncryption", 1);
DBWriteContactSettingTString(hContact, szGPGModuleName, "GPGPubKey", toUTF16(key).c_str());
}
- boost::filesystem::remove(tmp2);
+ boost::filesystem::remove(path);
break;
}
}
|