diff options
Diffstat (limited to 'messages.cpp')
-rw-r--r-- | messages.cpp | 14 |
1 files changed, 9 insertions, 5 deletions
diff --git a/messages.cpp b/messages.cpp index 6875ece..3cb59c0 100644 --- a/messages.cpp +++ b/messages.cpp @@ -52,7 +52,8 @@ int RecvMsgSvc_func(HANDLE hContact, char *msg, DWORD flags) _tcscat(tmp2, _T("\\")); _tcscat(tmp2, _T("temporary_exported.asc")); DeleteFile(tmp2); - gpg_file_mutex.timed_lock(boost::posix_time::minutes(1)); + while(!gpg_file_mutex.timed_lock(boost::posix_time::seconds(15))) + gpg_file_mutex.unlock(); wfstream f(tmp2, std::ios::out); while(!f.is_open()) f.open(tmp2, std::ios::out); @@ -312,7 +313,8 @@ int RecvMsgSvc_func(HANDLE hContact, char *msg, DWORD flags) wstring path = tmp2; path.append(_T("\\encrypted_data.asc")); DeleteFile(path.c_str()); - gpg_file_mutex.timed_lock(boost::posix_time::minutes(1)); + while(!gpg_file_mutex.timed_lock(boost::posix_time::seconds(15))) + gpg_file_mutex.unlock(); fstream f(path.c_str(), std::ios::out); while(!f.is_open()) f.open(path.c_str(), std::ios::out); @@ -500,7 +502,8 @@ int RecvMsgSvc_func(HANDLE hContact, char *msg, DWORD flags) wstring path = tmp2; mir_free(tmp2); path += _T("\\decrypted_data"); - gpg_file_mutex.timed_lock(boost::posix_time::minutes(1)); + while(!gpg_file_mutex.timed_lock(boost::posix_time::seconds(15))) + gpg_file_mutex.unlock(); fstream f(path.c_str(), std::ios::in | std::ios::ate | std::ios::binary); if(f.is_open()) { @@ -642,7 +645,8 @@ int SendMsgSvc_func(HANDLE hContact, char *msg, DWORD flags) { char *tmp; tmp = mir_strdup(toUTF8(str).c_str()); - gpg_file_mutex.timed_lock(boost::posix_time::minutes(1)); + while(!gpg_file_mutex.timed_lock(boost::posix_time::seconds(15))) + gpg_file_mutex.unlock(); fstream f(path.c_str(), std::ios::out); while(!f.is_open()) f.open(path.c_str(), std::ios::out); @@ -840,7 +844,7 @@ int SendMsgSvc(WPARAM w, LPARAM l) return CallService(MS_PROTO_CHAINSEND, w, l); } } - if(metaIsProtoMetaContacts(ccs->hContact)) + if(metaIsProtoMetaContacts(ccs->hContact) || !isContactSecured(ccs->hContact)) { mir_free(msg); return CallService(MS_PROTO_CHAINSEND, w, l); |