diff options
Diffstat (limited to 'utilities.cpp')
-rw-r--r-- | utilities.cpp | 18 |
1 files changed, 10 insertions, 8 deletions
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<std::wstring>(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: "<<inkeyid<<", trying to encrypt message from self with password\n"; } else { pass = UniGetContactSettingUtf(NULL, szGPGModuleName, "szKeyPassword", _T("")); - if(_tcslen(pass) > 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; |