From aeff43204a4f2b583f9f83b383be00cac89cbd4e Mon Sep 17 00:00:00 2001 From: George Hazan Date: Thu, 6 Mar 2014 13:36:00 +0000 Subject: stubs for metahistory were slightly changed git-svn-id: http://svn.miranda-ng.org/main/trunk@8429 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c --- include/m_db_int.h | 4 ++-- plugins/Db3x_mmap/src/dbcontacts.cpp | 4 ++-- plugins/Db3x_mmap/src/dbintf.h | 4 ++-- src/modules/metacontacts/meta_menu.cpp | 2 ++ src/modules/metacontacts/meta_utils.cpp | 18 +++++++----------- 5 files changed, 15 insertions(+), 17 deletions(-) diff --git a/include/m_db_int.h b/include/m_db_int.h index 3b913f7bb0..4848bad326 100644 --- a/include/m_db_int.h +++ b/include/m_db_int.h @@ -114,8 +114,8 @@ interface MIDatabase STDMETHOD_(BOOL, MetaDetouchSub)(DBCachedContact*, int nSub) PURE; STDMETHOD_(BOOL, MetaSetDefault)(DBCachedContact*) PURE; - STDMETHOD_(BOOL, MetaMergeHistory)(DBCachedContact *ccMeta, MCONTACT hSub) PURE; - STDMETHOD_(BOOL, MetaSplitHistory)(DBCachedContact *ccMeta, MCONTACT hSub) PURE; + STDMETHOD_(BOOL, MetaMergeHistory)(DBCachedContact *ccMeta, DBCachedContact *ccSub) PURE; + STDMETHOD_(BOOL, MetaSplitHistory)(DBCachedContact *ccMeta, DBCachedContact *ccSub) PURE; }; /////////////////////////////////////////////////////////////////////////////// diff --git a/plugins/Db3x_mmap/src/dbcontacts.cpp b/plugins/Db3x_mmap/src/dbcontacts.cpp index e384319cfb..cd682c311b 100644 --- a/plugins/Db3x_mmap/src/dbcontacts.cpp +++ b/plugins/Db3x_mmap/src/dbcontacts.cpp @@ -213,12 +213,12 @@ BOOL CDb3Mmap::MetaSetDefault(DBCachedContact *cc) return db_set_dw(cc->contactID, META_PROTO, "Default", cc->nDefault); } -BOOL CDb3Mmap::MetaMergeHistory(DBCachedContact *ccMeta, MCONTACT hSub) +BOOL CDb3Mmap::MetaMergeHistory(DBCachedContact *ccMeta, DBCachedContact *ccSub) { return 0; } -BOOL CDb3Mmap::MetaSplitHistory(DBCachedContact *ccMeta, MCONTACT hSub) +BOOL CDb3Mmap::MetaSplitHistory(DBCachedContact *ccMeta, DBCachedContact *ccSub) { return 0; } diff --git a/plugins/Db3x_mmap/src/dbintf.h b/plugins/Db3x_mmap/src/dbintf.h index 253d7e803c..63df6f6a9b 100644 --- a/plugins/Db3x_mmap/src/dbintf.h +++ b/plugins/Db3x_mmap/src/dbintf.h @@ -236,8 +236,8 @@ public: STDMETHODIMP_(BOOL) MetaDetouchSub(DBCachedContact *cc, int nSub); STDMETHODIMP_(BOOL) MetaSetDefault(DBCachedContact *cc); - STDMETHODIMP_(BOOL) MetaMergeHistory(DBCachedContact *ccMeta, MCONTACT hSub); - STDMETHODIMP_(BOOL) MetaSplitHistory(DBCachedContact *ccMeta, MCONTACT hSub); + STDMETHODIMP_(BOOL) MetaMergeHistory(DBCachedContact *ccMeta, DBCachedContact *ccSub); + STDMETHODIMP_(BOOL) MetaSplitHistory(DBCachedContact *ccMeta, DBCachedContact *ccSub); protected: STDMETHODIMP_(BOOL) Start(DBCHeckCallback *callback); diff --git a/src/modules/metacontacts/meta_menu.cpp b/src/modules/metacontacts/meta_menu.cpp index fe5ac94efa..054081febe 100644 --- a/src/modules/metacontacts/meta_menu.cpp +++ b/src/modules/metacontacts/meta_menu.cpp @@ -126,6 +126,8 @@ void Meta_RemoveContactNumber(DBCachedContact *ccMeta, int number, bool bUpdateI ccSub->parentID = 0; currDb->MetaDetouchSub(ccMeta, ccMeta->nSubs - 1); + currDb->MetaSplitHistory(ccMeta, ccSub); + // if the default contact was equal to or greater than 'number', decrement it (and deal with ends) if (ccMeta->nDefault >= number) { ccMeta->nDefault--; diff --git a/src/modules/metacontacts/meta_utils.cpp b/src/modules/metacontacts/meta_utils.cpp index 37c9691dfd..af13339382 100644 --- a/src/modules/metacontacts/meta_utils.cpp +++ b/src/modules/metacontacts/meta_utils.cpp @@ -83,8 +83,6 @@ int Meta_SetNick(char *szProto) BOOL Meta_Assign(MCONTACT hSub, MCONTACT hMeta, BOOL set_as_default) { - char buffer[512], szId[40]; - DBCachedContact *ccDest = CheckMeta(hMeta), *ccSub = currDb->m_cache->GetCachedContact(hSub); if (ccDest == NULL || ccSub == NULL) return FALSE; @@ -110,7 +108,8 @@ BOOL Meta_Assign(MCONTACT hSub, MCONTACT hMeta, BOOL set_as_default) return FALSE; } - ccDest->nSubs++; + char szId[40]; + _itoa(ccDest->nSubs++, szId, 10); if (ccDest->nSubs >= MAX_CONTACTS) { MessageBox(0, TranslateT("MetaContact is full"), TranslateT("Assignment error"), MB_OK | MB_ICONWARNING); db_free(&dbv); @@ -118,9 +117,8 @@ BOOL Meta_Assign(MCONTACT hSub, MCONTACT hMeta, BOOL set_as_default) } // write the contact's protocol - strcpy(buffer, "Protocol"); - strcat(buffer, _itoa(ccDest->nSubs - 1, szId, 10)); - + char buffer[512]; + strcpy(buffer, "Protocol"); strcat(buffer, szId); if (db_set_s(hMeta, META_PROTO, buffer, szProto)) { MessageBox(0, TranslateT("Could not write contact protocol to MetaContact"), TranslateT("Assignment error"), MB_OK | MB_ICONWARNING); db_free(&dbv); @@ -128,9 +126,7 @@ BOOL Meta_Assign(MCONTACT hSub, MCONTACT hMeta, BOOL set_as_default) } // write the login - strcpy(buffer, "Login"); - strcat(buffer, szId); - + strcpy(buffer, "Login"); strcat(buffer, szId); if (db_set(hMeta, META_PROTO, buffer, &dbv)) { MessageBox(0, TranslateT("Could not write unique ID of contact to MetaContact"), TranslateT("Assignment error"), MB_OK | MB_ICONWARNING); db_free(&dbv); @@ -210,8 +206,8 @@ BOOL Meta_Assign(MCONTACT hSub, MCONTACT hMeta, BOOL set_as_default) db_set_ts(hMeta, "ContactPhoto", "File", AI.filename); } - // !!!!!!!!!!!!!!!!!!!!!!!!! - // copyHistory(hSub, hMeta); + // merge sub's events to the meta-history + currDb->MetaMergeHistory(ccDest, ccSub); // Ignore status if the option is on if (options.suppress_status) -- cgit v1.2.3