summaryrefslogtreecommitdiff
path: root/src/messages.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/messages.cpp')
-rwxr-xr-xsrc/messages.cpp21
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);