From eac56f188d4c4bac1d61c0104f5840ed93d0b0a8 Mon Sep 17 00:00:00 2001
From: George Hazan <george.hazan@gmail.com>
Date: Sat, 1 Mar 2014 12:38:16 +0000
Subject: removing direct access to MC database variables

git-svn-id: http://svn.miranda-ng.org/main/trunk@8347 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
---
 plugins/KeyboardNotify/src/main.cpp | 19 +++----------------
 1 file changed, 3 insertions(+), 16 deletions(-)

(limited to 'plugins/KeyboardNotify')

diff --git a/plugins/KeyboardNotify/src/main.cpp b/plugins/KeyboardNotify/src/main.cpp
index 1ae8c20946..243042486f 100644
--- a/plugins/KeyboardNotify/src/main.cpp
+++ b/plugins/KeyboardNotify/src/main.cpp
@@ -122,28 +122,15 @@ static LRESULT CALLBACK MirandaKeyBoardHookFunction(int, WPARAM, LPARAM);
 static LRESULT CALLBACK MirandaWndProcHookFunction(int, WPARAM, LPARAM);
 BOOL CheckMsgWnd(MCONTACT, BOOL *);
 
-BOOL isMetaContactsSubContact(MCONTACT hMetaContact, MCONTACT hContact)
-{
-	char *szProto = GetContactProto(hMetaContact);
-	if (szProto && !strcmp(META_PROTO, szProto)) { // Safety check
-		int i = db_get_dw(hContact, META_PROTO, "ContactNumber", -1);
-		if (i >= 0 && hContact == (MCONTACT)CallService(MS_MC_GETSUBCONTACT, (WPARAM)hMetaContact, i))
-			return TRUE;
-	}
-	return FALSE;
-}
-
 BOOL checkOpenWindow(MCONTACT hContact)
 {
-	BOOL found, focus;
-
 	if (bFlashIfMsgOpen && !bFlashIfMsgWinNotTop)
 		return TRUE;
 
-	found = CheckMsgWnd(hContact, &focus);
+	BOOL focus, found = CheckMsgWnd(hContact, &focus);
 	if (!found && bMetaProtoEnabled) {
 		MCONTACT hMetaContact = (MCONTACT)db_get_dw(hContact, META_PROTO, "Handle", 0);
-		if (hMetaContact && isMetaContactsSubContact(hMetaContact, hContact))
+		if (hMetaContact && db_mc_getMeta(hContact) == hMetaContact)
 			found = CheckMsgWnd(hMetaContact, &focus);
 	}
 	if (!found)
@@ -382,7 +369,7 @@ BOOL contactCheckProtocol(char *szProto, MCONTACT hContact, WORD eventType)
 {
 	if (bMetaProtoEnabled && hContact) {
 		MCONTACT hMetaContact = (MCONTACT)db_get_dw(hContact, META_PROTO, "Handle", 0);
-		if (hMetaContact && isMetaContactsSubContact(hMetaContact, hContact))
+		if (hMetaContact && db_mc_getMeta(hContact) == hMetaContact)
 			return FALSE;
 	}
 
-- 
cgit v1.2.3