summaryrefslogtreecommitdiff
path: root/src/modules/metacontacts/meta_menu.cpp
diff options
context:
space:
mode:
authorGeorge Hazan <george.hazan@gmail.com>2014-03-05 08:03:50 +0000
committerGeorge Hazan <george.hazan@gmail.com>2014-03-05 08:03:50 +0000
commitd6ffa6b1b553488cd5fd01d2f577575ac4835d61 (patch)
tree363d35e50f9485ea94e983ddf3df2ccb2ae3745f /src/modules/metacontacts/meta_menu.cpp
parent5c347de2dfcfd247918507f8705f50afb613a7e0 (diff)
- unused code removed;
- fix for dynamic adding and removing of subs git-svn-id: http://svn.miranda-ng.org/main/trunk@8402 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'src/modules/metacontacts/meta_menu.cpp')
-rw-r--r--src/modules/metacontacts/meta_menu.cpp17
1 files changed, 9 insertions, 8 deletions
diff --git a/src/modules/metacontacts/meta_menu.cpp b/src/modules/metacontacts/meta_menu.cpp
index 217d7b1895..c2be5c92bd 100644
--- a/src/modules/metacontacts/meta_menu.cpp
+++ b/src/modules/metacontacts/meta_menu.cpp
@@ -125,15 +125,15 @@ void Meta_RemoveContactNumber(DBCachedContact *ccMeta, int number)
if (ccMeta == NULL)
return;
- if (number < 0 && number >= ccMeta->nSubs)
+ // make sure this contact thinks it's part of this metacontact
+ DBCachedContact *ccSub = currDb->m_cache->GetCachedContact(Meta_GetContactHandle(ccMeta, number));
+ if (ccSub == NULL)
return;
- // make sure this contact thinks it's part of this metacontact
- MCONTACT hContact = Meta_GetContactHandle(ccMeta, number);
- if (hContact == ccMeta->contactID) {
+ if (ccSub->parentID == ccMeta->contactID) {
// stop ignoring, if we were
if (options.suppress_status)
- CallService(MS_IGNORE_UNIGNORE, hContact, IGNOREEVENT_USERONLINE);
+ CallService(MS_IGNORE_UNIGNORE, ccSub->contactID, IGNOREEVENT_USERONLINE);
}
// each contact from 'number' upwards will be moved down one
@@ -162,6 +162,7 @@ void Meta_RemoveContactNumber(DBCachedContact *ccMeta, int number)
strcpy(buffer, "CListName"); strcat(buffer, idStr);
db_unset(ccMeta->contactID, META_PROTO, buffer);
+ ccSub->parentID = 0;
currDb->MetaDetouchSub(ccMeta, ccMeta->nSubs - 1);
// if the default contact was equal to or greater than 'number', decrement it (and deal with ends)
@@ -173,18 +174,18 @@ void Meta_RemoveContactNumber(DBCachedContact *ccMeta, int number)
currDb->MetaSetDefault(ccMeta);
NotifyEventHooks(hEventDefaultChanged, ccMeta->contactID, Meta_GetContactHandle(ccMeta, ccMeta->nDefault));
}
+
ccMeta->nSubs--;
db_set_dw(ccMeta->contactID, META_PROTO, "NumContacts", ccMeta->nSubs);
// fix nick
- hContact = Meta_GetMostOnline(ccMeta);
- Meta_CopyContactNick(ccMeta, hContact);
+ Meta_CopyContactNick(ccMeta, Meta_GetMostOnline(ccMeta));
// fix status
Meta_FixStatus(ccMeta);
// fix avatar
- hContact = Meta_GetMostOnlineSupporting(ccMeta, PFLAGNUM_4, PF4_AVATARS);
+ MCONTACT hContact = Meta_GetMostOnlineSupporting(ccMeta, PFLAGNUM_4, PF4_AVATARS);
if (hContact) {
PROTO_AVATAR_INFORMATIONT AI = { sizeof(AI) };
AI.hContact = ccMeta->contactID;