diff options
author | Gluzskiy Alexandr <sss@sss.chaoslab.ru> | 2011-11-03 07:38:25 +0200 |
---|---|---|
committer | Gluzskiy Alexandr <sss@sss.chaoslab.ru> | 2011-11-03 07:38:25 +0200 |
commit | 16a477058f150f46a99e2f60cd51502c04a1ed9c (patch) | |
tree | 7ae158407557ce884316c97364a7aeed35466ce3 /messages.cpp | |
parent | ae82ea7b5c3177c8ad6934a01985a17603162972 (diff) |
fixed default password loading
Diffstat (limited to 'messages.cpp')
-rwxr-xr-x | messages.cpp | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/messages.cpp b/messages.cpp index c563e78..e64fd53 100755 --- a/messages.cpp +++ b/messages.cpp @@ -101,28 +101,28 @@ int RecvMsgSvc_func(HANDLE hContact, std::wstring str, char *msg, DWORD flags, D { char *inkeyid = UniGetContactSettingUtf(metaGetMostOnline(hContact), szGPGModuleName, "InKeyID", ""); 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<<time_str()<<": info: found password in database for key id: "<<inkeyid<<", trying to decrypt message from "<<(TCHAR*)CallService(MS_CLIST_GETCONTACTDISPLAYNAME, (WPARAM)hContact, GCDNF_TCHAR)<<" with password\n"; } else { pass = UniGetContactSettingUtf(NULL, szGPGModuleName, "szKeyPassword", _T("")); - if(_tcslen(pass) > 0) + if(pass[0]) debuglog<<time_str()<<": info: found password for all keys in database, trying to decrypt message from "<<(TCHAR*)CallService(MS_CLIST_GETCONTACTDISPLAYNAME, (WPARAM)hContact, GCDNF_TCHAR)<<" with password\n"; } - if(_tcslen(pass) > 0) + if(pass && pass[0]) { cmd += _T("--passphrase \""); cmd += pass; cmd += _T("\" "); } - else if(password) + else if(password && password[0]) { debuglog<<time_str()<<": info: found password in memory, trying to decrypt message from "<<(TCHAR*)CallService(MS_CLIST_GETCONTACTDISPLAYNAME, (WPARAM)hContact, GCDNF_TCHAR)<<" with password\n"; cmd += _T("--passphrase \""); |