diff options
author | George Hazan <george.hazan@gmail.com> | 2014-03-20 14:47:13 +0000 |
---|---|---|
committer | George Hazan <george.hazan@gmail.com> | 2014-03-20 14:47:13 +0000 |
commit | 5289388e941bbdeca3d380c2f1044228e3397bc0 (patch) | |
tree | 47c9611377af3f3f41ecd65eaa1df5ff6bc9b97b /src/modules/metacontacts | |
parent | 80578cde52fbd2e201ddc6717d689c6d71bf19a0 (diff) |
db_mc_enable, db_mc_isEnabled - new functions to detect whether MC are used
git-svn-id: http://svn.miranda-ng.org/main/trunk@8666 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'src/modules/metacontacts')
-rw-r--r-- | src/modules/metacontacts/meta_main.cpp | 2 | ||||
-rw-r--r-- | src/modules/metacontacts/meta_menu.cpp | 19 | ||||
-rw-r--r-- | src/modules/metacontacts/meta_options.cpp | 2 | ||||
-rw-r--r-- | src/modules/metacontacts/meta_services.cpp | 12 | ||||
-rw-r--r-- | src/modules/metacontacts/metacontacts.h | 1 |
5 files changed, 13 insertions, 23 deletions
diff --git a/src/modules/metacontacts/meta_main.cpp b/src/modules/metacontacts/meta_main.cpp index c031e6ce77..dec65ef7d0 100644 --- a/src/modules/metacontacts/meta_main.cpp +++ b/src/modules/metacontacts/meta_main.cpp @@ -24,8 +24,6 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #include "metacontacts.h"
-BOOL os_unicode_enabled = FALSE;
-
/////////////////////////////////////////////////////////////////////////////////////////
// icolib support
diff --git a/src/modules/metacontacts/meta_menu.cpp b/src/modules/metacontacts/meta_menu.cpp index f6116a03ea..0717647f88 100644 --- a/src/modules/metacontacts/meta_menu.cpp +++ b/src/modules/metacontacts/meta_menu.cpp @@ -76,7 +76,7 @@ INT_PTR Meta_Convert(WPARAM wParam, LPARAM lParam) }
// hide the contact if clist groups disabled (shouldn't create one anyway since menus disabled)
- if (!options.bEnabled)
+ if (!db_mc_isEnabled())
db_set_b(hMetaContact, "CList", "Hidden", 1);
return hMetaContact;
@@ -318,7 +318,7 @@ int Meta_ModifyMenu(WPARAM hMeta, LPARAM lParam) }
PROTOACCOUNT *pa = Proto_GetAccount(cc->szProto);
- if (!options.bEnabled || pa->bIsVirtual) {
+ if (!db_mc_isEnabled() || pa->bIsVirtual) {
// groups disabled - all meta menu options hidden
Menu_ShowItem(hMenuDefault, false);
Menu_ShowItem(hMenuDelete, false);
@@ -360,20 +360,21 @@ INT_PTR Meta_OnOff(WPARAM wParam, LPARAM lParam) {
CLISTMENUITEM mi = { sizeof(mi) };
mi.flags = CMIM_NAME | CMIM_ICON;
- // just write to db - the rest is handled in the Meta_SettingChanged function
- if (db_get_b(0, META_PROTO, "Enabled", 1)) {
- db_set_b(0, META_PROTO, "Enabled", 0);
- // modify main mi item
+
+ bool bToggled = !db_mc_isEnabled();
+ db_set_b(0, META_PROTO, "Enabled", bToggled);
+ if (bToggled) {
mi.icolibItem = GetIconHandle(I_MENU);
mi.pszName = LPGEN("Toggle MetaContacts On");
}
else {
- db_set_b(0, META_PROTO, "Enabled", 1);
- // modify main mi item
mi.icolibItem = GetIconHandle(I_MENUOFF);
mi.pszName = LPGEN("Toggle MetaContacts Off");
}
Menu_ModifyItem(hMenuOnOff, &mi);
+
+ db_mc_enable(bToggled);
+ Meta_HideMetaContacts(bToggled);
return 0;
}
@@ -442,7 +443,7 @@ void InitMenus() Meta_HideLinkedContacts();
- if (!options.bEnabled) {
+ if (!db_mc_isEnabled()) {
// modify main menu item
mi.flags = CMIM_NAME | CMIM_ICON;
mi.icolibItem = GetIconHandle(I_MENU);
diff --git a/src/modules/metacontacts/meta_options.cpp b/src/modules/metacontacts/meta_options.cpp index 382f83d446..1346f0b049 100644 --- a/src/modules/metacontacts/meta_options.cpp +++ b/src/modules/metacontacts/meta_options.cpp @@ -160,7 +160,7 @@ int Meta_WriteOptions(MetaOptions *opt) int Meta_ReadOptions(MetaOptions *opt)
{
- opt->bEnabled = db_get_b(NULL, META_PROTO, "Enabled", true) != 0;
+ db_mc_enable(db_get_b(NULL, META_PROTO, "Enabled", true) != 0);
opt->bSuppressStatus = db_get_b(NULL, META_PROTO, "SuppressStatus", true) != 0;
opt->menu_contact_label = (int)db_get_w(NULL, META_PROTO, "MenuContactLabel", DNT_UID);
opt->menu_function = (int)db_get_w(NULL, META_PROTO, "MenuContactFunction", FT_MENU);
diff --git a/src/modules/metacontacts/meta_services.cpp b/src/modules/metacontacts/meta_services.cpp index a4e14883dd..556b6999f5 100644 --- a/src/modules/metacontacts/meta_services.cpp +++ b/src/modules/metacontacts/meta_services.cpp @@ -314,16 +314,8 @@ int Meta_SettingChanged(WPARAM hContact, LPARAM lParam) char buffer[512], szId[40];
// the only global options we're interested in
- if (hContact == 0) {
- // hide metacontacts when groups disabled
- if ((!strcmp(dcws->szModule, "CList") && !strcmp(dcws->szSetting, "UseGroups")) ||
- (!strcmp(dcws->szModule, META_PROTO) && !strcmp(dcws->szSetting, "Enabled")))
- {
- options.bEnabled = !options.bEnabled;
- Meta_HideMetaContacts(!options.bEnabled);
- }
+ if (hContact == 0)
return 0;
- }
DBCachedContact *cc = currDb->m_cache->GetCachedContact(hContact);
if (cc == NULL || !cc->IsSub())
@@ -521,7 +513,7 @@ INT_PTR Meta_UserIsTyping(WPARAM hMeta, LPARAM lParam) int Meta_ContactIsTyping(WPARAM hContact, LPARAM lParam)
{
- if (!options.bEnabled)
+ if (!db_mc_isEnabled())
return 0;
DBCachedContact *cc = currDb->m_cache->GetCachedContact(hContact);
diff --git a/src/modules/metacontacts/metacontacts.h b/src/modules/metacontacts/metacontacts.h index d550740242..54bbd3eebf 100644 --- a/src/modules/metacontacts/metacontacts.h +++ b/src/modules/metacontacts/metacontacts.h @@ -76,7 +76,6 @@ enum CListDisplayNameType {CNNT_NICK = 0, CNNT_DISPLAYNAME = 1}; struct MetaOptions
{
- bool bEnabled;
bool bLockHandle;
bool bSuppressStatus;
|