From e8114cc2abc2516333bc341e0398caef1700baad Mon Sep 17 00:00:00 2001 From: George Hazan Date: Mon, 3 Mar 2014 19:06:57 +0000 Subject: fix for removing a sub from mc git-svn-id: http://svn.miranda-ng.org/main/trunk@8387 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c --- src/modules/metacontacts/meta_menu.cpp | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) (limited to 'src/modules/metacontacts/meta_menu.cpp') diff --git a/src/modules/metacontacts/meta_menu.cpp b/src/modules/metacontacts/meta_menu.cpp index 5cc3777495..bbb4f27426 100644 --- a/src/modules/metacontacts/meta_menu.cpp +++ b/src/modules/metacontacts/meta_menu.cpp @@ -157,6 +157,8 @@ void Meta_RemoveContactNumber(DBCachedContact *ccMeta, int number) strcpy(buffer, "CListName"); strcat(buffer, idStr); db_unset(ccMeta->contactID, META_PROTO, buffer); + currDb->MetaDetouchSub(ccMeta, ccMeta->nSubs - 1); + // if the default contact was equal to or greater than 'number', decrement it (and deal with ends) if (ccMeta->nDefault >= number) { ccMeta->nDefault--; @@ -205,7 +207,7 @@ INT_PTR Meta_Delete(WPARAM hContact, LPARAM bSkipQuestion) return 0; // The wParam is a metacontact - if (cc->nSubs != -1) { + if (IsMeta(cc)) { // check from recursion - see second half of this function if (!bSkipQuestion && IDYES != MessageBox((HWND)CallService(MS_CLUI_GETHWND, 0, 0), @@ -224,7 +226,10 @@ INT_PTR Meta_Delete(WPARAM hContact, LPARAM bSkipQuestion) NotifyEventHooks(hSubcontactsChanged, hContact, 0); CallService(MS_DB_CONTACT_DELETE, hContact, 0); } - else { + else if (IsSub(cc)) { + if ((cc = currDb->m_cache->GetCachedContact(cc->parentID)) == NULL) + return 0; + if (cc->nSubs == 1) { if (IDYES == MessageBox(0, TranslateT(szDelMsg), TranslateT("Delete MetaContact?"), MB_ICONQUESTION | MB_YESNO | MB_DEFBUTTON1)) Meta_Delete(hContact, 1); -- cgit v1.2.3