From f3eb289962574b7d42087f65a859a599f6117735 Mon Sep 17 00:00:00 2001 From: Gluzskiy Alexandr Date: Sat, 9 Oct 2010 09:32:19 +0300 Subject: modified: messages.cpp modified: new_gpg.rc modified: options.cpp modified: utilities.cpp --- messages.cpp | 25 ++++++++++++++++++++----- new_gpg.rc | 1 - options.cpp | 4 ---- utilities.cpp | 13 ------------- 4 files changed, 20 insertions(+), 23 deletions(-) diff --git a/messages.cpp b/messages.cpp index 6513867..ed6d252 100644 --- a/messages.cpp +++ b/messages.cpp @@ -370,7 +370,12 @@ int RecvMsgSvc(WPARAM w, LPARAM l) } return CallService(MS_PROTO_CHAINRECV, w, l); } -list msgs_to_ignore; +struct handle_plus_string +{ + string *str; + HANDLE hContact; +}; +list msgs_to_ignore; int SendMsgSvc(WPARAM w, LPARAM l) { CCSDATA *ccs = (CCSDATA*)l; @@ -384,7 +389,14 @@ int SendMsgSvc(WPARAM w, LPARAM l) return CallService(MS_PROTO_CHAINSEND, w, l); HANDLE hContact = ccs->hContact; if(metaIsProtoMetaContacts(hContact)) + { + string str_event = (char*)ccs->lParam; + handle_plus_string *hps = new handle_plus_string; + hps->str = new string(str_event); + hps->hContact = ccs->hContact; + msgs_to_ignore.push_back(hps); return CallService(MS_PROTO_CHAINSEND, w, l); + } // hContact = metaGetCurrent(hContact); if(!DBGetContactSettingByte(hContact, szGPGModuleName, "GPGEncryption", 0)) return CallService(MS_PROTO_CHAINSEND, w, l); @@ -513,7 +525,10 @@ int SendMsgSvc(WPARAM w, LPARAM l) { //dirty hack to avoid metacontacts problem ..., this also broke filters chain int returnNoError(HANDLE hContact); string str_event = (char*)ccs->lParam; - msgs_to_ignore.push_back(new string(str_event)); + handle_plus_string *hps = new handle_plus_string; + hps->str = new string(str_event); + hps->hContact = hContact; + msgs_to_ignore.push_back(hps); if(bAppendTags) { char *opentag = mir_utf8encodeW(outopentag); @@ -550,11 +565,11 @@ int HookSendMsg(WPARAM w, LPARAM l) return 1; if(!msgs_to_ignore.empty()) { - for(list::iterator p = msgs_to_ignore.begin(); p != msgs_to_ignore.end(); p++) + for(list::iterator p = msgs_to_ignore.begin(); p != msgs_to_ignore.end(); p++) { - if(!strcmp((*p)->c_str(), (char*)dbei->pBlob)) + if(((*p)->hContact == (HANDLE)w || (*p)->hContact == metaGetContact((HANDLE)w) || (*p)->hContact == metaGetCurrent((HANDLE)w)) && !strcmp((*p)->str->c_str(), (char*)dbei->pBlob)) { - delete *p; + delete (*p)->str; msgs_to_ignore.remove(*p); return 1; } diff --git a/new_gpg.rc b/new_gpg.rc index b3d41d1..4925e14 100644 --- a/new_gpg.rc +++ b/new_gpg.rc @@ -325,7 +325,6 @@ BEGIN "Button",BS_AUTOCHECKBOX | WS_TABSTOP,11,175,181,10 LTEXT "Статический",IDC_CURRENT_KEY,97,196,116,8 CONTROL "Encrypt file transfers",IDC_FILE_TRANSFERS,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,11,185,137,10 - PUSHBUTTON "Remove filters",IDC_REMOVE_FILTERS,155,135,59,14 END IDD_OPT_GPG_BIN DIALOGEX 0, 0, 282, 214 diff --git a/options.cpp b/options.cpp index 9836d67..fa96843 100644 --- a/options.cpp +++ b/options.cpp @@ -357,10 +357,6 @@ static BOOL CALLBACK DlgProcGpgOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LPARA mir_free(tmp); } break; - case IDC_REMOVE_FILTERS: - void SecureIM_cleanup(); - SecureIM_cleanup(); - break; default: break; } diff --git a/utilities.cpp b/utilities.cpp index e4563ef..ebe38dc 100644 --- a/utilities.cpp +++ b/utilities.cpp @@ -756,19 +756,6 @@ const bool StriStr(const char *str, const char *substr) return i; } -void SecureIM_cleanup() -{ - for (HANDLE hContact = (HANDLE)CallService(MS_DB_CONTACT_FINDFIRST, 0, 0); hContact; hContact = (HANDLE)CallService(MS_DB_CONTACT_FINDNEXT, (WPARAM)hContact, 0)) - { - if(CallService(MS_PROTO_ISPROTOONCONTACT, (WPARAM)hContact, (LPARAM)"SecureIM")) - CallService(MS_PROTO_REMOVEFROMCONTACT, (WPARAM)hContact, (LPARAM)"SecureIM"); - if(CallService(MS_PROTO_ISPROTOONCONTACT, (WPARAM)hContact, (LPARAM)"OTR")) - CallService(MS_PROTO_REMOVEFROMCONTACT, (WPARAM)hContact, (LPARAM)"OTR"); - if(CallService(MS_PROTO_ISPROTOONCONTACT, (WPARAM)hContact, (LPARAM)"GnuPGPlugin")) - CallService(MS_PROTO_REMOVEFROMCONTACT, (WPARAM)hContact, (LPARAM)"GnuPGPlugin"); - } -} - bool IsOnline(HANDLE hContact) { if(DBGetContactSettingByte(hContact, szGPGModuleName, "Status", 0) == ID_STATUS_OFFLINE) -- cgit v1.2.3