summaryrefslogtreecommitdiff
path: root/messages.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'messages.cpp')
-rw-r--r--messages.cpp11
1 files changed, 9 insertions, 2 deletions
diff --git a/messages.cpp b/messages.cpp
index f421e4a..88a9097 100644
--- a/messages.cpp
+++ b/messages.cpp
@@ -36,7 +36,7 @@ int RecvMsgSvc_func(HANDLE hContact, std::wstring str, char *msg, DWORD flags)
void setSrmmIcon(HANDLE);
void setClistIcon(HANDLE);
bool isContactHaveKey(HANDLE hContact);
- if(!DBGetContactSettingByte(metaGetMostOnline(hContact), szGPGModuleName, "GPGEncryption", 0))
+ if(!isContactSecured(hContact))
{
debuglog<<time_str()<<": info: "<<"received message from: "<<(TCHAR*)CallService(MS_CLIST_GETCONTACTDISPLAYNAME, (WPARAM)hContact, GCDNF_TCHAR)<<" whith tyrned off encryption\n";
if(MessageBox(0, _T("We received encrypted message from contact with encryption turned off.\nDo you want turn on encryption for this contact ?"), _T("Warning"), MB_YESNO) == IDYES)
@@ -157,6 +157,7 @@ int RecvMsgSvc_func(HANDLE hContact, std::wstring str, char *msg, DWORD flags)
{
delete gpg_thread;
TerminateProcess(params.hProcess, 1);
+ params.hProcess = NULL;
debuglog<<time_str()<<": GPG execution timed out, aborted\n";
DeleteFile(path.c_str());
HistoryLog(hContact, msg, EVENTTYPE_MESSAGE, dbflags);
@@ -207,6 +208,7 @@ int RecvMsgSvc_func(HANDLE hContact, std::wstring str, char *msg, DWORD flags)
{
delete gpg_thread;
TerminateProcess(params.hProcess, 1);
+ params.hProcess = NULL;
debuglog<<time_str()<<": GPG execution timed out, aborted\n";
DeleteFile(path.c_str());
HistoryLog(hContact, msg, EVENTTYPE_MESSAGE, dbflags);
@@ -225,6 +227,7 @@ int RecvMsgSvc_func(HANDLE hContact, std::wstring str, char *msg, DWORD flags)
{
delete gpg_thread;
TerminateProcess(params.hProcess, 1);
+ params.hProcess = NULL;
debuglog<<time_str()<<": GPG execution timed out, aborted\n";
DeleteFile(path.c_str());
HistoryLog(hContact, msg, EVENTTYPE_MESSAGE, dbflags);
@@ -302,7 +305,8 @@ int RecvMsgSvc_func(HANDLE hContact, std::wstring str, char *msg, DWORD flags)
char *msg = mir_strdup(toUTF8(str).c_str());
HistoryLog(hContact, msg, EVENTTYPE_MESSAGE, dbflags|DBEF_READ);
HistoryLog(metaGetContact(hContact), msg, EVENTTYPE_MESSAGE, dbflags);
- return 1;
+ mir_free(msg);
+ return 0;
}
char *tmp = mir_strdup(toUTF8(str).c_str());
HistoryLog(hContact, tmp, EVENTTYPE_MESSAGE, dbflags);
@@ -389,6 +393,7 @@ int RecvMsgSvc(WPARAM w, LPARAM l)
{
gpg_thread.~thread();
TerminateProcess(params.hProcess, 1);
+ params.hProcess = NULL;
debuglog<<time_str()<<": GPG execution timed out, aborted\n";
return 1;
}
@@ -643,6 +648,7 @@ int SendMsgSvc_func(HANDLE hContact, char *msg, DWORD flags)
{
gpg_thread.~thread();
TerminateProcess(params.hProcess, 1);
+ params.hProcess = NULL;
debuglog<<time_str()<<": GPG execution timed out, aborted\n";
mir_free(msg);
return CallContactService(hContact, PSS_MESSAGE, (WPARAM)flags, (LPARAM)msg);
@@ -671,6 +677,7 @@ int SendMsgSvc_func(HANDLE hContact, char *msg, DWORD flags)
{
gpg_thread.~thread();
TerminateProcess(params.hProcess, 1);
+ params.hProcess = NULL;
debuglog<<time_str()<<": GPG execution timed out, aborted\n";
mir_free(msg);
return CallContactService(hContact, PSS_MESSAGE, (WPARAM)flags, (LPARAM)msg);