From 86cafe5f5e47960cb8962fd555612aeb2d288285 Mon Sep 17 00:00:00 2001 From: Gluzskiy Alexandr Date: Sat, 14 Aug 2010 15:12:56 +0300 Subject: modified: main.cpp modified: messages.cpp modified: new_gpg.rc modified: resource.h --- messages.cpp | 52 +++++++++++++++++----------------------------------- 1 file changed, 17 insertions(+), 35 deletions(-) (limited to 'messages.cpp') diff --git a/messages.cpp b/messages.cpp index 5214429..960d063 100644 --- a/messages.cpp +++ b/messages.cpp @@ -16,6 +16,10 @@ #include "commonheaders.h" + +wstring new_key; +HANDLE new_key_hcnt = NULL; + int RecvMsgSvc(WPARAM w, LPARAM l) { CCSDATA *ccs = (CCSDATA*)l; @@ -41,6 +45,11 @@ int RecvMsgSvc(WPARAM w, LPARAM l) { //this is public key if(!DBGetContactSettingByte(ccs->hContact, szModuleName, "GPGEncryption", 0)) ;// + void ShowNewKeyDialog(); +/* if(key_action == 3) + return CallService(MS_PROTO_CHAINRECV, w, l); + else if(key_action == 2) + DBWriteContactSettingByte(ccs->hContact, szModuleName, "GPGEncryption", 1); */ s1 = 0; while((s1 = str.find(_T("\r"), s1)) != wstring::npos) { @@ -49,39 +58,10 @@ int RecvMsgSvc(WPARAM w, LPARAM l) s2 = str.find(_T("-----END PGP PUBLIC KEY BLOCK-----")); s1 = str.find(_T("-----BEGIN PGP PUBLIC KEY BLOCK-----")); s2 += _tcslen(_T("-----END PGP PUBLIC KEY BLOCK-----")); - DBWriteContactSettingTString(ccs->hContact, szModuleName, "GPGPubKey", str.substr(s1,s2-s1).c_str()); - { //gpg execute block - wstring cmd; - TCHAR tmp2[MAX_PATH] = {0}; - TCHAR *ptmp; - string output; - DWORD exitcode; - { - ptmp = UniGetContactSettingUtf(NULL, szModuleName, "szHomePath", _T("")); - _tcscpy(tmp2, ptmp); - mir_free(ptmp); - _tcscat(tmp2, _T("\\")); - _tcscat(tmp2, _T("temporary_exported.asc")); - wfstream f(tmp2, std::ios::out); - ptmp = UniGetContactSettingUtf(ccs->hContact, szModuleName, "GPGPubKey", _T("")); - wstring str = ptmp; - mir_free(ptmp); - f<hContact; + ShowNewKeyDialog(); + return CallService(MS_PROTO_CHAINRECV, w, l); } s1 = str.find(_T("-----BEGIN PGP MESSAGE-----")); s2 = str.find(_T("-----END PGP MESSAGE-----")); @@ -221,6 +201,7 @@ int SendMsgSvc(WPARAM w, LPARAM l) mir_free(tmp); return CallService(MS_PROTO_CHAINSEND, w, l); } + cmd += _T("--comment \"\" --no-version "); cmd += _T("--trust-model always "); cmd += _T("--batch --yes -e -a -r "); TCHAR *tmp2 = mir_a2t(tmp); @@ -272,12 +253,13 @@ int SendMsgSvc(WPARAM w, LPARAM l) return CallService(MS_PROTO_CHAINRECV, w, (LPARAM)ccs); } mir_free((void**)ccs->lParam); - char *utf = mir_utf8encodeW(str.c_str()); + char *utf = mir_u2a(str.c_str()); ccs->lParam = (LPARAM)utf; if(bAppendTags) DBWriteContactSettingByte(ccs->hContact, szModuleName, "MsgsForTagging", DBGetContactSettingByte(ccs->hContact, szModuleName, "MsgsForTagging", 0) + 1); } } + ccs->wParam&=~PREF_UNICODE; return CallService(MS_PROTO_CHAINSEND, w, l); } @@ -311,4 +293,4 @@ int HookSendMsg(WPARAM w, LPARAM l) } } return 0; -} \ No newline at end of file +} -- cgit v1.2.3