summaryrefslogtreecommitdiff
path: root/src/utilities.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/utilities.cpp')
-rwxr-xr-xsrc/utilities.cpp48
1 files changed, 24 insertions, 24 deletions
diff --git a/src/utilities.cpp b/src/utilities.cpp
index ab9b776..2cca6ff 100755
--- a/src/utilities.cpp
+++ b/src/utilities.cpp
@@ -406,13 +406,13 @@ int onProtoAck(WPARAM w, LPARAM l)
dbsetting += "_Password";
pass = UniGetContactSettingUtf(NULL, szGPGModuleName, dbsetting.c_str(), _T(""));
if(_tcslen(pass) > 0)
- debuglog<<time_str()<<": info: found password in database for key id: "<<keyid<<", trying to decrypt message from "<<(TCHAR*)CallService(MS_CLIST_GETCONTACTDISPLAYNAME, (WPARAM)ack->hContact, GCDNF_TCHAR)<<" with password\n";
+ debuglog<<std::string(time_str()+": info: found password in database for key id: "+keyid+", trying to decrypt message from "+toUTF8((TCHAR*)CallService(MS_CLIST_GETCONTACTDISPLAYNAME, (WPARAM)ack->hContact, GCDNF_TCHAR))+" with password");
}
else
{
pass = UniGetContactSettingUtf(NULL, szGPGModuleName, "szKeyPassword", _T(""));
if(_tcslen(pass) > 0)
- debuglog<<time_str()<<": info: found password for all keys in database, trying to decrypt message from "<<(TCHAR*)CallService(MS_CLIST_GETCONTACTDISPLAYNAME, (WPARAM)ack->hContact, GCDNF_TCHAR)<<" with password\n";
+ debuglog<<std::string(time_str()+": info: found password for all keys in database, trying to decrypt message from "+toUTF8((TCHAR*)CallService(MS_CLIST_GETCONTACTDISPLAYNAME, (WPARAM)ack->hContact, GCDNF_TCHAR))+" with password");
}
if(_tcslen(pass) > 0)
{
@@ -422,13 +422,13 @@ int onProtoAck(WPARAM w, LPARAM l)
}
else if(password)
{
- debuglog<<time_str()<<": info: found password in memory, trying to decrypt message from "<<(TCHAR*)CallService(MS_CLIST_GETCONTACTDISPLAYNAME, (WPARAM)ack->hContact, GCDNF_TCHAR)<<" with password\n";
+ debuglog<<std::string(time_str()+": info: found password in memory, trying to decrypt message from "+toUTF8((TCHAR*)CallService(MS_CLIST_GETCONTACTDISPLAYNAME, (WPARAM)ack->hContact, GCDNF_TCHAR))+" with password");
cmd += _T("--passphrase \"");
cmd += password;
cmd += _T("\" ");
}
else
- debuglog<<time_str()<<": info: passwords not found in database or memory, trying to decrypt message from "<<(TCHAR*)CallService(MS_CLIST_GETCONTACTDISPLAYNAME, (WPARAM)ack->hContact, GCDNF_TCHAR)<<" with out password\n";
+ debuglog<<std::string(time_str()+": info: passwords not found in database or memory, trying to decrypt message from "+toUTF8((TCHAR*)CallService(MS_CLIST_GETCONTACTDISPLAYNAME, (WPARAM)ack->hContact, GCDNF_TCHAR))+" with out password");
mir_free(pass);
mir_free(keyid);
}
@@ -447,7 +447,7 @@ int onProtoAck(WPARAM w, LPARAM l)
delete gpg_thread;
TerminateProcess(params.hProcess, 1);
params.hProcess = NULL;
- debuglog<<time_str()<<": GPG execution timed out, aborted\n";
+ debuglog<<std::string(time_str()+": GPG execution timed out, aborted");
return 0;
}
while(out.find("public key decryption failed: bad passphrase") != string::npos)
@@ -455,7 +455,7 @@ int onProtoAck(WPARAM w, LPARAM l)
extern bool _terminate;
extern HANDLE new_key_hcnt;
extern boost::mutex new_key_hcnt_mutex;
- debuglog<<time_str()<<": info: failed to decrypt messaage from "<<(TCHAR*)CallService(MS_CLIST_GETCONTACTDISPLAYNAME, (WPARAM)ack->hContact, GCDNF_TCHAR)<<" password needed, trying to get one\n";
+ debuglog<<std::string(time_str()+": info: failed to decrypt messaage from "+toUTF8((TCHAR*)CallService(MS_CLIST_GETCONTACTDISPLAYNAME, (WPARAM)ack->hContact, GCDNF_TCHAR))+" password needed, trying to get one");
if(_terminate)
break;
{ //save inkey id
@@ -475,7 +475,7 @@ int onProtoAck(WPARAM w, LPARAM l)
wstring cmd2 = cmd;
if(password)
{
- debuglog<<time_str()<<": info: found password in memory, trying to decrypt message from "<<(TCHAR*)CallService(MS_CLIST_GETCONTACTDISPLAYNAME, (WPARAM)ack->hContact, GCDNF_TCHAR)<<"\n";
+ debuglog<<std::string(time_str()+": info: found password in memory, trying to decrypt message from "+toUTF8((TCHAR*)CallService(MS_CLIST_GETCONTACTDISPLAYNAME, (WPARAM)ack->hContact, GCDNF_TCHAR)));
wstring tmp = _T("--passphrase \"");
tmp += password;
tmp += _T("\" ");
@@ -495,7 +495,7 @@ int onProtoAck(WPARAM w, LPARAM l)
delete gpg_thread;
TerminateProcess(params.hProcess, 1);
params.hProcess = NULL;
- debuglog<<time_str()<<": GPG execution timed out, aborted\n";
+ debuglog<<std::string(time_str()+": GPG execution timed out, aborted");
//DeleteFile(filename);
return 0;
}
@@ -586,7 +586,7 @@ std::wstring encrypt_file(HANDLE hContact, TCHAR *filename)
delete gpg_thread;
TerminateProcess(params.hProcess, 1);
params.hProcess = NULL;
- debuglog<<time_str()<<": GPG execution timed out, aborted\n";
+ debuglog<<std::string(time_str()+": GPG execution timed out, aborted");
return 0;
}
if(out.find("There is no assurance this key belongs to the named user") != string::npos)
@@ -602,7 +602,7 @@ std::wstring encrypt_file(HANDLE hContact, TCHAR *filename)
delete gpg_thread;
TerminateProcess(params.hProcess, 1);
params.hProcess = NULL;
- debuglog<<time_str()<<": GPG execution timed out, aborted\n";
+ debuglog<<std::string(time_str()+": GPG execution timed out, aborted");
return 0;
}
}
@@ -818,7 +818,7 @@ static JABBER_HANDLER_FUNC SendHandler(IJabberInterface *ji, HXML node, void *pU
{
if(errno == ENOENT)
{
- debuglog<<time_str()<<": info: Failed to write prescense in file\n";
+ debuglog<<std::string(time_str()+": info: Failed to write prescense in file");
return FALSE;
}
}
@@ -849,13 +849,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<<time_str()<<": info: found password in database for key id: "<<inkeyid<<", trying to encrypt message from self with password\n";
+ debuglog<<std::string(time_str()+": info: found password in database for key id: "+inkeyid+", trying to encrypt message from self with password");
}
else
{
pass = UniGetContactSettingUtf(NULL, szGPGModuleName, "szKeyPassword", _T(""));
if(pass[0])
- debuglog<<time_str()<<": info: found password for all keys in database, trying to encrypt message from self with password\n";
+ debuglog<<std::string(time_str()+": info: found password for all keys in database, trying to encrypt message from self with password");
}
if(pass[0])
{
@@ -865,13 +865,13 @@ static JABBER_HANDLER_FUNC SendHandler(IJabberInterface *ji, HXML node, void *pU
}
else if(password)
{
- debuglog<<time_str()<<": info: found password in memory, trying to encrypt message from self with password\n";
+ debuglog<<std::string(time_str()+": info: found password in memory, trying to encrypt message from self with password");
cmd += _T("--passphrase \"");
cmd += password;
cmd += _T("\" ");
}
else
- debuglog<<time_str()<<": info: passwords not found in database or memory, trying to encrypt message from self with out password\n";
+ debuglog<<std::string(time_str()+": info: passwords not found in database or memory, trying to encrypt message from self with out password");
mir_free(pass);
mir_free(inkeyid);
}
@@ -897,7 +897,7 @@ static JABBER_HANDLER_FUNC SendHandler(IJabberInterface *ji, HXML node, void *pU
gpg_thread.~thread();
TerminateProcess(params.hProcess, 1);
params.hProcess = NULL;
- debuglog<<time_str()<<"GPG execution timed out, aborted\n";
+ debuglog<<std::string(time_str()+"GPG execution timed out, aborted");
}
DeleteFile(path_out.c_str());
path_out += _T(".asc");
@@ -917,7 +917,7 @@ static JABBER_HANDLER_FUNC SendHandler(IJabberInterface *ji, HXML node, void *pU
}
if(data.empty())
{
- debuglog<<time_str()<<": info: Failed to read prescense sign from file\n";
+ debuglog<<std::string(time_str()+": info: Failed to read prescense sign from file");
return FALSE;
}
if(data.find(_T("-----BEGIN PGP SIGNATURE-----")) != wstring::npos && data.find(_T("-----END PGP SIGNATURE-----")) != wstring::npos)
@@ -1032,7 +1032,7 @@ static JABBER_HANDLER_FUNC PrescenseHandler(IJabberInterface *ji, HXML node, voi
if(errno == ENOENT)
{
// sign_file_mutex.unlock();
- debuglog<<time_str()<<": info: Failed to write sign in file\n";
+ debuglog<<std::string(time_str()+": info: Failed to write sign in file");
return FALSE;
}
}
@@ -1058,7 +1058,7 @@ static JABBER_HANDLER_FUNC PrescenseHandler(IJabberInterface *ji, HXML node, voi
gpg_thread.~thread();
TerminateProcess(params.hProcess, 1);
params.hProcess = NULL;
- debuglog<<time_str()<<": GPG execution timed out, aborted\n";
+ debuglog<<std::string(time_str()+": GPG execution timed out, aborted");
return FALSE;
}
if(result == pxNotFound)
@@ -1135,7 +1135,7 @@ bool isContactSecured(HANDLE hContact)
BYTE gpg_enc = DBGetContactSettingByte(hContact, szGPGModuleName, "GPGEncryption", 0);
if(!gpg_enc)
{
- debuglog<<time_str()<<": encryption is turned off for "<<(TCHAR*)CallService(MS_CLIST_GETCONTACTDISPLAYNAME, (WPARAM)hContact, GCDNF_TCHAR)<<"\n";
+ debuglog<<std::string(time_str()+": encryption is turned off for "+toUTF8((TCHAR*)CallService(MS_CLIST_GETCONTACTDISPLAYNAME, (WPARAM)hContact, GCDNF_TCHAR)));
return false;
}
if(!metaIsProtoMetaContacts(hContact))
@@ -1144,12 +1144,12 @@ bool isContactSecured(HANDLE hContact)
if(!key[0])
{
mir_free(key);
- debuglog<<time_str()<<": encryption is turned off for "<<(TCHAR*)CallService(MS_CLIST_GETCONTACTDISPLAYNAME, (WPARAM)hContact, GCDNF_TCHAR)<<"\n";
+ debuglog<<std::string(time_str()+": encryption is turned off for "+toUTF8((TCHAR*)CallService(MS_CLIST_GETCONTACTDISPLAYNAME, (WPARAM)hContact, GCDNF_TCHAR)));
return false;
}
mir_free(key);
}
- debuglog<<time_str()<<": encryption is turned on for "<<(TCHAR*)CallService(MS_CLIST_GETCONTACTDISPLAYNAME, (WPARAM)hContact, GCDNF_TCHAR)<<"\n";
+ debuglog<<std::string(time_str()+": encryption is turned on for "+toUTF8((TCHAR*)CallService(MS_CLIST_GETCONTACTDISPLAYNAME, (WPARAM)hContact, GCDNF_TCHAR)));
return true;
}
@@ -1230,7 +1230,7 @@ bool isGPGValid()
gpg_thread.~thread();
TerminateProcess(params.hProcess, 1);
params.hProcess = NULL;
- debuglog<<time_str()<<": GPG execution timed out, aborted\n";
+ debuglog<<std::string(time_str()+": GPG execution timed out, aborted");
}
gpg_valid = false;
string::size_type p1 = out.find("(GnuPG) ");
@@ -1829,7 +1829,7 @@ INT_PTR ImportGpGKeys(WPARAM w, LPARAM l)
gpg_thread.~thread();
TerminateProcess(params.hProcess, 1);
params.hProcess = NULL;
- debuglog<<time_str()<<": GPG execution timed out, aborted\n";
+ debuglog<<std::string(time_str()+": GPG execution timed out, aborted");
break;
}
if(result == pxNotFound)