From 0800db775a4da41507478a02fa8cb9e58f35b0c9 Mon Sep 17 00:00:00 2001 From: George Hazan Date: Thu, 27 Feb 2014 19:01:09 +0000 Subject: db_mc_isMeta / db_mc_isSub - first functions of the new cache-based MC layer git-svn-id: http://svn.miranda-ng.org/main/trunk@8311 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c --- src/mir_core/commonheaders.h | 1 + src/mir_core/db.cpp | 21 +++++++++++++++++++++ src/mir_core/mir_core.def | 2 ++ src/mir_core/mir_core_12.vcxproj | 1 + src/mir_core/mir_core_12.vcxproj.filters | 3 +++ src/miranda32_12.vcxproj | 1 + src/miranda32_12.vcxproj.filters | 11 +++++------ src/modules/metacontacts/meta_utils.cpp | 4 +--- 8 files changed, 35 insertions(+), 9 deletions(-) (limited to 'src') diff --git a/src/mir_core/commonheaders.h b/src/mir_core/commonheaders.h index 6e0b88f454..31745ac0a8 100644 --- a/src/mir_core/commonheaders.h +++ b/src/mir_core/commonheaders.h @@ -56,6 +56,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #include #include #include +#include #include "miranda.h" diff --git a/src/mir_core/db.cpp b/src/mir_core/db.cpp index c22b0e1415..2652278143 100644 --- a/src/mir_core/db.cpp +++ b/src/mir_core/db.cpp @@ -320,6 +320,27 @@ MIR_CORE_DLL(HANDLE) db_event_prev(HANDLE hDbEvent) return (currDb == NULL) ? 0 : currDb->FindPrevEvent(hDbEvent); } +///////////////////////////////////////////////////////////////////////////////////////// +// metacontacts + +MIR_CORE_DLL(int) db_mc_isMeta(MCONTACT hContact) +{ + if (currDb == NULL) + return false; + + DBCachedContact *cc = currDb->m_cache->GetCachedContact(hContact); + return (cc == NULL) ? false : cc->nSubs != -1; +} + +MIR_CORE_DLL(int) db_mc_isSub(MCONTACT hContact) +{ + if (currDb == NULL) + return false; + + DBCachedContact *cc = currDb->m_cache->GetCachedContact(hContact); + return (cc == NULL) ? false : cc->parentID != INVALID_CONTACT_ID; +} + ///////////////////////////////////////////////////////////////////////////////////////// // misc functions diff --git a/src/mir_core/mir_core.def b/src/mir_core/mir_core.def index 6b0244e4db..5ff1a5efb5 100644 --- a/src/mir_core/mir_core.def +++ b/src/mir_core/mir_core.def @@ -248,3 +248,5 @@ ProtoLogW @245 db_get_static @246 db_get_wstatic @247 db_get_static_utf @248 +db_mc_isMeta @249 +db_mc_isSub @250 diff --git a/src/mir_core/mir_core_12.vcxproj b/src/mir_core/mir_core_12.vcxproj index 518502e446..c9926e96ef 100644 --- a/src/mir_core/mir_core_12.vcxproj +++ b/src/mir_core/mir_core_12.vcxproj @@ -22,6 +22,7 @@ + diff --git a/src/mir_core/mir_core_12.vcxproj.filters b/src/mir_core/mir_core_12.vcxproj.filters index 43e01d705a..3311ae3578 100644 --- a/src/mir_core/mir_core_12.vcxproj.filters +++ b/src/mir_core/mir_core_12.vcxproj.filters @@ -153,5 +153,8 @@ Header Files + + Header Files + \ No newline at end of file diff --git a/src/miranda32_12.vcxproj b/src/miranda32_12.vcxproj index eece008066..48d1467dcd 100644 --- a/src/miranda32_12.vcxproj +++ b/src/miranda32_12.vcxproj @@ -243,6 +243,7 @@ + diff --git a/src/miranda32_12.vcxproj.filters b/src/miranda32_12.vcxproj.filters index 77ed2ccd0f..34a4c5bb5c 100644 --- a/src/miranda32_12.vcxproj.filters +++ b/src/miranda32_12.vcxproj.filters @@ -273,6 +273,9 @@ Modules\metacontacts + + Modules\metacontacts + @@ -596,12 +599,6 @@ Modules\chat - - Modules\metacontacts - - - Modules\metacontacts - Modules\metacontacts @@ -620,6 +617,8 @@ Modules\metacontacts + + diff --git a/src/modules/metacontacts/meta_utils.cpp b/src/modules/metacontacts/meta_utils.cpp index dfb7be0685..8a307bbb6c 100644 --- a/src/modules/metacontacts/meta_utils.cpp +++ b/src/modules/metacontacts/meta_utils.cpp @@ -713,12 +713,10 @@ int Meta_SetHandles(void) if (contact_number < 0) { // problem! MessageBox(0, TranslateT("Subcontact contact number < 0 - deleting MetaContact"), nick_buffer, MB_OK | MB_ICONERROR); - //CallService(MS_DB_CONTACT_DELETE, (WPARMA)hContact, 0); hNextContact = db_find_next(hContact); - Meta_Delete(hContact, (LPARAM)1); + Meta_Delete(hContact, 1); hContact = hNextContact; continue; - //return 1; } // ensure the window open flag is not present -- cgit v1.2.3