diff options
Diffstat (limited to 'src')
| -rw-r--r-- | src/modules/metacontacts/meta_services.cpp | 22 | ||||
| -rw-r--r-- | src/modules/metacontacts/meta_utils.cpp | 6 | ||||
| -rw-r--r-- | src/modules/metacontacts/metacontacts.h | 2 | 
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);
  | 
