summaryrefslogtreecommitdiff
path: root/main.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'main.cpp')
-rw-r--r--main.cpp76
1 files changed, 18 insertions, 58 deletions
diff --git a/main.cpp b/main.cpp
index ab3739d..197623f 100644
--- a/main.cpp
+++ b/main.cpp
@@ -93,14 +93,11 @@ static BOOL CALLBACK DlgProcFirstRun(HWND hwndDlg,UINT msg,WPARAM wParam,LPARAM
if(!gpg_thread.timed_join(boost::posix_time::seconds(10)))
{
gpg_thread.~thread();
- MessageBox(0, _T("GPG execution timed out, aborted"), _T(""), MB_OK);
+ debuglog<<time_str()<<": GPG execution timed out, aborted\n";
break;
}
if(result == pxNotFound)
- {
- MessageBox(0, _T("Set path to gpg.exe first!"), _T("Warning"), MB_OK);
break;
- }
}
while(p != string::npos)
{
@@ -189,14 +186,11 @@ static BOOL CALLBACK DlgProcFirstRun(HWND hwndDlg,UINT msg,WPARAM wParam,LPARAM
if(!gpg_thread.timed_join(boost::posix_time::seconds(10)))
{
gpg_thread.~thread();
- MessageBox(0, _T("GPG execution timed out, aborted"), _T(""), MB_OK);
+ debuglog<<time_str()<<": GPG execution timed out, aborted\n";
break;
}
if(result == pxNotFound)
- {
- MessageBox(0, _T("Set path to gpg.exe first!"), _T("Warning"), MB_OK);
break;
- }
string::size_type s = 0;
while((s = out.find("\r", s)) != string::npos)
{
@@ -226,6 +220,7 @@ static BOOL CALLBACK DlgProcFirstRun(HWND hwndDlg,UINT msg,WPARAM wParam,LPARAM
delete [] name;
}
bAutoExchange = CheckStateStoreDB(hwndDlg, IDC_AUTO_EXCHANGE, "bAutoExchange");
+ gpg_configured = isGPGConfigured();
DestroyWindow(hwndDlg);
break;
case IDC_OTHER:
@@ -260,14 +255,11 @@ static BOOL CALLBACK DlgProcFirstRun(HWND hwndDlg,UINT msg,WPARAM wParam,LPARAM
if(!gpg_thread.timed_join(boost::posix_time::seconds(10)))
{
gpg_thread.~thread();
- MessageBox(0, _T("GPG execution timed out, aborted"), _T(""), MB_OK);
+ debuglog<<time_str()<<": GPG execution timed out, aborted\n";
break;
}
if(result == pxNotFound)
- {
- MessageBox(0, _T("Set path to gpg.exe first!"), _T("Warning"), MB_OK);
break;
- }
}
while(p != string::npos)
{
@@ -334,14 +326,11 @@ static BOOL CALLBACK DlgProcFirstRun(HWND hwndDlg,UINT msg,WPARAM wParam,LPARAM
if(!gpg_thread->timed_join(boost::posix_time::seconds(10)))
{
delete gpg_thread;
- MessageBox(0, _T("GPG execution timed out, aborted"), _T(""), MB_OK);
+ debuglog<<time_str()<<": GPG execution timed out, aborted\n";
break;
}
if(result == pxNotFound)
- {
- MessageBox(0, _T("Set path to gpg.exe first!"), _T("Warning"), MB_OK);
break;
- }
string::size_type s = out.find("Key fingerprint = ");
s += strlen("Key fingerprint = ");
string::size_type s2 = out.find("\n", s);
@@ -364,14 +353,11 @@ static BOOL CALLBACK DlgProcFirstRun(HWND hwndDlg,UINT msg,WPARAM wParam,LPARAM
if(!gpg_thread->timed_join(boost::posix_time::seconds(10)))
{
delete gpg_thread;
- MessageBox(0, _T("GPG execution timed out, aborted"), _T(""), MB_OK);
+ debuglog<<time_str()<<": GPG execution timed out, aborted\n";
break;
}
if(result == pxNotFound)
- {
- MessageBox(0, _T("Set path to gpg.exe first!"), _T("Warning"), MB_OK);
break;
- }
}
DBDeleteContactSetting(NULL, szGPGModuleName, "GPGPubKey");
DBDeleteContactSetting(NULL, szGPGModuleName, "KeyID");
@@ -431,14 +417,12 @@ static BOOL CALLBACK DlgProcFirstRun(HWND hwndDlg,UINT msg,WPARAM wParam,LPARAM
if(!gpg_thread.timed_join(boost::posix_time::minutes(10)))
{
gpg_thread.~thread();
- MessageBox(0, _T("GPG execution timed out, aborted"), _T(""), MB_OK);
+ debuglog<<time_str()<<": GPG execution timed out, aborted";
break;
}
if(result == pxNotFound)
- {
- MessageBox(0, _T("Set path to gpg.exe first!"), _T("Warning"), MB_OK);
break;
- }
+
DeleteFile(path.c_str());
string::size_type p1 = 0;
if((p1 = out.find("key ")) != string::npos)
@@ -463,14 +447,11 @@ static BOOL CALLBACK DlgProcFirstRun(HWND hwndDlg,UINT msg,WPARAM wParam,LPARAM
if(!gpg_thread.timed_join(boost::posix_time::seconds(10)))
{
gpg_thread.~thread();
- MessageBox(0, _T("GPG execution timed out, aborted"), _T(""), MB_OK);
+ debuglog<<time_str()<<"GPG execution timed out, aborted\n";
break;
}
if(result == pxNotFound)
- {
- MessageBox(0, _T("Set path to gpg.exe first!"), _T("Warning"), MB_OK);
break;
- }
string::size_type s = 0;
while((s = out.find("\r", s)) != string::npos)
{
@@ -1064,14 +1045,11 @@ static BOOL CALLBACK DlgProcKeyGenDialog(HWND hwndDlg, UINT msg, WPARAM wParam,
if(!gpg_thread.timed_join(boost::posix_time::seconds(10)))
{
gpg_thread.~thread();
- MessageBox(0, _T("GPG execution timed out, aborted"), _T(""), MB_OK);
+ debuglog<<time_str()<<": GPG execution timed out, aborted\n";
break;
}
if(result == pxNotFound)
- {
- MessageBox(0, _T("Set path to gpg.exe first!"), _T("Warning"), MB_OK);
break;
- }
}
ListView_DeleteAllItems(hwndList_g);
while(p != string::npos)
@@ -1215,14 +1193,11 @@ static BOOL CALLBACK DlgProcLoadExistingKey(HWND hwndDlg,UINT msg,WPARAM wParam,
if(!gpg_thread.timed_join(boost::posix_time::seconds(10)))
{
gpg_thread.~thread();
- MessageBox(0, _T("GPG execution timed out, aborted"), _T(""), MB_OK);
+ debuglog<<time_str()<<": GPG execution timed out, aborted\n";
break;
}
if(result == pxNotFound)
- {
- MessageBox(0, _T("Set path to gpg.exe first!"), _T("Warning"), MB_OK);
break;
- }
}
while(p != string::npos)
{
@@ -1294,14 +1269,11 @@ static BOOL CALLBACK DlgProcLoadExistingKey(HWND hwndDlg,UINT msg,WPARAM wParam,
if(!gpg_thread.timed_join(boost::posix_time::seconds(10)))
{
gpg_thread.~thread();
- MessageBox(0, _T("GPG execution timed out, aborted"), _T(""), MB_OK);
+ debuglog<<time_str()<<": GPG execution timed out, aborted\n";
break;
}
if(result == pxNotFound)
- {
- MessageBox(0, _T("Set path to gpg.exe first!"), _T("Warning"), MB_OK);
break;
- }
string::size_type s = 0;
while((s = out.find("\r", s)) != string::npos)
{
@@ -1400,11 +1372,7 @@ static BOOL CALLBACK DlgProcImportKeyDialog(HWND hwndDlg, UINT msg, WPARAM wPara
if(!gpg_thread.timed_join(boost::posix_time::seconds(10)))
{
gpg_thread.~thread();
- MessageBox(0, _T("GPG execution timed out, aborted"), _T(""), MB_OK);
- }
- if(result == pxNotFound)
- {
- MessageBox(0, _T("Set path to gpg.exe first!"), _T("Warning"), MB_OK);
+ debuglog<<time_str()<<": GPG execution timed out, aborted\n";
}
MessageBoxA(0, out.c_str(), "GPG output", MB_OK);
}
@@ -1500,12 +1468,9 @@ void FirstRun()
void InitCheck()
{
{//parse gpg output
- char *keyid = UniGetContactSettingUtf(NULL, szGPGModuleName, "KeyID", "");
- if(strlen(keyid) < 1)
- {
- mir_free(keyid);
+ gpg_configured = isGPGConfigured();
+ if(!gpg_configured)
return;
- }
string out;
DWORD code;
pxResult result;
@@ -1522,16 +1487,14 @@ void InitCheck()
if(!gpg_thread.timed_join(boost::posix_time::seconds(10)))
{
gpg_thread.~thread();
- MessageBox(0, _T("GPG execution timed out, aborted"), _T(""), MB_OK);
+ debuglog<<time_str()<<": GPG execution timed out, aborted\n";
return;
}
if(result == pxNotFound)
- {
- MessageBox(0, _T("Set path to gpg.exe first!"), _T("Warning"), MB_OK);
return;
- }
}
string question = "Your secret key whith id: ";
+ char *keyid = UniGetContactSettingUtf(NULL, szGPGModuleName, "KeyID", "");
question += keyid;
mir_free(keyid);
question += " deleted from gpg secret keyring\nDo you want to set another key ?";
@@ -1628,14 +1591,11 @@ void ImportKey()
if(!gpg_thread.timed_join(boost::posix_time::seconds(10)))
{
gpg_thread.~thread();
- MessageBox(0, _T("GPG execution timed out, aborted"), _T(""), MB_OK);
+ debuglog<<time_str()<<": GPG execution timed out, aborted\n";
return;
}
if(result == pxNotFound)
- {
- MessageBox(0, _T("Set path to gpg.exe first!"), _T("Warning"), MB_OK);
return;
- }
{
if(metaIsProtoMetaContacts(hContact))
{