From 4535f8706bbb0844fdddd73e7911606d58b7502d Mon Sep 17 00:00:00 2001 From: George Hazan Date: Wed, 23 Jul 2014 18:57:33 +0000 Subject: direct access to META_PROTO removed from tabSRMM git-svn-id: http://svn.miranda-ng.org/main/trunk@9927 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c --- plugins/TabSRMM/src/contactcache.cpp | 13 ++++++------- plugins/TabSRMM/src/contactcache.h | 2 +- plugins/TabSRMM/src/globals.cpp | 10 +--------- plugins/TabSRMM/src/globals.h | 1 - 4 files changed, 8 insertions(+), 18 deletions(-) diff --git a/plugins/TabSRMM/src/contactcache.cpp b/plugins/TabSRMM/src/contactcache.cpp index 1687a8fa82..6d07423bb4 100644 --- a/plugins/TabSRMM/src/contactcache.cpp +++ b/plugins/TabSRMM/src/contactcache.cpp @@ -71,7 +71,7 @@ void CContactCache::initPhaseTwo() m_Valid = (cc->szProto != 0 && m_szAccount != 0) ? true : false; if (m_Valid) { - m_isMeta = PluginConfig.bMetaEnabled && !strcmp(cc->szProto, META_PROTO); + m_isMeta = db_mc_isMeta(cc->contactID) != 0; // don't use cc->IsMeta() here if (m_isMeta) updateMeta(true); updateState(); @@ -503,25 +503,24 @@ CContactCache* CContactCache::getContactCache(MCONTACT hContact) * it is ONLY called from the DBSettingChanged() event handler when the relevant * database value is touched. */ -void CContactCache::cacheUpdateMetaChanged() +int CContactCache::cacheUpdateMetaChanged(WPARAM bMetaEnabled, LPARAM) { - bool fMetaActive = (PluginConfig.bMetaEnabled) ? true : false; - for (int i=0; i < arContacts.getCount(); i++) { CContactCache &c = arContacts[i]; - if (c.isMeta() && PluginConfig.bMetaEnabled == false) { + if (c.isMeta() && !bMetaEnabled) { c.closeWindow(); c.resetMeta(); } // meta contacts are enabled, but current contact is a subcontact - > close window - if (fMetaActive && c.isSubContact()) + if (bMetaEnabled && c.isSubContact()) c.closeWindow(); // reset meta contact information, if metacontacts protocol became avail - if (fMetaActive && !strcmp(c.getProto(), META_PROTO)) + if (bMetaEnabled && !c.cc->IsMeta()) c.resetMeta(); } + return 0; } /** diff --git a/plugins/TabSRMM/src/contactcache.h b/plugins/TabSRMM/src/contactcache.h index 0d8626d2bd..d38a622d6c 100644 --- a/plugins/TabSRMM/src/contactcache.h +++ b/plugins/TabSRMM/src/contactcache.h @@ -124,7 +124,7 @@ struct CContactCache : public MZeroedObject void inputHistoryEvent(WPARAM wParam); static CContactCache* getContactCache(MCONTACT hContact); - static void cacheUpdateMetaChanged(); + static int cacheUpdateMetaChanged(WPARAM wParam, LPARAM lParam); private: void allocStats(); diff --git a/plugins/TabSRMM/src/globals.cpp b/plugins/TabSRMM/src/globals.cpp index 1d0284ce35..c2216f2caa 100644 --- a/plugins/TabSRMM/src/globals.cpp +++ b/plugins/TabSRMM/src/globals.cpp @@ -140,8 +140,6 @@ void CGlobals::reloadSystemModulesChanged() g_iButtonsBarGap = M.GetByte("ButtonsBarGap", 1); m_hwndClist = (HWND)CallService(MS_CLUI_GETHWND, 0, 0); - bMetaEnabled = abs(M.GetByte(META_PROTO, "Enabled", -1)); - g_PopupAvail = ServiceExists(MS_POPUP_ADDPOPUPT); CLISTMENUITEM mi = { sizeof(mi) }; @@ -374,6 +372,7 @@ int CGlobals::ModulesLoaded(WPARAM wParam, LPARAM lParam) HookEvent(ME_FONT_RELOAD, ::FontServiceFontsChanged); HookEvent(ME_TTB_MODULELOADED, TopToolbarLoaded); + HookEvent(ME_MC_ENABLED, &CContactCache::cacheUpdateMetaChanged); HookEvent(ME_MC_DEFAULTTCHANGED, MetaContactEvent); HookEvent(ME_MC_SUBCONTACTSCHANGED, MetaContactEvent); return 0; @@ -424,13 +423,6 @@ int CGlobals::DBSettingChanged(WPARAM hContact, LPARAM lParam) } } - if (hContact == 0 && !lstrcmpA(setting, "Enabled")) { - if (!lstrcmpA(cws->szModule, META_PROTO)) { // catch the disabled meta contacts - PluginConfig.bMetaEnabled = abs(M.GetByte(META_PROTO, "Enabled", -1)); - CContactCache::cacheUpdateMetaChanged(); - } - } - if (lstrcmpA(cws->szModule, "CList") && (szProto == NULL || lstrcmpA(cws->szModule, szProto))) return 0; diff --git a/plugins/TabSRMM/src/globals.h b/plugins/TabSRMM/src/globals.h index 4ff6c49700..f0b031c50f 100644 --- a/plugins/TabSRMM/src/globals.h +++ b/plugins/TabSRMM/src/globals.h @@ -138,7 +138,6 @@ public: BOOL m_autoSplit; BOOL m_FlashOnMTN; DWORD dwThreadID; - BYTE bMetaEnabled; HANDLE m_hMessageWindowList, hUserPrefsWindowList; HMENU m_MenuBar; COLORREF m_ipBackgroundGradient; -- cgit v1.2.3