summaryrefslogtreecommitdiff
path: root/src/modules/metacontacts
diff options
context:
space:
mode:
authorGeorge Hazan <george.hazan@gmail.com>2014-03-15 18:33:34 +0000
committerGeorge Hazan <george.hazan@gmail.com>2014-03-15 18:33:34 +0000
commit9591bca42dfaeecdbcddd9c0986e3a9819abf92c (patch)
treedcce4251c8ea8670d06e6f91d4dd1fa7cc28edb0 /src/modules/metacontacts
parentb4fe4edd09a47637aba34d227951b39fed0a4bfa (diff)
correct hiding/unhiding of subs when one turns MC on/off
git-svn-id: http://svn.miranda-ng.org/main/trunk@8629 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'src/modules/metacontacts')
-rw-r--r--src/modules/metacontacts/meta_services.cpp23
-rw-r--r--src/modules/metacontacts/meta_utils.cpp19
-rw-r--r--src/modules/metacontacts/metacontacts.h2
3 files changed, 21 insertions, 23 deletions
diff --git a/src/modules/metacontacts/meta_services.cpp b/src/modules/metacontacts/meta_services.cpp
index ad51900526..3ed877f6e6 100644
--- a/src/modules/metacontacts/meta_services.cpp
+++ b/src/modules/metacontacts/meta_services.cpp
@@ -302,13 +302,6 @@ int Meta_HandleACK(WPARAM wParam, LPARAM lParam)
return ProtoBroadcastAck(META_PROTO, cc->contactID, ack->type, ack->result, ack->hProcess, ack->lParam);
}
-// hiding contacts on "CList/UseGroups" setting changed can cause a crash - do it in a seperate thread during idle time
-static DWORD sttHideContacts(BOOL param)
-{
- Meta_HideMetaContacts((int)param);
- return 0;
-}
-
/** Call whenever a contact changes one of its settings (for example, the status)
**
* @param wParam HANDLE to the contact that has change of its setting.
@@ -320,17 +313,17 @@ int Meta_SettingChanged(WPARAM hContact, LPARAM lParam)
DBCONTACTWRITESETTING *dcws = (DBCONTACTWRITESETTING *)lParam;
char buffer[512], szId[40];
- // hide metacontacts when groups disabled
- if (hContact == 0)
+ // 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"))) {
- sttHideContacts(!options.bEnabled);
- return 0;
+ (!strcmp(dcws->szModule, META_PROTO) && !strcmp(dcws->szSetting, "Enabled")))
+ {
+ options.bEnabled = !options.bEnabled;
+ Meta_HideMetaContacts(!options.bEnabled);
}
-
- // from here on, we're just interested in subcontact settings
- if (hContact == 0)
return 0;
+ }
DBCachedContact *cc = currDb->m_cache->GetCachedContact(hContact);
if (cc == NULL || !cc->IsSub())
diff --git a/src/modules/metacontacts/meta_utils.cpp b/src/modules/metacontacts/meta_utils.cpp
index 370295e59d..a30442c6ec 100644
--- a/src/modules/metacontacts/meta_utils.cpp
+++ b/src/modules/metacontacts/meta_utils.cpp
@@ -433,19 +433,24 @@ int Meta_HideLinkedContacts(void)
return 0;
}
-int Meta_HideMetaContacts(int hide)
+int Meta_HideMetaContacts(bool bHide)
{
// set status suppression
- if (hide)
- Meta_SuppressStatus(FALSE);
- else
- Meta_SuppressStatus(options.bSuppressStatus);
+ bool bSuppress = bHide ? FALSE : options.bSuppressStatus;
for (MCONTACT hContact = db_find_first(); hContact; hContact = db_find_next(hContact)) {
- if (CheckMeta(hContact) == NULL)
+ bool bSet;
+ DBCachedContact *cc = currDb->m_cache->GetCachedContact(hContact);
+ if (cc->IsSub()) { // show on hide, reverse flag
+ bSet = !bHide;
+ CallService(bSuppress ? MS_IGNORE_IGNORE : MS_IGNORE_UNIGNORE, hContact, IGNOREEVENT_USERONLINE);
+ }
+ else if (cc->IsMeta())
+ bSet = bHide;
+ else
continue;
- if (hide)
+ if (bSet)
db_set_b(hContact, "CList", "Hidden", 1);
else
db_unset(hContact, "CList", "Hidden");
diff --git a/src/modules/metacontacts/metacontacts.h b/src/modules/metacontacts/metacontacts.h
index f323791ee9..b8d9b10921 100644
--- a/src/modules/metacontacts/metacontacts.h
+++ b/src/modules/metacontacts/metacontacts.h
@@ -41,7 +41,7 @@ void Meta_RemoveContactNumber(DBCachedContact *cc, int number, bool bUpdateInfo)
int Meta_SetNick(char *proto);
int Meta_HideLinkedContacts(void);
int Meta_GetContactNumber(DBCachedContact *cc, MCONTACT hContact);
-int Meta_HideMetaContacts(int hide);
+int Meta_HideMetaContacts(bool hide);
int Meta_SuppressStatus(int suppress);
int Meta_CopyContactNick(DBCachedContact *cc, MCONTACT hContact);
int Meta_SetAllNicks();