diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/mir_core/mc.cpp | 13 | ||||
-rw-r--r-- | src/mir_core/mir_core.def | 1 | ||||
-rw-r--r-- | src/modules/clist/clistevents.cpp | 3 |
3 files changed, 13 insertions, 4 deletions
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);
|