diff options
author | Gluzskiy Alexandr <sss@sss.chaoslab.ru> | 2012-12-22 08:54:19 +0200 |
---|---|---|
committer | Gluzskiy Alexandr <sss@sss.chaoslab.ru> | 2012-12-22 08:54:19 +0200 |
commit | 5735d6a9ee7c250bd563529a3226174efe74ba38 (patch) | |
tree | 5fe26082a536b3f2e03d87a2a4bb5f2c69954daa /src/messages.cpp | |
parent | 925f25fc28a6edfe444412e13887456902514f13 (diff) |
merged with mirnada ng main repo
Diffstat (limited to 'src/messages.cpp')
-rwxr-xr-x | src/messages.cpp | 21 |
1 files changed, 12 insertions, 9 deletions
diff --git a/src/messages.cpp b/src/messages.cpp index 7eb598c..292ad10 100755 --- a/src/messages.cpp +++ b/src/messages.cpp @@ -410,7 +410,11 @@ int RecvMsgSvc(WPARAM w, LPARAM l) _tcscpy(tmp2, ptmp); mir_free(ptmp); _tcscat(tmp2, _T("\\")); - _tcscat(tmp2, _T("temporary_exported.asc")); + TCHAR *tmp3 = mir_a2t(get_random(5).c_str()); + _tcscat(tmp2, tmp3); + _tcscat(tmp2, _T(".asc")); + mir_free(tmp3); + //_tcscat(tmp2, _T("temporary_exported.asc")); DeleteFile(tmp2); wfstream f(tmp2, std::ios::out); while(!f.is_open()) @@ -443,6 +447,7 @@ int RecvMsgSvc(WPARAM w, LPARAM l) } if(result == pxNotFound) return 1; + DeleteFile(tmp2); //TODO: check gpg output for errors { char *tmp = NULL; @@ -543,7 +548,7 @@ int RecvMsgSvc(WPARAM w, LPARAM l) s2 += _tcslen(_T("-----END PGP PRIVATE KEY BLOCK-----")); } new_key.append(str.substr(s1,s2-s1)); - new_key_hcnt_mutex.lock(); + //new_key_hcnt_mutex.lock(); new_key_hcnt = ccs->hContact; ShowNewKeyDialog(); HistoryLog(ccs->hContact, db_event(msg, 0, 0, dbflags)); @@ -568,11 +573,9 @@ int RecvMsgSvc(WPARAM w, LPARAM l) } else if(!isContactHaveKey(ccs->hContact) && bAutoExchange && gpg_valid && gpg_keyexist) { - LPSTR proto = (LPSTR)CallService(MS_PROTO_GETCONTACTBASEPROTO, (WPARAM)ccs->hContact, 0); + char *proto = GetContactProto(ccs->hContact); DWORD uin = DBGetContactSettingDword(ccs->hContact, proto, "UIN", 0); - if(uin) - { - char *proto = (char*)CallService(MS_PROTO_GETCONTACTBASEPROTO, (WPARAM)ccs->hContact, 0); + if(uin) { char svc[64]; strcpy(svc, proto); strcat(svc, PS_ICQ_CHECKCAPABILITY); @@ -610,7 +613,7 @@ int RecvMsgSvc(WPARAM w, LPARAM l) mir_free(caps); if(str.find(_T("GPG_Key_Auto_Exchange:0")) != string::npos) { - CallContactService(ccs->hContact, PSS_MESSAGE, (WPARAM)0, (LPARAM)"-----PGP KEY REQUEST-----"); + CallContactService(ccs->hContact, PSS_MESSAGE, 0, (LPARAM)"-----PGP KEY REQUEST-----"); return 0; } } @@ -841,11 +844,11 @@ int SendMsgSvc(WPARAM w, LPARAM l) if(bAutoExchange && !strstr(msg, "-----PGP KEY REQUEST-----") && !strstr(msg, "-----BEGIN PGP PUBLIC KEY BLOCK-----") && gpg_valid) { void send_encrypted_msgs_thread(HANDLE hContact); - LPSTR proto = (LPSTR)CallService(MS_PROTO_GETCONTACTBASEPROTO, (WPARAM)ccs->hContact, 0); + LPSTR proto = GetContactProto(ccs->hContact); DWORD uin = DBGetContactSettingDword(ccs->hContact, proto, "UIN", 0); if(uin) { - char *proto = (char*)CallService(MS_PROTO_GETCONTACTBASEPROTO, (WPARAM)ccs->hContact, 0); + char *proto = GetContactProto(ccs->hContact); char svc[64]; strcpy(svc, proto); strcat(svc, PS_ICQ_CHECKCAPABILITY); |