From 829c3778ac700f2d64e7032d0727f860196e4417 Mon Sep 17 00:00:00 2001 From: Gluzskiy Alexandr Date: Mon, 21 May 2012 00:38:28 +0300 Subject: fixed another metacontacts problem --- globals.h | 2 +- init.cpp | 5 +++-- srmm.cpp | 3 +++ utilities.cpp | 25 +++++++++++++++++++++++++ utilities.h | 1 + 5 files changed, 33 insertions(+), 3 deletions(-) diff --git a/globals.h b/globals.h index 1d7c9e4..f531cf1 100755 --- a/globals.h +++ b/globals.h @@ -16,7 +16,7 @@ #ifndef GLOBALS_H #define GLOBALS_H -extern bool bAppendTags, bStripTags, gpg_valid, gpg_keyexist; +extern bool bAppendTags, bStripTags, gpg_valid, gpg_keyexist, tabsrmm_used; extern TCHAR *inopentag, *inclosetag, *outopentag, *outclosetag; extern logtofile debuglog; #endif diff --git a/init.cpp b/init.cpp index 5c1f11d..49f372a 100755 --- a/init.cpp +++ b/init.cpp @@ -17,7 +17,7 @@ #include "commonheaders.h" //global variables -bool bAppendTags = false, bDebugLog = false, bJabberAPI = false, bIsMiranda09 = false, bMetaContacts = false, bFileTransfers = false, bAutoExchange = false, bStripTags = false; +bool bAppendTags = false, bDebugLog = false, bJabberAPI = false, bIsMiranda09 = false, bMetaContacts = false, bFileTransfers = false, bAutoExchange = false, bStripTags = false, tabsrmm_used = false; TCHAR *inopentag = NULL, *inclosetag = NULL, *outopentag = NULL, *outclosetag = NULL, *password = NULL; list Accounts; @@ -110,16 +110,17 @@ void init_vars() new_key_rect.top = DBGetContactSettingDword(NULL, szGPGModuleName, "NewKeyWindowY", 0); load_existing_key_rect.left = DBGetContactSettingDword(NULL, szGPGModuleName, "LoadExistingKeyWindowX", 0); load_existing_key_rect.top = DBGetContactSettingDword(NULL, szGPGModuleName, "LoadExistingKeyWindowY", 0); + tabsrmm_used = isTabsrmmUsed(); } extern "C" int __declspec(dllexport) Load(PLUGINLINK *link) { pluginLink=link; - init_vars(); HookEvent(ME_SYSTEM_MODULESLOADED, OnModulesLoaded); mir_getMMI(&mmi); mir_getUTFI(&utfi); mir_getXI(&xi); //TODO: check if we have access to api + init_vars(); CreateServiceFunction("/LoadPubKey",(MIRANDASERVICE)LoadKey); CreateServiceFunction("/ToggleEncryption",(MIRANDASERVICE)ToggleEncryption); CreateServiceFunction("/SendKey",(MIRANDASERVICE)SendKey); diff --git a/srmm.cpp b/srmm.cpp index 763134a..6fc204a 100755 --- a/srmm.cpp +++ b/srmm.cpp @@ -36,7 +36,10 @@ int __cdecl onIconPressed(WPARAM wParam, LPARAM lParam) { HANDLE hContact = (HANDLE)wParam; HANDLE hMeta = NULL; if(metaIsProtoMetaContacts(hContact)) + { + hMeta = hContact; hContact = metaGetMostOnline(hContact); // возьмем тот, через который пойдет сообщение + } else if(metaIsSubcontact(hContact)) hMeta = metaGetContact(hContact); StatusIconClickData *sicd = (StatusIconClickData *)lParam; diff --git a/utilities.cpp b/utilities.cpp index 67e0238..c52edde 100755 --- a/utilities.cpp +++ b/utilities.cpp @@ -1280,3 +1280,28 @@ string time_str() boost::posix_time::ptime now = boost::posix_time::second_clock::local_time(); return (string)boost::posix_time::to_simple_string(now); } + +int handleEnum(const char *szSetting, LPARAM lParam) +{ + if(szSetting[0] && StriStr(szSetting, "tabsrmm")) + { + bool f = false, *found = (bool*)lParam; + f = !DBGetContactSettingByte(NULL, "PluginDisable", szSetting, 0); + if(f) + *found = f; + } + return 0; +} + +bool isTabsrmmUsed() +{ + DBCONTACTENUMSETTINGS enm = {0}; + bool found = false; + enm.lParam = (LPARAM)&found; + enm.pfnEnumProc = (DBSETTINGENUMPROC)&handleEnum; + enm.szModule = "PluginDisable"; + if(CallService(MS_DB_CONTACT_ENUMSETTINGS, (WPARAM)NULL, (LPARAM)&enm) == -1) + return false; + + return found; +} diff --git a/utilities.h b/utilities.h index f27dfca..30e9f68 100755 --- a/utilities.h +++ b/utilities.h @@ -27,6 +27,7 @@ void storeOutput(HANDLE ahandle, string *output); int ComboBoxAddStringUtf(HWND hCombo, const TCHAR *szString, DWORD data); bool isContactSecured(HANDLE hContact); bool isContactHaveKey(HANDLE hContact); +bool isTabsrmmUsed(); bool isGPGKeyExist(); bool isGPGValid(); const bool StriStr(const char *str, const char *substr); -- cgit v1.2.3