summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGluzskiy Alexandr <sss@sss.chaoslab.ru>2011-11-03 07:38:25 +0200
committerGluzskiy Alexandr <sss@sss.chaoslab.ru>2011-11-03 07:38:25 +0200
commit16a477058f150f46a99e2f60cd51502c04a1ed9c (patch)
tree7ae158407557ce884316c97364a7aeed35466ce3
parentae82ea7b5c3177c8ad6934a01985a17603162972 (diff)
fixed default password loading
-rwxr-xr-x[-rw-r--r--]init.cpp1
-rwxr-xr-xmessages.cpp10
2 files changed, 6 insertions, 5 deletions
diff --git a/init.cpp b/init.cpp
index 6f591ac..04a198a 100644..100755
--- a/init.cpp
+++ b/init.cpp
@@ -91,6 +91,7 @@ void init_vars()
outclosetag = UniGetContactSettingUtf(NULL, szGPGModuleName, "szOutCloseTag", _T("</GPGenc>"));
bDebugLog = DBGetContactSettingByte(NULL, szGPGModuleName, "bDebugLog", 0);
bAutoExchange = DBGetContactSettingByte(NULL, szGPGModuleName, "bAutoExchange", 0);
+ password = UniGetContactSettingUtf(NULL, szGPGModuleName, "szKeyPassword", _T(""));
debuglog.init();
bJabberAPI = DBGetContactSettingByte(NULL, szGPGModuleName, "bJabberAPI", bIsMiranda09?1:0);
bFileTransfers = DBGetContactSettingByte(NULL, szGPGModuleName, "bFileTransfers", 1);
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 \"");