From 1dbcb0630d8e5c61d528f0f6fb5dfcb3395615c2 Mon Sep 17 00:00:00 2001 From: Gluzskiy Alexandr Date: Fri, 29 Apr 2011 20:23:04 +0300 Subject: modified: main.cpp modified: messages.cpp --- messages.cpp | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) (limited to 'messages.cpp') diff --git a/messages.cpp b/messages.cpp index 4b4a686..3c481f8 100644 --- a/messages.cpp +++ b/messages.cpp @@ -890,14 +890,15 @@ int HookSendMsg(WPARAM w, LPARAM l) static BOOL CALLBACK DlgProcKeyPassword(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam) { - char *inkeyid = UniGetContactSettingUtf(new_key_hcnt, szGPGModuleName, "InKeyID", ""); - new_key_hcnt_mutex.unlock(); - TCHAR *tmp = NULL; - + char *inkeyid = NULL; switch (msg) { case WM_INITDIALOG: { + char *inkeyid = UniGetContactSettingUtf(new_key_hcnt, szGPGModuleName, "InKeyID", ""); + new_key_hcnt_mutex.unlock(); + TCHAR *tmp = NULL; + SetWindowPos(hwndDlg, 0, key_password_rect.left, key_password_rect.top, 0, 0, SWP_NOSIZE|SWP_SHOWWINDOW); TranslateDialogDefault(hwndDlg); string questionstr = "Please enter password for key with ID: "; -- cgit v1.2.3 From cbfa2b64cdcfe881dd60d308b776b3c1792b79b1 Mon Sep 17 00:00:00 2001 From: Gluzskiy Alexandr Date: Fri, 29 Apr 2011 20:26:53 +0300 Subject: modified: messages.cpp --- messages.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'messages.cpp') diff --git a/messages.cpp b/messages.cpp index 3c481f8..384f44b 100644 --- a/messages.cpp +++ b/messages.cpp @@ -895,7 +895,7 @@ static BOOL CALLBACK DlgProcKeyPassword(HWND hwndDlg, UINT msg, WPARAM wParam, L { case WM_INITDIALOG: { - char *inkeyid = UniGetContactSettingUtf(new_key_hcnt, szGPGModuleName, "InKeyID", ""); + inkeyid = UniGetContactSettingUtf(new_key_hcnt, szGPGModuleName, "InKeyID", ""); new_key_hcnt_mutex.unlock(); TCHAR *tmp = NULL; -- cgit v1.2.3 From 7b4388cfbe8d7aa873e8aa6d3717ca301eeb59a3 Mon Sep 17 00:00:00 2001 From: Gluzskiy Alexandr Date: Wed, 12 Oct 2011 16:44:03 +0300 Subject: fixed end of line (will cause problems on non text data) --- messages.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) mode change 100644 => 100755 messages.cpp (limited to 'messages.cpp') diff --git a/messages.cpp b/messages.cpp old mode 100644 new mode 100755 index 384f44b..2d48052 --- a/messages.cpp +++ b/messages.cpp @@ -593,6 +593,8 @@ int SendMsgSvc_func(HANDLE hContact, char *msg, DWORD flags) str.append(tmp); mir_free(tmp); } +/* for(std::wstring::size_type i = str.find(_T("\r\n")); i != std::wstring::npos; i = str.find(_T("\r\n"), i+1)) + str.replace(i, 2, _T("\n")); */ string out; DWORD code; wstring cmd; @@ -612,7 +614,7 @@ int SendMsgSvc_func(HANDLE hContact, char *msg, DWORD flags) cmd += _T("--comment \"\" --no-version "); if(DBGetContactSettingByte(hContact, szGPGModuleName, "bAlwaysTrust", 0)) cmd += _T("--trust-model always "); - cmd += _T("--batch --yes -e -a -r "); + cmd += _T("--batch --yes -e -a -t -r "); TCHAR *tmp2 = mir_a2t(tmp); mir_free(tmp); cmd += tmp2; -- cgit v1.2.3 From 823800856ab18c23357e108bb9d923cee497ea03 Mon Sep 17 00:00:00 2001 From: Gluzskiy Alexandr Date: Wed, 12 Oct 2011 17:12:04 +0300 Subject: modified: messages.cpp modified: new_gpg.vcxproj modified: utilities.cpp --- messages.cpp | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'messages.cpp') diff --git a/messages.cpp b/messages.cpp index 2d48052..44172df 100755 --- a/messages.cpp +++ b/messages.cpp @@ -23,6 +23,8 @@ boost::mutex new_key_hcnt_mutex; bool _terminate = false; int returnNoError(HANDLE hContact); +std::list sent_msgs; + int RecvMsgSvc_func(HANDLE hContact, std::wstring str, char *msg, DWORD flags, DWORD timestamp) { DWORD dbflags = DBEF_UTF; @@ -608,7 +610,9 @@ int SendMsgSvc_func(HANDLE hContact, char *msg, DWORD flags) HistoryLog(hContact, db_event("Failed to encrypt message with GPG", 0,0, DBEF_SENT)); hcontact_data[hContact].msgs_to_pass.push_back("Failed to encrypt message with GPG"); mir_free(msg); - return CallContactService(hContact, PSS_MESSAGE, (WPARAM)flags, (LPARAM)msg); + HANDLE h = (HANDLE)CallContactService(hContact, PSS_MESSAGE, (WPARAM)flags, (LPARAM)msg); + sent_msgs.push_back(h); + return (int)h; } if(!bJabberAPI || !bIsMiranda09) //force jabber to handle encrypted message by itself cmd += _T("--comment \"\" --no-version "); -- cgit v1.2.3 From 448c6ca661ec9c826cd18bd160e050cf21da112c Mon Sep 17 00:00:00 2001 From: Gluzskiy Alexandr Date: Wed, 12 Oct 2011 23:03:15 +0300 Subject: notification on failed delivery --- messages.cpp | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) (limited to 'messages.cpp') diff --git a/messages.cpp b/messages.cpp index 44172df..ab6197c 100755 --- a/messages.cpp +++ b/messages.cpp @@ -610,9 +610,7 @@ int SendMsgSvc_func(HANDLE hContact, char *msg, DWORD flags) HistoryLog(hContact, db_event("Failed to encrypt message with GPG", 0,0, DBEF_SENT)); hcontact_data[hContact].msgs_to_pass.push_back("Failed to encrypt message with GPG"); mir_free(msg); - HANDLE h = (HANDLE)CallContactService(hContact, PSS_MESSAGE, (WPARAM)flags, (LPARAM)msg); - sent_msgs.push_back(h); - return (int)h; + return CallContactService(hContact, PSS_MESSAGE, (WPARAM)flags, (LPARAM)msg); } if(!bJabberAPI || !bIsMiranda09) //force jabber to handle encrypted message by itself cmd += _T("--comment \"\" --no-version "); @@ -752,7 +750,7 @@ int 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; - CallContactService(hContact, PSS_MESSAGE, (WPARAM)flags, (LPARAM)toUTF8(str).c_str()); + sent_msgs.push_back((HANDLE)CallContactService(hContact, PSS_MESSAGE, (WPARAM)flags, (LPARAM)toUTF8(str).c_str())); mir_free(msg); return 0; } -- cgit v1.2.3 From 4d8b70aaee170fa46116f10ef3eed3eb30ceffea Mon Sep 17 00:00:00 2001 From: Gluzskiy Alexandr Date: Wed, 26 Oct 2011 12:27:21 +0300 Subject: fixed crash on key password enter --- messages.cpp | 23 +++++++++++++---------- 1 file changed, 13 insertions(+), 10 deletions(-) (limited to 'messages.cpp') diff --git a/messages.cpp b/messages.cpp index ab6197c..1d7e555 100755 --- a/messages.cpp +++ b/messages.cpp @@ -924,20 +924,23 @@ static BOOL CALLBACK DlgProcKeyPassword(HWND hwndDlg, UINT msg, WPARAM wParam, L if(_tcslen(tmp) > 0) { extern TCHAR *password; - if(IsDlgButtonChecked(hwndDlg, IDC_SAVE_PASSWORD)) + if(password && password[0]) { - if((strlen(inkeyid) > 0) && !IsDlgButtonChecked(hwndDlg, IDC_DEFAULT_PASSWORD)) + if(IsDlgButtonChecked(hwndDlg, IDC_SAVE_PASSWORD)) { - string dbsetting = "szKey_"; - dbsetting += inkeyid; - dbsetting += "_Password"; - DBWriteContactSettingTString(NULL, szGPGModuleName, dbsetting.c_str(), tmp); + if((strlen(inkeyid) > 0) && !IsDlgButtonChecked(hwndDlg, IDC_DEFAULT_PASSWORD)) + { + string dbsetting = "szKey_"; + dbsetting += inkeyid; + dbsetting += "_Password"; + DBWriteContactSettingTString(NULL, szGPGModuleName, dbsetting.c_str(), tmp); + } + else + DBWriteContactSettingTString(NULL, szGPGModuleName, "szKeyPassword", tmp); } - else - DBWriteContactSettingTString(NULL, szGPGModuleName, "szKeyPassword", tmp); + if(password) + delete [] password; } - if(password) - delete [] password; password = new TCHAR [_tcslen(tmp)+1]; _tcscpy(password, tmp); } -- cgit v1.2.3 From ab62cd41fab9a0c941d035041df98f4ae3346339 Mon Sep 17 00:00:00 2001 From: Gluzskiy Alexandr Date: Wed, 26 Oct 2011 12:52:42 +0300 Subject: fixed crash in password enter dialog again --- messages.cpp | 23 ++++++++++------------- 1 file changed, 10 insertions(+), 13 deletions(-) (limited to 'messages.cpp') diff --git a/messages.cpp b/messages.cpp index 1d7e555..dc249da 100755 --- a/messages.cpp +++ b/messages.cpp @@ -924,23 +924,20 @@ static BOOL CALLBACK DlgProcKeyPassword(HWND hwndDlg, UINT msg, WPARAM wParam, L if(_tcslen(tmp) > 0) { extern TCHAR *password; - if(password && password[0]) + if(IsDlgButtonChecked(hwndDlg, IDC_SAVE_PASSWORD)) { - if(IsDlgButtonChecked(hwndDlg, IDC_SAVE_PASSWORD)) + if(inkeyid && inkeyid[0] && !IsDlgButtonChecked(hwndDlg, IDC_DEFAULT_PASSWORD)) { - if((strlen(inkeyid) > 0) && !IsDlgButtonChecked(hwndDlg, IDC_DEFAULT_PASSWORD)) - { - string dbsetting = "szKey_"; - dbsetting += inkeyid; - dbsetting += "_Password"; - DBWriteContactSettingTString(NULL, szGPGModuleName, dbsetting.c_str(), tmp); - } - else - DBWriteContactSettingTString(NULL, szGPGModuleName, "szKeyPassword", tmp); + string dbsetting = "szKey_"; + dbsetting += inkeyid; + dbsetting += "_Password"; + DBWriteContactSettingTString(NULL, szGPGModuleName, dbsetting.c_str(), tmp); } - if(password) - delete [] password; + else + DBWriteContactSettingTString(NULL, szGPGModuleName, "szKeyPassword", tmp); } + if(password) + delete [] password; password = new TCHAR [_tcslen(tmp)+1]; _tcscpy(password, tmp); } -- cgit v1.2.3 From ae82ea7b5c3177c8ad6934a01985a17603162972 Mon Sep 17 00:00:00 2001 From: Gluzskiy Alexandr Date: Wed, 26 Oct 2011 12:53:50 +0300 Subject: modified: ../messages.cpp --- messages.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'messages.cpp') diff --git a/messages.cpp b/messages.cpp index dc249da..c563e78 100755 --- a/messages.cpp +++ b/messages.cpp @@ -921,7 +921,7 @@ static BOOL CALLBACK DlgProcKeyPassword(HWND hwndDlg, UINT msg, WPARAM wParam, L { TCHAR tmp[64]; GetDlgItemText(hwndDlg, IDC_KEY_PASSWORD, tmp, 64); - if(_tcslen(tmp) > 0) + if(tmp[0]) { extern TCHAR *password; if(IsDlgButtonChecked(hwndDlg, IDC_SAVE_PASSWORD)) -- cgit v1.2.3 From 16a477058f150f46a99e2f60cd51502c04a1ed9c Mon Sep 17 00:00:00 2001 From: Gluzskiy Alexandr Date: Thu, 3 Nov 2011 07:38:25 +0200 Subject: fixed default password loading --- messages.cpp | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'messages.cpp') diff --git a/messages.cpp b/messages.cpp index c563e78..e64fd53 100755 --- a/messages.cpp +++ b/messages.cpp @@ -101,28 +101,28 @@ int RecvMsgSvc_func(HANDLE hContact, std::wstring str, char *msg, DWORD flags, D { char *inkeyid = UniGetContactSettingUtf(metaGetMostOnline(hContact), szGPGModuleName, "InKeyID", ""); TCHAR *pass = NULL; - if(strlen(inkeyid) > 0) + if(inkeyid[0]) { string dbsetting = "szKey_"; dbsetting += inkeyid; dbsetting += "_Password"; pass = UniGetContactSettingUtf(NULL, szGPGModuleName, dbsetting.c_str(), _T("")); - if(_tcslen(pass) > 0) + if(pass[0]) debuglog< 0) + if(pass[0]) debuglog< 0) + if(pass && pass[0]) { cmd += _T("--passphrase \""); cmd += pass; cmd += _T("\" "); } - else if(password) + else if(password && password[0]) { debuglog< Date: Tue, 28 Feb 2012 14:20:09 +0200 Subject: added notification "Unable to decrypt PGP encrypted message" --- messages.cpp | 32 ++++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) (limited to 'messages.cpp') diff --git a/messages.cpp b/messages.cpp index e64fd53..58603a2 100755 --- a/messages.cpp +++ b/messages.cpp @@ -164,6 +164,11 @@ int RecvMsgSvc_func(HANDLE hContact, std::wstring str, char *msg, DWORD flags, D debuglog< Date: Sat, 10 Mar 2012 21:13:22 +0200 Subject: copyrights --- messages.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'messages.cpp') diff --git a/messages.cpp b/messages.cpp index 58603a2..fc52aea 100755 --- a/messages.cpp +++ b/messages.cpp @@ -1,4 +1,4 @@ -// Copyright © 2010-2011 sss +// Copyright © 2010-2012 sss // // This program is free software; you can redistribute it and/or // modify it under the terms of the GNU General Public License -- cgit v1.2.3 From 365d949d8ec2712fbdec479e73e78cbbe80b3399 Mon Sep 17 00:00:00 2001 From: Gluzskiy Alexandr Date: Fri, 18 May 2012 22:28:05 +0300 Subject: fixed (#33 Settings) --- messages.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'messages.cpp') diff --git a/messages.cpp b/messages.cpp index fc52aea..74d0c44 100755 --- a/messages.cpp +++ b/messages.cpp @@ -545,7 +545,7 @@ int RecvMsgSvc(WPARAM w, LPARAM l) HistoryLog(ccs->hContact, db_event(msg, 0, 0, dbflags)); return 0; } - if(bAutoExchange && strstr(msg, "-----PGP KEY REQUEST-----") && isGPGConfigured()) + if(bAutoExchange && strstr(msg, "-----PGP KEY REQUEST-----") && gpg_valid && gpg_keyexist) { char *tmp = UniGetContactSettingUtf(NULL, szGPGModuleName, "GPGPubKey", ""); if(tmp[0]) @@ -557,7 +557,7 @@ int RecvMsgSvc(WPARAM w, LPARAM l) DBWriteContactSettingByte(ccs->hContact, szGPGModuleName, "GPGEncryption", 1); } mir_free(tmp); - if(!isContactHaveKey(ccs->hContact) && bAutoExchange && isGPGConfigured()) + if(!isContactHaveKey(ccs->hContact) && bAutoExchange && gpg_valid && gpg_keyexist) { LPSTR proto = (LPSTR)CallService(MS_PROTO_GETCONTACTBASEPROTO, (WPARAM)ccs->hContact, 0); DWORD uin = DBGetContactSettingDword(ccs->hContact, proto, "UIN", 0); @@ -802,7 +802,7 @@ int SendMsgSvc(WPARAM w, LPARAM l) return CallService(MS_PROTO_CHAINSEND, w, l); if(!isContactHaveKey(ccs->hContact)) { - if(bAutoExchange && !strstr(msg, "-----PGP KEY REQUEST-----") && !strstr(msg, "-----BEGIN PGP PUBLIC KEY BLOCK-----") && isGPGConfigured()) + 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); -- cgit v1.2.3 From 9026615fea720ca69d3a3480a69e32e5432db69b Mon Sep 17 00:00:00 2001 From: Gluzskiy Alexandr Date: Sat, 19 May 2012 01:43:48 +0300 Subject: fixed one more metacontacts problem added option to remove own tags in outgoing messages (useful to quote) --- messages.cpp | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 'messages.cpp') diff --git a/messages.cpp b/messages.cpp index 74d0c44..6e69a2a 100755 --- a/messages.cpp +++ b/messages.cpp @@ -627,6 +627,18 @@ int SendMsgSvc_func(HANDLE hContact, char *msg, DWORD flags) str.append(tmp); mir_free(tmp); } + if(bStripTags && bAppendTags) + { + std::wstring::size_type p; + for(p = str.find(inopentag); p != std::wstring::npos; p = str.find(inopentag)) + str.erase(p, _tcslen(inopentag)); + for(p = str.find(inclosetag); p != std::wstring::npos; p = str.find(inclosetag)) + str.erase(p, _tcslen(inclosetag)); + for(p = str.find(outopentag); p != std::wstring::npos; p = str.find(outopentag)) + str.erase(p, _tcslen(outopentag)); + for(p = str.find(outclosetag); p != std::wstring::npos; p = str.find(outclosetag)) + str.erase(p, _tcslen(outclosetag)); + } /* for(std::wstring::size_type i = str.find(_T("\r\n")); i != std::wstring::npos; i = str.find(_T("\r\n"), i+1)) str.replace(i, 2, _T("\n")); */ string out; -- cgit v1.2.3 From 093731d35e605ede9798ace4ac73c77a51012a6c Mon Sep 17 00:00:00 2001 From: Gluzskiy Alexandr Date: Sun, 20 May 2012 07:24:29 +0300 Subject: metacontacts fixes --- messages.cpp | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'messages.cpp') diff --git a/messages.cpp b/messages.cpp index 6e69a2a..db4e404 100755 --- a/messages.cpp +++ b/messages.cpp @@ -54,13 +54,13 @@ int RecvMsgSvc_func(HANDLE hContact, std::wstring str, char *msg, DWORD flags, D } else { - DBWriteContactSettingByte(metaGetMostOnline(hContact), szGPGModuleName, "GPGEncryption", 1); + DBWriteContactSettingByte(metaIsProtoMetaContacts(hContact)?metaGetMostOnline(hContact):hContact, szGPGModuleName, "GPGEncryption", 1); setSrmmIcon(hContact); setClistIcon(hContact); } if(isContactHaveKey(hContact)) { - DBWriteContactSettingByte(metaGetMostOnline(hContact), szGPGModuleName, "GPGEncryption", 1); + DBWriteContactSettingByte(metaIsProtoMetaContacts(hContact)?metaGetMostOnline(hContact):hContact, szGPGModuleName, "GPGEncryption", 1); setSrmmIcon(hContact); setClistIcon(hContact); } @@ -99,7 +99,7 @@ int RecvMsgSvc_func(HANDLE hContact, std::wstring str, char *msg, DWORD flags, D wstring cmd; cmd += _T("--batch "); { - char *inkeyid = UniGetContactSettingUtf(metaGetMostOnline(hContact), szGPGModuleName, "InKeyID", ""); + char *inkeyid = UniGetContactSettingUtf(metaIsProtoMetaContacts(hContact)?metaGetMostOnline(hContact):hContact, szGPGModuleName, "InKeyID", ""); TCHAR *pass = NULL; if(inkeyid[0]) { @@ -195,7 +195,7 @@ int RecvMsgSvc_func(HANDLE hContact, std::wstring str, char *msg, DWORD flags, D s = out.find(" ID ", s); s += strlen(" ID "); string::size_type s2 = out.find(",",s); - DBWriteContactSettingString(metaGetMostOnline(hContact), szGPGModuleName, "InKeyID", out.substr(s, s2-s).c_str()); + DBWriteContactSettingString(metaIsProtoMetaContacts(hContact)?metaGetMostOnline(hContact):hContact, szGPGModuleName, "InKeyID", out.substr(s, s2-s).c_str()); } void ShowLoadKeyPasswordWindow(); new_key_hcnt_mutex.lock(); @@ -352,7 +352,7 @@ int RecvMsgSvc_func(HANDLE hContact, std::wstring str, char *msg, DWORD flags, D } } } - if(DBGetContactSettingByte(metaGetMostOnline(hContact), szGPGModuleName, "GPGEncryption", 0)) + if(DBGetContactSettingByte(metaIsProtoMetaContacts(hContact)?metaGetMostOnline(hContact):hContact, szGPGModuleName, "GPGEncryption", 0)) { if(metaIsSubcontact(hContact)) { -- cgit v1.2.3 From 7b7229fd6fa8df0fbe52f82aa7b08354ddda76ba Mon Sep 17 00:00:00 2001 From: Gluzskiy Alexandr Date: Sat, 2 Jun 2012 06:54:03 +0300 Subject: option to disable prescense subscription metacontacts fix --- messages.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'messages.cpp') diff --git a/messages.cpp b/messages.cpp index db4e404..18b2378 100755 --- a/messages.cpp +++ b/messages.cpp @@ -875,7 +875,7 @@ int SendMsgSvc(WPARAM w, LPARAM l) return CallService(MS_PROTO_CHAINSEND, w, l); } } - if(metaIsProtoMetaContacts(ccs->hContact) || !isContactSecured(ccs->hContact)) + if(!isContactSecured(ccs->hContact) || metaIsProtoMetaContacts(ccs->hContact)) { mir_free(msg); return CallService(MS_PROTO_CHAINSEND, w, l); @@ -917,6 +917,8 @@ int HookSendMsg(WPARAM w, LPARAM l) } event_processing_mutex.unlock(); } + if(metaIsProtoMetaContacts(hContact) && !isContactSecured(metaGetMostOnline(hContact))) + return 0; return 1; } if(!isContactSecured(hContact)) -- cgit v1.2.3