summaryrefslogtreecommitdiff
path: root/utilities.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'utilities.cpp')
-rw-r--r--utilities.cpp49
1 files changed, 21 insertions, 28 deletions
diff --git a/utilities.cpp b/utilities.cpp
index d281283..c1bb062 100644
--- a/utilities.cpp
+++ b/utilities.cpp
@@ -340,12 +340,8 @@ int onProtoAck(WPARAM w, LPARAM l)
if(!gpg_thread->timed_join(boost::posix_time::minutes(10)))
{
delete gpg_thread;
- MessageBox(0, _T("GPG execution timed out, aborted"), _T(""), MB_OK);
+ debuglog<<time_str()<<": GPG execution timed out, aborted\n";
}
- if(result == pxNotFound)
- {
- MessageBox(0, _T("Set path to gpg.exe first!"), _T("Warning"), MB_OK);
- }
DeleteFile(filename);
mir_free(filename);
}
@@ -408,11 +404,7 @@ int onSendFile(WPARAM w, LPARAM l)
if(!gpg_thread->timed_join(boost::posix_time::minutes(10)))
{
delete gpg_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";
}
mir_free(file[i]);
file[i]=mir_wstrdup(path_out.c_str());
@@ -561,7 +553,7 @@ static JABBER_HANDLER_FUNC SendHandler(IJabberInterface *ji, HXML node, void *pU
{
if(errno == ENOENT)
{
- debuglog<<"info: Failed to write prescense in file\n";
+ debuglog<<time_str()<<": info: Failed to write prescense in file\n";
return FALSE;
}
}
@@ -580,13 +572,13 @@ static JABBER_HANDLER_FUNC SendHandler(IJabberInterface *ji, HXML node, void *pU
dbsetting += "_Password";
pass = UniGetContactSettingUtf(NULL, szGPGModuleName, dbsetting.c_str(), _T(""));
if(pass[0])
- debuglog<<"info: found password in database for key id: "<<inkeyid<<", trying to encrypt message from self with password\n";
+ debuglog<<time_str()<<": info: found password in database for key id: "<<inkeyid<<", trying to encrypt message from self with password\n";
}
else
{
pass = UniGetContactSettingUtf(NULL, szGPGModuleName, "szKeyPassword", _T(""));
if(pass[0])
- debuglog<<"info: found password for all keys in database, trying to encrypt message from self with password\n";
+ debuglog<<time_str()<<": info: found password for all keys in database, trying to encrypt message from self with password\n";
}
if(pass[0])
{
@@ -596,13 +588,13 @@ static JABBER_HANDLER_FUNC SendHandler(IJabberInterface *ji, HXML node, void *pU
}
else if(password)
{
- debuglog<<"info: found password in memory, trying to encrypt message from self with password\n";
+ debuglog<<time_str()<<": info: found password in memory, trying to encrypt message from self with password\n";
cmd += _T("--passphrase \"");
cmd += password;
cmd += _T("\" ");
}
else
- debuglog<<"info: passwords not found in database or memory, trying to encrypt message from self with out password\n";
+ debuglog<<time_str()<<": info: passwords not found in database or memory, trying to encrypt message from self with out password\n";
mir_free(pass);
mir_free(inkeyid);
}
@@ -626,11 +618,7 @@ static JABBER_HANDLER_FUNC SendHandler(IJabberInterface *ji, HXML node, void *pU
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";
}
DeleteFile(path_out.c_str());
path_out += _T(".asc");
@@ -650,7 +638,7 @@ static JABBER_HANDLER_FUNC SendHandler(IJabberInterface *ji, HXML node, void *pU
}
if(data.empty())
{
- debuglog<<"info: Failed to read prescense sign from file\n";
+ debuglog<<time_str()<<": info: Failed to read prescense sign from file\n";
return FALSE;
}
if(data.find(_T("-----BEGIN PGP MESSAGE-----")) != wstring::npos && data.find(_T("-----END PGP MESSAGE-----")) != wstring::npos)
@@ -732,7 +720,7 @@ static JABBER_HANDLER_FUNC PrescenseHandler(IJabberInterface *ji, HXML node, voi
if(errno == ENOENT)
{
sign_file_mutex.unlock();
- debuglog<<"info: Failed to write sign in file\n";
+ debuglog<<time_str()<<": info: Failed to write sign in file\n";
return FALSE;
}
}
@@ -753,14 +741,13 @@ static JABBER_HANDLER_FUNC PrescenseHandler(IJabberInterface *ji, HXML node, voi
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 FALSE;
}
+ if(result == pxNotFound)
+ return FALSE;
DeleteFile(path_out.c_str());
sign_file_mutex.unlock();
- if(result == pxNotFound)
- {
- MessageBox(0, _T("Set path to gpg.exe first!"), _T("Warning"), MB_OK);
- }
if(out.find("key ID ") != string::npos)
{
//need to get hcontact here, i can get jid from hxml, and get handle from jid, maybe exists better way ?
@@ -992,4 +979,10 @@ void send_encrypted_msgs_thread(HANDLE hContact)
else
return;
}
-} \ No newline at end of file
+}
+
+string time_str()
+{
+ boost::posix_time::ptime now = boost::posix_time::second_clock::local_time();
+ return (string)boost::posix_time::to_simple_string(now);
+}