summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorGeorge Hazan <george.hazan@gmail.com>2014-04-02 20:48:49 +0000
committerGeorge Hazan <george.hazan@gmail.com>2014-04-02 20:48:49 +0000
commitfe7d9276ebedd60308159925eb3f37d9a3b113a0 (patch)
treef428f64f810259da735f9b0b5e6c1f192c85385a /src
parent830d54f9e030a7cf06e5ec7b51a52aa21ab5e457 (diff)
fix for hiding metas' SRMM windows on disabling metacontacts
git-svn-id: http://svn.miranda-ng.org/main/trunk@8830 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'src')
-rw-r--r--src/modules/metacontacts/meta_services.cpp22
-rw-r--r--src/modules/metacontacts/meta_utils.cpp6
-rw-r--r--src/modules/metacontacts/metacontacts.h2
3 files changed, 22 insertions, 8 deletions
diff --git a/src/modules/metacontacts/meta_services.cpp b/src/modules/metacontacts/meta_services.cpp
index 4a283466e9..b0567ebbfd 100644
--- a/src/modules/metacontacts/meta_services.cpp
+++ b/src/modules/metacontacts/meta_services.cpp
@@ -40,6 +40,8 @@ HANDLE
UINT_PTR setStatusTimerId = 0;
BOOL firstSetOnline = TRUE; // see Meta_SetStatus function
+LIST<void> arMetaWindows(1, HandleKeySortT);
+
/** Get the capabilities of the "MetaContacts" protocol.
*
* @param wParam : equals to one of the following values :\n
@@ -540,17 +542,21 @@ int Meta_UserInfo(WPARAM wParam, LPARAM hMeta)
return 1;
}
-// handle message window api ver 0.0.0.1+ events - record window open/close status for subcontacts, so we know whether to
-// let received messages through and add db history to metacontact, or vice versa
+// record window open/close status for subs & metas
int Meta_MessageWindowEvent(WPARAM wParam, LPARAM lParam)
{
MessageWindowEventData *mwed = (MessageWindowEventData *)lParam;
- if (mwed->uType != MSG_WINDOW_EVT_OPEN)
- return 0;
-
- DBCachedContact *cc = currDb->m_cache->GetCachedContact(mwed->hContact);
- if (cc != NULL)
- Meta_UpdateSrmmIcon(cc, db_get_w(cc->contactID, META_PROTO, "Status", ID_STATUS_OFFLINE));
+ if (mwed->uType == MSG_WINDOW_EVT_OPEN) {
+ DBCachedContact *cc = currDb->m_cache->GetCachedContact(mwed->hContact);
+ if (cc != NULL) {
+ Meta_UpdateSrmmIcon(cc, db_get_w(cc->contactID, META_PROTO, "Status", ID_STATUS_OFFLINE));
+ if (cc->IsMeta())
+ arMetaWindows.insert(mwed->hwndWindow);
+ }
+ }
+ else if (mwed->uType == MSG_WINDOW_EVT_CLOSING) {
+ arMetaWindows.remove(mwed->hwndWindow);
+ }
return 0;
}
diff --git a/src/modules/metacontacts/meta_utils.cpp b/src/modules/metacontacts/meta_utils.cpp
index 05fa5aa248..6f3b67bd78 100644
--- a/src/modules/metacontacts/meta_utils.cpp
+++ b/src/modules/metacontacts/meta_utils.cpp
@@ -426,6 +426,12 @@ int Meta_HideMetaContacts(bool bHide)
db_unset(hContact, "CList", "Hidden");
}
+ if (bHide) {
+ for (int i = 0; i < arMetaWindows.getCount(); i++)
+ SendMessage((HWND)arMetaWindows[i], WM_CLOSE, 0, 0);
+ arMetaWindows.destroy();
+ }
+
return 0;
}
diff --git a/src/modules/metacontacts/metacontacts.h b/src/modules/metacontacts/metacontacts.h
index 54bbd3eebf..fcbb9d7336 100644
--- a/src/modules/metacontacts/metacontacts.h
+++ b/src/modules/metacontacts/metacontacts.h
@@ -28,6 +28,8 @@ INT_PTR TranslateMenuFunc(MCONTACT hContact, int i);
void InitMenus();
extern int mcStatus;
+extern LIST<void> arMetaWindows;
+
INT_PTR Meta_Convert(WPARAM wParam,LPARAM lParam);
INT_PTR Meta_AddTo(WPARAM wParam,LPARAM lParam);
INT_PTR Meta_Edit(WPARAM wParam,LPARAM lParam);