From e91fa6de03f2351bc128a015978a657409d351b4 Mon Sep 17 00:00:00 2001 From: Nvinside Date: Sun, 17 Jul 2011 17:21:00 +0000 Subject: finally a metacontacts solution by the_nic (thanks again) git-svn-id: http://mirotr.googlecode.com/svn/trunk@59 eced67a3-f377-a0ae-92ae-d6de1850b05a --- MirOTR/MirOTR.vcxproj | 4 +++- MirOTR/dbfilter.cpp | 8 ++++++-- MirOTR/svcs_menu.cpp | 5 ++++- MirOTR/svcs_srmm.cpp | 10 +++++++++- MirOTR/version.h | 40 ++++++++++++++++++++-------------------- 5 files changed, 42 insertions(+), 25 deletions(-) (limited to 'MirOTR') diff --git a/MirOTR/MirOTR.vcxproj b/MirOTR/MirOTR.vcxproj index d125e59..2c20a3f 100644 --- a/MirOTR/MirOTR.vcxproj +++ b/MirOTR/MirOTR.vcxproj @@ -41,6 +41,7 @@ DynamicLibrary Unicode + false DynamicLibrary @@ -148,7 +149,8 @@ Level3 ProgramDatabase true - false + + false Fast false diff --git a/MirOTR/dbfilter.cpp b/MirOTR/dbfilter.cpp index 3739ac0..dad975f 100644 --- a/MirOTR/dbfilter.cpp +++ b/MirOTR/dbfilter.cpp @@ -191,7 +191,11 @@ int OnDatabaseEventPreAdd(WPARAM wParam, LPARAM lParam) { info.pBlob = (PBYTE)mir_alloc(info.cbBlob); if(!CallService(MS_DB_EVENT_GET, (WPARAM)lParam, (LPARAM)&info)) { if(info.eventType == EVENTTYPE_MESSAGE) { - HANDLE hContact = (HANDLE)wParam; + HANDLE hContact = (HANDLE)wParam, hSub; + if(options.bHaveMetaContacts && (hSub = (HANDLE)CallService + (MS_MC_GETMOSTONLINECONTACT, (WPARAM)hContact, 0)) != 0) { + hContact = hSub; + } ConnContext *context = otrl_context_find_miranda(otr_user_state, hContact); if (context && otr_context_get_trust(context) != TRUST_NOT_PRIVATE ) { // only delete encrypted messages that are no OTR system messages @@ -242,7 +246,7 @@ void FinishSession(HANDLE hContact) { int StatusModeChange(WPARAM wParam, LPARAM lParam) { int status = (int)wParam; - if(Miranda_Terminated() || status != ID_STATUS_OFFLINE ) return 0; + if(status != ID_STATUS_OFFLINE ) return 0; const char *proto = (char *)lParam; HANDLE hContact; diff --git a/MirOTR/svcs_menu.cpp b/MirOTR/svcs_menu.cpp index f814774..3b3eefe 100644 --- a/MirOTR/svcs_menu.cpp +++ b/MirOTR/svcs_menu.cpp @@ -101,7 +101,10 @@ INT_PTR SVC_StopOTR(WPARAM wParam, LPARAM lParam) { } INT_PTR SVC_VerifyOTR(WPARAM wParam, LPARAM lParam) { - HANDLE hContact = (HANDLE)wParam; + HANDLE hContact = (HANDLE)wParam, hSub; + if(options.bHaveMetaContacts && (hSub = (HANDLE)CallService(MS_MC_GETMOSTONLINECONTACT, (WPARAM)hContact, 0)) != 0) { + hContact = hSub; + } ConnContext *context = otrl_context_find_miranda(otr_user_state, (HANDLE)wParam); if (!context) return 1; //VerifyContextDialog(context); diff --git a/MirOTR/svcs_srmm.cpp b/MirOTR/svcs_srmm.cpp index 7df79a0..b8b8a87 100644 --- a/MirOTR/svcs_srmm.cpp +++ b/MirOTR/svcs_srmm.cpp @@ -197,10 +197,18 @@ void SetEncryptionStatus(HANDLE hContact, TrustLevel level) { if(!chat_room && options.bHaveMetaContacts) { HANDLE hMeta = (HANDLE)CallService(MS_MC_GETMETACONTACT, (WPARAM)hContact, 0); - if(hMeta && hContact == (HANDLE)CallService(MS_MC_GETMOSTONLINECONTACT, (WPARAM)hMeta, 0)) { + HANDLE hMostOnline = (HANDLE)CallService(MS_MC_GETMOSTONLINECONTACT, (WPARAM)hMeta, 0); + if(hMeta && hContact == hMostOnline) { //strcat(dbg_msg, "\nrecursing for meta"); SetEncryptionStatus(hMeta, level); } + else if(hMeta) { + /* in case the new most online contact has changed + (e.g. when the otr subcontact goes offline) */ + ConnContext *context = otrl_context_find_miranda(otr_user_state, hMostOnline); + TrustLevel encrypted = otr_context_get_trust(context); + SetEncryptionStatus(hMeta, encrypted); + } } } //PUShowMessage(dbg_msg, SM_NOTIFY); diff --git a/MirOTR/version.h b/MirOTR/version.h index c536358..2c9a6c5 100644 --- a/MirOTR/version.h +++ b/MirOTR/version.h @@ -2,13 +2,13 @@ #define OTR_PRIVATE_H /* VERSION DEFINITIONS */ -#define VER_MAJOR 0 -#define VER_MINOR 11 -#define VER_RELEASE 0 -#define VER_BUILD 2 +#define VER_MAJOR 0 +#define VER_MINOR 11 +#define VER_RELEASE 0 +#define VER_BUILD 3 -#define __STRINGIZE(x) #x -#define VER_STRING "0.11.0.2" +#define __STRINGIZE(x) #x +#define VER_STRING "0.11.0.3" #ifdef _UNICODE #define SHORT_NAME_STRING "Miranda OTR" @@ -17,21 +17,21 @@ #define SHORT_NAME_STRING "Miranda OTR (x64)" #define DESC_STRING "OTR (Off-the-Record) plugin for Miranda IM (64Bit)" #endif -#define LONGDESC_STRING DESC_STRING" ("__DATE__")\r\n(using some code and ideas from SecureIM, Pidgin-OTR and old Miranda OTR (by SJE))" -#define COMPANY_NAME "" -#define FILE_VERSION VER_STRING -#define FILE_DESCRIPTION DESC_STRING -#define INTERNAL_NAME "" -#define LEGAL_COPYRIGHT "© ProgAndy & CHEF-KOCH" -#define LEGAL_COPYRIGHT_LONG "© ProgAndy & CHEF-KOCH" -#define LEGAL_TRADEMARKS "" -#define ORIGINAL_FILENAME "mirotr.dll" -#define PRODUCT_NAME DESC_STRING -#define PRODUCT_VERSION VER_STRING +#define LONGDESC_STRING DESC_STRING" ("__DATE__")\r\n(using some code and ideas from SecureIM, Pidgin-OTR and old Miranda OTR (by SJE))" +#define COMPANY_NAME "" +#define FILE_VERSION VER_STRING +#define FILE_DESCRIPTION DESC_STRING +#define INTERNAL_NAME "" +#define LEGAL_COPYRIGHT "© ProgAndy & CHEF-KOCH" +#define LEGAL_COPYRIGHT_LONG "© ProgAndy & CHEF-KOCH" +#define LEGAL_TRADEMARKS "" +#define ORIGINAL_FILENAME "mirotr.dll" +#define PRODUCT_NAME DESC_STRING +#define PRODUCT_VERSION VER_STRING -#define AUTHOR "ProgAndy & CHEF-KOCH" -#define AUTHOR_MAIL "" -#define HOMEPAGE "http://progandy.co.cc" +#define AUTHOR "ProgAndy & CHEF-KOCH" +#define AUTHOR_MAIL "" +#define HOMEPAGE "http://progandy.co.cc" #endif /*OTR_PRIVATE_H*/ -- cgit v1.2.3