From 8174eb73282e177112615c2dd332b69401959764 Mon Sep 17 00:00:00 2001 From: Gluzskiy Alexandr Date: Wed, 30 Mar 2011 08:51:28 +0300 Subject: one more threading variant (without mutexes) --- main.cpp | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) (limited to 'main.cpp') diff --git a/main.cpp b/main.cpp index f35ff70..ad091f6 100644 --- a/main.cpp +++ b/main.cpp @@ -876,7 +876,6 @@ static BOOL CALLBACK DlgProcGpgBinOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LP gpg_configured = false; if(result == pxNotFound) break; - DeleteFile(path.c_str()); string::size_type p1 = 0; if((p1 = out.find("key ")) != string::npos) @@ -1221,10 +1220,7 @@ static BOOL CALLBACK DlgProcKeyGenDialog(HWND hwndDlg, UINT msg, WPARAM wParam, break; } if(result == pxNotFound) - { - MessageBox(0, _T("Set path to gpg.exe first!"), _T("Warning"), MB_OK); break; - } } DeleteFile(path.c_str()); DestroyWindow(hwndDlg); @@ -1753,6 +1749,11 @@ void InitCheck() if(result == pxNotFound) return; } + TCHAR *home_dir = UniGetContactSettingUtf(NULL, szGPGModuleName, "szHomePath", _T("")); + wstring tmp_dir = home_dir; + mir_free(home_dir); + tmp_dir += _T("\\tmp"); + _wmkdir(tmp_dir.c_str()); string question = "Your secret key whith id: "; char *keyid = UniGetContactSettingUtf(NULL, szGPGModuleName, "KeyID", ""); question += keyid; -- cgit v1.2.3 From 903cf85316f641a2d7fcc7fb87ed75889469d2dc Mon Sep 17 00:00:00 2001 From: Gluzskiy Alexandr Date: Wed, 30 Mar 2011 09:36:35 +0300 Subject: some agression ) --- main.cpp | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) (limited to 'main.cpp') diff --git a/main.cpp b/main.cpp index ad091f6..3f8b70c 100644 --- a/main.cpp +++ b/main.cpp @@ -94,6 +94,7 @@ static BOOL CALLBACK DlgProcFirstRun(HWND hwndDlg,UINT msg,WPARAM wParam,LPARAM if(!gpg_thread.timed_join(boost::posix_time::seconds(10))) { gpg_thread.~thread(); + TerminateProcess(params.hProcess, 1); debuglog<timed_join(boost::posix_time::seconds(10))) { delete gpg_thread; + TerminateProcess(params.hProcess, 1); debuglog<timed_join(boost::posix_time::seconds(10))) { delete gpg_thread; + TerminateProcess(params.hProcess, 1); debuglog< Date: Fri, 1 Apr 2011 02:20:17 +0300 Subject: hm )) --- main.cpp | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) (limited to 'main.cpp') diff --git a/main.cpp b/main.cpp index 3f8b70c..cccb846 100644 --- a/main.cpp +++ b/main.cpp @@ -1839,7 +1839,7 @@ void ImportKey() } } else - DBWriteContactSettingTString(metaGetCurrent(hContact), szGPGModuleName, "GPGPubKey", new_key.c_str()); + DBWriteContactSettingTString(metaGetMostOnline(hContact), szGPGModuleName, "GPGPubKey", new_key.c_str()); } else DBWriteContactSettingTString(hContact, szGPGModuleName, "GPGPubKey", new_key.c_str()); @@ -1859,7 +1859,7 @@ void ImportKey() DeleteFile(tmp2); wfstream f(tmp2, std::ios::out); if(metaIsProtoMetaContacts(hContact)) - ptmp = UniGetContactSettingUtf(metaGetCurrent(hContact), szGPGModuleName, "GPGPubKey", _T("")); + ptmp = UniGetContactSettingUtf(metaGetMostOnline(hContact), szGPGModuleName, "GPGPubKey", _T("")); else ptmp = UniGetContactSettingUtf(hContact, szGPGModuleName, "GPGPubKey", _T("")); wstring new_key = ptmp; @@ -1959,7 +1959,7 @@ void ImportKey() char *tmp = NULL; string::size_type s = output.find("gpg: key ") + strlen("gpg: key "); string::size_type s2 = output.find(":", s); - DBWriteContactSettingString(metaGetCurrent(hContact), szGPGModuleName, "KeyID", output.substr(s,s2-s).c_str()); + DBWriteContactSettingString(metaGetMostOnline(hContact), szGPGModuleName, "KeyID", output.substr(s,s2-s).c_str()); s2+=2; s = output.find("“", s2); if(s == string::npos) @@ -1976,7 +1976,7 @@ void ImportKey() tmp = new char [output.substr(s,s2-s-1).length()+1]; strcpy(tmp, output.substr(s,s2-s-1).c_str()); mir_utf8decode(tmp, 0); - DBWriteContactSettingString(metaGetCurrent(hContact), szGPGModuleName, "KeyMainName", tmp); + DBWriteContactSettingString(metaGetContact(hContact), szGPGModuleName, "KeyMainName", tmp); mir_free(tmp); if((s = output.find(")", s2)) == string::npos) s = output.find(">", s2); @@ -1988,14 +1988,14 @@ void ImportKey() tmp = new char [output.substr(s2,s-s2).length()+1]; strcpy(tmp, output.substr(s2,s-s2).c_str()); mir_utf8decode(tmp, 0); - DBWriteContactSettingString(metaGetCurrent(hContact), szGPGModuleName, "KeyComment", tmp); + DBWriteContactSettingString(metaGetMostOnline(hContact), szGPGModuleName, "KeyComment", tmp); mir_free(tmp); s+=3; s2 = output.find(">", s); tmp = new char [output.substr(s,s2-s).length()+1]; strcpy(tmp, output.substr(s,s2-s).c_str()); mir_utf8decode(tmp, 0); - DBWriteContactSettingString(metaGetCurrent(hContact), szGPGModuleName, "KeyMainEmail", tmp); + DBWriteContactSettingString(metaGetMostOnline(hContact), szGPGModuleName, "KeyMainEmail", tmp); mir_free(tmp); } else @@ -2003,10 +2003,10 @@ void ImportKey() tmp = new char [output.substr(s2,s-s2).length()+1]; strcpy(tmp, output.substr(s2,s-s2).c_str()); mir_utf8decode(tmp, 0); - DBWriteContactSettingString(metaGetCurrent(hContact), szGPGModuleName, "KeyMainEmail", output.substr(s2,s-s2).c_str()); + DBWriteContactSettingString(metaGetMostOnline(hContact), szGPGModuleName, "KeyMainEmail", output.substr(s2,s-s2).c_str()); mir_free(tmp); } - DBDeleteContactSetting(metaGetCurrent(hContact), szGPGModuleName, "bAlwatsTrust"); + DBDeleteContactSetting(metaGetMostOnline(hContact), szGPGModuleName, "bAlwatsTrust"); } } else -- cgit v1.2.3