From 913374a19774643fb97455d0a294a26a93019557 Mon Sep 17 00:00:00 2001 From: Gluzskiy Alexandr Date: Sat, 12 Jan 2013 09:08:03 +0200 Subject: merged with miranda_ng main repo --- src/main.cpp | 142 ++++++++++++++++++++++++++++++++++++++++++++++++++--------- 1 file changed, 120 insertions(+), 22 deletions(-) (limited to 'src/main.cpp') diff --git a/src/main.cpp b/src/main.cpp index a88a650..e539511 100755 --- a/src/main.cpp +++ b/src/main.cpp @@ -109,7 +109,8 @@ static INT_PTR CALLBACK DlgProcFirstRun(HWND hwndDlg,UINT msg,WPARAM wParam,LPAR gpg_thread.~thread(); TerminateProcess(params.hProcess, 1); params.hProcess = NULL; - debuglog<szModuleName, "metacontacts")) + continue; + if(StriStr(accounts[i]->szModuleName, "weather")) + continue; + std::string acc = toUTF8(accounts[i]->tszAccountName); + acc += "("; + acc += accounts[i]->szModuleName; + acc += ")"; + acc += "_KeyID"; + keyid = UniGetContactSettingUtf(NULL, szGPGModuleName, acc.c_str(), ""); + if(keyid[0]) + { + question = Translate("Your secret key whith id: "); + keyid = UniGetContactSettingUtf(NULL, szGPGModuleName, "KeyID", ""); + key = UniGetContactSettingUtf(NULL, szGPGModuleName, "GPGPubKey", ""); + void ShowFirstRunDialog(); + if((p = out.find(keyid)) == string::npos) + { + question += keyid; + question += Translate(" for account "); + question += toUTF8(accounts[i]->tszAccountName); + question += Translate(" deleted from gpg secret keyring\nDo you want to set another key ?"); + if(MessageBoxA(0, question.c_str(), Translate("Own secret key warning"), MB_YESNO) == IDYES) + ShowFirstRunDialog(); + } + p2 = p; + p = out.find("[", p); + p2 = out.find("\n", p2); + if((p != std::string::npos) && (p < p2)) + { + p = out.find("expires:", p); + p += strlen("expires:"); + p++; + p2 = out.find("]", p); + TCHAR *expire_date = mir_wstrdup(toUTF16(out.substr(p,p2-p)).c_str()); + bool expired = false; + { + boost::posix_time::ptime now = boost::posix_time::second_clock::local_time(); + TCHAR buf[5]; + mir_sntprintf(buf, 5, _T("%s"), expire_date); + int year = _ttoi(buf); + if(year < now.date().year()) + expired = true; + else if(year == now.date().year()) + { + mir_sntprintf(buf, 3, _T("%s"), expire_date+5); + int month = _ttoi(buf); + if(month < now.date().month()) + expired = true; + else if(month == now.date().month()) + { + mir_sntprintf(buf, 3, _T("%s"), expire_date+8); + int day = _ttoi(buf); + if(day <= now.date().day_number()) + expired = true; + } + } + } + if(expired) + { + question += keyid; + question += Translate(" for account "); + question += toUTF8(accounts[i]->tszAccountName); + question += Translate(" expired and will not work\nDo you want to set another key ?"); + if(MessageBoxA(0, question.c_str(), Translate("Own secret key warning"), MB_YESNO) == IDYES) + ShowFirstRunDialog(); + } + mir_free(expire_date); + } + } + mir_free(keyid); + } + question = Translate("Your secret key whith id: "); + keyid = UniGetContactSettingUtf(NULL, szGPGModuleName, "KeyID", ""); + key = UniGetContactSettingUtf(NULL, szGPGModuleName, "GPGPubKey", ""); void ShowFirstRunDialog(); if(!DBGetContactSettingByte(NULL, szGPGModuleName, "FirstRun", 1) && (!keyid[0] || !key[0])) { @@ -2263,7 +2360,8 @@ void ImportKey() gpg_thread.~thread(); TerminateProcess(params.hProcess, 1); params.hProcess = NULL; - debuglog<