summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGeorge Hazan <george.hazan@gmail.com>2014-07-19 13:19:40 +0000
committerGeorge Hazan <george.hazan@gmail.com>2014-07-19 13:19:40 +0000
commite4a8fd6f323b262018bae68bfe87da65cf2092c0 (patch)
tree6fbc3bcfd9bec6c9b0d80fbf99a3a312896a0a24
parente1d41f2f0796cae67948450c3ec6e342b46c1a0b (diff)
db_mc_tryMeta - returns parent hContact for a subcontact or hContact itself if it's not a sub
git-svn-id: http://svn.miranda-ng.org/main/trunk@9859 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
-rw-r--r--bin10/lib/mir_core.libbin59540 -> 59540 bytes
-rw-r--r--bin10/lib/mir_core64.libbin54486 -> 54486 bytes
-rw-r--r--bin12/lib/mir_core.libbin59540 -> 59750 bytes
-rw-r--r--bin12/lib/mir_core64.libbin54486 -> 54678 bytes
-rw-r--r--include/delphi/m_metacontacts.inc4
-rw-r--r--include/m_metacontacts.h5
-rw-r--r--src/mir_core/mc.cpp13
-rw-r--r--src/mir_core/mir_core.def1
-rw-r--r--src/modules/clist/clistevents.cpp3
9 files changed, 21 insertions, 5 deletions
diff --git a/bin10/lib/mir_core.lib b/bin10/lib/mir_core.lib
index 5a6a8b1260..56d7f7db8d 100644
--- a/bin10/lib/mir_core.lib
+++ b/bin10/lib/mir_core.lib
Binary files differ
diff --git a/bin10/lib/mir_core64.lib b/bin10/lib/mir_core64.lib
index e7d6e09ce5..3a2e54ddc6 100644
--- a/bin10/lib/mir_core64.lib
+++ b/bin10/lib/mir_core64.lib
Binary files differ
diff --git a/bin12/lib/mir_core.lib b/bin12/lib/mir_core.lib
index 58b404145c..fc6813f7bd 100644
--- a/bin12/lib/mir_core.lib
+++ b/bin12/lib/mir_core.lib
Binary files differ
diff --git a/bin12/lib/mir_core64.lib b/bin12/lib/mir_core64.lib
index a3d066d042..cdfc4a28cd 100644
--- a/bin12/lib/mir_core64.lib
+++ b/bin12/lib/mir_core64.lib
Binary files differ
diff --git a/include/delphi/m_metacontacts.inc b/include/delphi/m_metacontacts.inc
index ece131c1a6..46becec44c 100644
--- a/include/delphi/m_metacontacts.inc
+++ b/include/delphi/m_metacontacts.inc
@@ -94,6 +94,10 @@ function db_mc_getDefaultNum(hContact:TMCONTACT):int; stdcall;
function db_mc_getMeta(hContact:TMCONTACT):TMCONTACT; stdcall;
external CoreDLL name 'db_mc_getMeta';
+{ returns a meta contact for a subcontact or hContact itself otherwise }
+function db_mc_tryMeta(hContact:TMCONTACT):TMCONTACT; stdcall;
+ external CoreDLL name 'db_mc_tryMeta';
+
{ returns a subcontact with the given index or 0 }
function db_mc_getSub(hContact:TMCONTACT; idx:int):TMCONTACT; stdcall;
external CoreDLL name 'db_mc_getSub';
diff --git a/include/m_metacontacts.h b/include/m_metacontacts.h
index 9ba80dd801..22bc991815 100644
--- a/include/m_metacontacts.h
+++ b/include/m_metacontacts.h
@@ -101,9 +101,12 @@ MIR_CORE_DLL(int) db_mc_getDefaultNum(MCONTACT hMetaContact);
//returns the number of subcontacts, or -1 on failure
MIR_CORE_DLL(int) db_mc_getSubCount(MCONTACT hMetaContact);
-// returns parent hContact for a subcontact or INVALID_CONTACT_ID if it's not a sub
+// returns parent hContact for a subcontact or NULL if it's not a sub
MIR_CORE_DLL(MCONTACT) db_mc_getMeta(MCONTACT hSubContact);
+// returns parent hContact for a subcontact or hContact itself if it's not a sub
+MIR_CORE_DLL(MCONTACT) db_mc_tryMeta(MCONTACT hContact);
+
// returns a subcontact with the given index
MIR_CORE_DLL(MCONTACT) db_mc_getSub(MCONTACT hMetaContact, int iNum);
diff --git a/src/mir_core/mc.cpp b/src/mir_core/mc.cpp
index f25d9ffa88..8fdc9fda4a 100644
--- a/src/mir_core/mc.cpp
+++ b/src/mir_core/mc.cpp
@@ -112,7 +112,7 @@ MIR_CORE_DLL(int) db_mc_getSubCount(MCONTACT hMetaContact)
return (cc == NULL) ? -1 : cc->nSubs;
}
-// returns parent hContact for a subcontact or INVALID_CONTACT_ID if it's not a sub
+// returns parent hContact for a subcontact or NULL if it's not a sub
MIR_CORE_DLL(MCONTACT) db_mc_getMeta(MCONTACT hSubContact)
{
if (currDb == NULL) return false;
@@ -121,6 +121,17 @@ MIR_CORE_DLL(MCONTACT) db_mc_getMeta(MCONTACT hSubContact)
return (cc == NULL) ? NULL : cc->parentID;
}
+// returns parent hContact for a subcontact or hContact itself if it's not a sub
+MIR_CORE_DLL(MCONTACT) db_mc_tryMeta(MCONTACT hContact)
+{
+ if (currDb == NULL) return hContact;
+
+ DBCachedContact *cc = currDb->m_cache->GetCachedContact(hContact);
+ if (cc == NULL) return hContact;
+
+ return (cc->IsSub()) ? cc->parentID : hContact;
+}
+
// returns a subcontact with the given index
MIR_CORE_DLL(MCONTACT) db_mc_getSub(MCONTACT hMetaContact, int iNum)
{
diff --git a/src/mir_core/mir_core.def b/src/mir_core/mir_core.def
index 651e71ee90..cf18d01709 100644
--- a/src/mir_core/mir_core.def
+++ b/src/mir_core/mir_core.def
@@ -265,3 +265,4 @@ LoadLangPackDescr @262
PathIsAbsolute @263
PathIsAbsoluteW @264
db_mc_notifyDefChange @265
+db_mc_tryMeta @266
diff --git a/src/modules/clist/clistevents.cpp b/src/modules/clist/clistevents.cpp
index afbcda362e..f8bf6d9143 100644
--- a/src/modules/clist/clistevents.cpp
+++ b/src/modules/clist/clistevents.cpp
@@ -157,9 +157,6 @@ CListEvent* fnAddEvent(CLISTEVENT *cle)
if (p == NULL)
return NULL;
-// if (db_mc_isSub(cle->hContact))
-// cle->hContact = db_mc_getMeta(cle->hContact);
-
List_Insert((SortedList*)&cli.events, p, i);
p->cle = *cle;
p->imlIconIndex = fnGetImlIconIndex(cli.events.items[i]->cle.hIcon);