summaryrefslogtreecommitdiff
path: root/messages.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'messages.cpp')
-rwxr-xr-xmessages.cpp14
1 files changed, 12 insertions, 2 deletions
diff --git a/messages.cpp b/messages.cpp
index 7eb598c..e1081b6 100755
--- a/messages.cpp
+++ b/messages.cpp
@@ -333,6 +333,7 @@ void RecvMsgSvc_func(HANDLE hContact, std::wstring str, char *msg, DWORD flags,
}
else
{
+ fix_line_term(str);
if(bAppendTags)
{
str.insert(0, inopentag);
@@ -410,7 +411,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 +448,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 +549,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));
@@ -777,7 +783,10 @@ void SendMsgSvc_func(HANDLE hContact, char *msg, DWORD flags)
path.append(_T(".asc"));
wfstream f(path.c_str(), std::ios::in | std::ios::ate | std::ios::binary);
while(!f.is_open())
+ {
+ boost::this_thread::sleep(boost::posix_time::milliseconds(100));
f.open(path.c_str(), std::ios::in | std::ios::ate | std::ios::binary);
+ }
str.clear();
if(f.is_open())
{
@@ -818,6 +827,7 @@ void SendMsgSvc_func(HANDLE hContact, char *msg, DWORD flags)
HistoryLog(hContact, db_event((char*)str_event.c_str(), 0,0, dbflags|DBEF_SENT));
if(!(flags & PREF_UTF))
flags |= PREF_UTF;
+ fix_line_term(str);
sent_msgs.push_back((HANDLE)CallContactService(hContact, PSS_MESSAGE, (WPARAM)flags, (LPARAM)toUTF8(str).c_str()));
mir_free(msg);
return;