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 +++++++-- src/modules/metacontacts/meta_services.cpp | 3 ++- 2 files changed, 9 insertions(+), 3 deletions(-) (limited to 'src') 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); diff --git a/src/modules/metacontacts/meta_services.cpp b/src/modules/metacontacts/meta_services.cpp index e030a4572a..a12813f2ed 100644 --- a/src/modules/metacontacts/meta_services.cpp +++ b/src/modules/metacontacts/meta_services.cpp @@ -123,7 +123,7 @@ void CALLBACK SetStatusThread(HWND hWnd, UINT msg, UINT_PTR id, DWORD dw) { previousMode = mcStatus; - mcStatus = (int)ID_STATUS_ONLINE; + mcStatus = ID_STATUS_ONLINE; ProtoBroadcastAck(META_PROTO, NULL,ACKTYPE_STATUS,ACKRESULT_SUCCESS, (HANDLE)previousMode, mcStatus); KillTimer(0, setStatusTimerId); @@ -246,6 +246,7 @@ INT_PTR Meta_SendNudge(WPARAM wParam, LPARAM lParam) * * @return 0 on success, 1 otherwise. */ + INT_PTR Meta_SendMessage(WPARAM wParam,LPARAM lParam) { CCSDATA *ccs = (CCSDATA*)lParam; -- cgit v1.2.3