From a8e58dc8f24d10dd4de16f19ace4740350d9b9cc Mon Sep 17 00:00:00 2001 From: Gluzskiy Alexandr Date: Tue, 12 Oct 2010 22:51:38 +0300 Subject: fixed crash on filetransfers, fixed password saving --- utilities.cpp | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) (limited to 'utilities.cpp') diff --git a/utilities.cpp b/utilities.cpp index b182f1f..70d59b9 100644 --- a/utilities.cpp +++ b/utilities.cpp @@ -295,7 +295,7 @@ int onProtoAck(WPARAM w, LPARAM l) case ACKRESULT_DENIED: case ACKRESULT_FAILED: { TCHAR *temp = _wgetenv(_T("TEMP")); - if(_tcsstr(f->tszCurrentFile, temp)) + if(f->tszCurrentFile && _tcsstr(f->tszCurrentFile, temp)) { if(!transfers.empty()) { @@ -311,7 +311,7 @@ int onProtoAck(WPARAM w, LPARAM l) case ACKRESULT_SUCCESS: { TCHAR *temp = _wgetenv(_T("TEMP")); - if(_tcsstr(f->tszCurrentFile, temp)) + if(f->tszCurrentFile && _tcsstr(f->tszCurrentFile, temp)) { if(!transfers.empty()) { @@ -322,7 +322,7 @@ int onProtoAck(WPARAM w, LPARAM l) } return 0; } - else if(_tcsstr(f->tszCurrentFile, _T(".gpg"))) //decrypt it + else if(f->tszCurrentFile && _tcsstr(f->tszCurrentFile, _T(".gpg"))) //decrypt it { //process encrypted file if(_waccess(f->tszCurrentFile, 0) == -1) { @@ -392,7 +392,9 @@ int onSendFile(WPARAM w, LPARAM l) pxResult result; char *keyid = UniGetContactSettingUtf(ccs->hContact, szGPGModuleName, "KeyID", ""); wstring cmd = _T("-r "); - cmd += boost::lexical_cast(keyid); + TCHAR *szKeyid = mir_a2t(keyid); + cmd += szKeyid; + mir_free(szKeyid); mir_free(keyid); cmd += _T(" -o \""); TCHAR *temp = _wgetenv(_T("TEMP")); @@ -588,22 +590,22 @@ static JABBER_HANDLER_FUNC SendHandler(IJabberInterface *ji, HXML node, void *pU { char *inkeyid = UniGetContactSettingUtf(NULL, szGPGModuleName, "KeyID", ""); TCHAR *pass = NULL; - if(strlen(inkeyid) > 0) + if(inkeyid[0]) { string dbsetting = "szKey_"; dbsetting += inkeyid; dbsetting += "_Password"; pass = UniGetContactSettingUtf(NULL, szGPGModuleName, dbsetting.c_str(), _T("")); - if(_tcslen(pass) > 0) + if(pass[0]) debuglog<<"info: found password in database for key id: "< 0) + if(pass[0]) debuglog<<"info: found password for all keys in database, trying to encrypt message from self with password\n"; } - if(_tcslen(pass) > 0) + if(pass[0]) { cmd += _T("--passphrase \""); cmd += pass; -- cgit v1.2.3