From 0a3c70d8388264a9d4c21c9063c4a493b88b882c Mon Sep 17 00:00:00 2001 From: Gluzskiy Alexandr Date: Sat, 4 Sep 2010 00:50:35 +0300 Subject: bugfixes, ability to set default password --- utilities.cpp | 34 +++++++++++++++++++++++++++++----- 1 file changed, 29 insertions(+), 5 deletions(-) (limited to 'utilities.cpp') diff --git a/utilities.cpp b/utilities.cpp index 03cb2c4..5f1ad0a 100644 --- a/utilities.cpp +++ b/utilities.cpp @@ -45,7 +45,8 @@ char* __stdcall UniGetContactSettingUtf(HANDLE hContact, const char *szModule,co char *date() { - static char d[11]; + setlocale( LC_ALL, "C" ); + static char d[11]; char *tmp = __DATE__, m[4], mn[3] = "01"; m[0]=tmp[0]; m[1]=tmp[1]; @@ -402,6 +403,9 @@ static JABBER_HANDLER_FUNC SendHandler(IJabberInterface *ji, HXML node, void *pU wstring path_out = path_c; mir_free(path_c); path_out += _T("\\prescense_text"); + { + DeleteFile(path_out.c_str()); + } wfstream f(path_out.c_str(), std::ios::out); char *tmp = mir_utf8encodeW(str); f< 0) + char *inkeyid = UniGetContactSettingUtf(NULL, szGPGModuleName, "KeyID", ""); + TCHAR *pass = NULL; + if(strlen(inkeyid) > 0) + { + string dbsetting = "szKey_"; + dbsetting += inkeyid; + dbsetting += "_Password"; + pass = UniGetContactSettingUtf(NULL, szGPGModuleName, dbsetting.c_str(), _T("")); + if(_tcslen(pass) > 0) + debuglog<<"info: found password in database for key id: "< 0) + debuglog<<"info: found password for all keys in database, trying to encrypt message from self with password\n"; + } + if(_tcslen(pass) > 0) { cmd += _T("--passphrase \""); - cmd += tmp; + cmd += pass; cmd += _T("\" "); } else if(password) { + debuglog<<"info: found password in memory, trying to encrypt message from self with password\n"; cmd += _T("--passphrase \""); cmd += password; cmd += _T("\" "); } - mir_free(tmp); + else + debuglog<<"info: passwords not found in database or memory, trying to encrypt message from self with out password\n"; + mir_free(pass); + mir_free(inkeyid); } cmd += _T("--default-key "); path_c = UniGetContactSettingUtf(NULL, szGPGModuleName, "KeyID", _T("")); -- cgit v1.2.3