From 4613ce7f80f2a5d7cebad04bfcdbf01f26980679 Mon Sep 17 00:00:00 2001 From: George Hazan Date: Sun, 9 Mar 2014 18:03:06 +0000 Subject: more correct default sub assignment git-svn-id: http://svn.miranda-ng.org/main/trunk@8515 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c --- src/modules/metacontacts/meta_menu.cpp | 39 +++++++++++++++++----------------- 1 file changed, 20 insertions(+), 19 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 b14e5b0c08..cd71119ba5 100644 --- a/src/modules/metacontacts/meta_menu.cpp +++ b/src/modules/metacontacts/meta_menu.cpp @@ -52,32 +52,33 @@ INT_PTR Meta_Convert(WPARAM wParam, LPARAM lParam) // Create a new metacontact MCONTACT hMetaContact = (MCONTACT)CallService(MS_DB_CONTACT_ADD, 0, 0); - if (hMetaContact) { - DBCachedContact *cc = currDb->m_cache->GetCachedContact(hMetaContact); - if (cc == NULL) - return 0; + if (hMetaContact == NULL) + return NULL; - db_set_dw(hMetaContact, META_PROTO, "NumContacts", 0); - cc->nSubs = 0; + DBCachedContact *cc = currDb->m_cache->GetCachedContact(hMetaContact); + if (cc == NULL) + return 0; - // Add the MetaContact protocol to the new meta contact - CallService(MS_PROTO_ADDTOCONTACT, hMetaContact, (LPARAM)META_PROTO); + db_set_dw(hMetaContact, META_PROTO, "NumContacts", 0); + cc->nSubs = 0; - if (tszGroup) - db_set_ts(hMetaContact, "CList", "Group", tszGroup); + // Add the MetaContact protocol to the new meta contact + CallService(MS_PROTO_ADDTOCONTACT, hMetaContact, (LPARAM)META_PROTO); - // Assign the contact to the MetaContact just created (and make default). - if (!Meta_Assign(wParam, hMetaContact, TRUE)) { - MessageBox(0, TranslateT("There was a problem in assigning the contact to the MetaContact"), TranslateT("Error"), MB_ICONEXCLAMATION); - CallService(MS_DB_CONTACT_DELETE, hMetaContact, 0); - return 0; - } + if (tszGroup) + db_set_ts(hMetaContact, "CList", "Group", tszGroup); - // hide the contact if clist groups disabled (shouldn't create one anyway since menus disabled) - if (!options.bEnabled) - db_set_b(hMetaContact, "CList", "Hidden", 1); + // Assign the contact to the MetaContact just created (and make default). + if (!Meta_Assign(wParam, hMetaContact, TRUE)) { + MessageBox(0, TranslateT("There was a problem in assigning the contact to the MetaContact"), TranslateT("Error"), MB_ICONEXCLAMATION); + CallService(MS_DB_CONTACT_DELETE, hMetaContact, 0); + return 0; } + // hide the contact if clist groups disabled (shouldn't create one anyway since menus disabled) + if (!options.bEnabled) + db_set_b(hMetaContact, "CList", "Hidden", 1); + return hMetaContact; } -- cgit v1.2.3