summaryrefslogtreecommitdiff
path: root/src/mir_app
diff options
context:
space:
mode:
authorGeorge Hazan <ghazan@miranda.im>2018-10-17 14:52:12 +0300
committerGeorge Hazan <ghazan@miranda.im>2018-10-17 14:52:12 +0300
commitb80bf9c6208115addd64726fc6904f1543c63952 (patch)
tree7e9b49eed8ce720b0aa03e8613c2e9dc610c0d9b /src/mir_app
parente487efd9f7383fb73d00c0622923542b831b05a3 (diff)
fixes #1626 (Dbx_mdbx: subcontact's history disappears after removing a subcontact instead of saving in meta)
Diffstat (limited to 'src/mir_app')
-rw-r--r--src/mir_app/src/MDatabaseCommon.cpp5
-rw-r--r--src/mir_app/src/MDatabaseReadonly.cpp5
-rw-r--r--src/mir_app/src/meta_menu.cpp10
-rw-r--r--src/mir_app/src/meta_services.cpp2
-rw-r--r--src/mir_app/src/metacontacts.h2
-rw-r--r--src/mir_app/src/mir_app.def2
-rw-r--r--src/mir_app/src/mir_app64.def2
7 files changed, 23 insertions, 5 deletions
diff --git a/src/mir_app/src/MDatabaseCommon.cpp b/src/mir_app/src/MDatabaseCommon.cpp
index bbe5f27877..123c1e27b4 100644
--- a/src/mir_app/src/MDatabaseCommon.cpp
+++ b/src/mir_app/src/MDatabaseCommon.cpp
@@ -195,6 +195,11 @@ BOOL MDatabaseCommon::MetaSetDefault(DBCachedContact *cc)
return WriteContactSetting(cc->contactID, &cws);
}
+BOOL MDatabaseCommon::MetaRemoveSubHistory(DBCachedContact*)
+{
+ return 1;
+}
+
/////////////////////////////////////////////////////////////////////////////////////////
// Getting settings
diff --git a/src/mir_app/src/MDatabaseReadonly.cpp b/src/mir_app/src/MDatabaseReadonly.cpp
index 96226aa709..9d487d18f2 100644
--- a/src/mir_app/src/MDatabaseReadonly.cpp
+++ b/src/mir_app/src/MDatabaseReadonly.cpp
@@ -135,6 +135,11 @@ BOOL MDatabaseReadonly::MetaSplitHistory(DBCachedContact*, DBCachedContact*)
return 1;
}
+BOOL MDatabaseReadonly::MetaRemoveSubHistory(DBCachedContact*)
+{
+ return 1;
+}
+
/////////////////////////////////////////////////////////////////////////////////////////
MEVENT MDatabaseReadonly::GetEventById(LPCSTR, LPCSTR)
diff --git a/src/mir_app/src/meta_menu.cpp b/src/mir_app/src/meta_menu.cpp
index 46fdc97adc..a98397b627 100644
--- a/src/mir_app/src/meta_menu.cpp
+++ b/src/mir_app/src/meta_menu.cpp
@@ -87,7 +87,7 @@ INT_PTR Meta_Convert(WPARAM wParam, LPARAM)
/////////////////////////////////////////////////////////////////////////////////////////
// Removes a sub from a metacontact
-void Meta_RemoveContactNumber(DBCachedContact *ccMeta, int number, bool bUpdateInfo)
+void Meta_RemoveContactNumber(DBCachedContact *ccMeta, int number, bool bUpdateInfo, bool bDeleteSub)
{
if (ccMeta == nullptr)
return;
@@ -134,10 +134,14 @@ void Meta_RemoveContactNumber(DBCachedContact *ccMeta, int number, bool bUpdateI
db_unset(ccMeta->contactID, META_PROTO, buffer);
if (ccSub != nullptr) {
- ccSub->parentID = 0;
currDb->MetaDetouchSub(ccMeta, ccMeta->nSubs - 1);
- currDb->MetaSplitHistory(ccMeta, ccSub);
+ if (bDeleteSub)
+ currDb->MetaRemoveSubHistory(ccSub);
+ else {
+ currDb->MetaSplitHistory(ccMeta, ccSub);
+ ccSub->parentID = 0;
+ }
}
// if the default contact was equal to or greater than 'number', decrement it (and deal with ends)
diff --git a/src/mir_app/src/meta_services.cpp b/src/mir_app/src/meta_services.cpp
index 8e00dc8fe8..c57b4600b4 100644
--- a/src/mir_app/src/meta_services.cpp
+++ b/src/mir_app/src/meta_services.cpp
@@ -457,7 +457,7 @@ int Meta_ContactDeleted(WPARAM hContact, LPARAM)
if (cc->IsSub()) {
DBCachedContact *ccMeta = CheckMeta(cc->parentID);
if (ccMeta) {
- Meta_RemoveContactNumber(ccMeta, Meta_GetContactNumber(ccMeta, hContact), true);
+ Meta_RemoveContactNumber(ccMeta, Meta_GetContactNumber(ccMeta, hContact), true, true);
NotifyEventHooks(hSubcontactsChanged, ccMeta->contactID, 0);
// no more subs? remove the meta itself
diff --git a/src/mir_app/src/metacontacts.h b/src/mir_app/src/metacontacts.h
index 5c82f6cfcd..d73044cec1 100644
--- a/src/mir_app/src/metacontacts.h
+++ b/src/mir_app/src/metacontacts.h
@@ -46,7 +46,7 @@ INT_PTR Meta_Default(WPARAM wParam,LPARAM lParam);
INT_PTR Meta_OnOff(WPARAM wParam, LPARAM lParam);
int Meta_ModifyMenu(WPARAM wParam,LPARAM lParam);
BOOL Meta_Assign(MCONTACT src, MCONTACT dest, BOOL set_as_default);
-void Meta_RemoveContactNumber(DBCachedContact *cc, int number, bool bUpdateInfo);
+void Meta_RemoveContactNumber(DBCachedContact *cc, int number, bool bUpdateInfo, bool bDeleteSub = false);
int Meta_SetNick(char *proto);
int Meta_HideLinkedContacts(void);
int Meta_GetContactNumber(DBCachedContact *cc, MCONTACT hContact);
diff --git a/src/mir_app/src/mir_app.def b/src/mir_app/src/mir_app.def
index 7bbe2c533e..cef5d03f20 100644
--- a/src/mir_app/src/mir_app.def
+++ b/src/mir_app/src/mir_app.def
@@ -667,3 +667,5 @@ g_hevSettingChanged @696 NONAME
??1GCSessionInfoBase@@QAE@XZ @700 NONAME
?getUserList@GCSessionInfoBase@@QAEAAU?$OBJLIST@UUSERINFO@@@@XZ @701 NONAME
?getMe@GCSessionInfoBase@@QBEPAUUSERINFO@@XZ @702 NONAME
+?MetaRemoveSubHistory@MDatabaseCommon@@UAGHPAUDBCachedContact@@@Z @703 NONAME
+?MetaRemoveSubHistory@MDatabaseReadonly@@UAGHPAUDBCachedContact@@@Z @704 NONAME
diff --git a/src/mir_app/src/mir_app64.def b/src/mir_app/src/mir_app64.def
index c7260c9440..b91d38854b 100644
--- a/src/mir_app/src/mir_app64.def
+++ b/src/mir_app/src/mir_app64.def
@@ -667,3 +667,5 @@ g_hevSettingChanged @696 NONAME
??1GCSessionInfoBase@@QEAA@XZ @700 NONAME
?getUserList@GCSessionInfoBase@@QEAAAEAU?$OBJLIST@UUSERINFO@@@@XZ @701 NONAME
?getMe@GCSessionInfoBase@@QEBAPEAUUSERINFO@@XZ @702 NONAME
+?MetaRemoveSubHistory@MDatabaseCommon@@UEAAHPEAUDBCachedContact@@@Z @703 NONAME
+?MetaRemoveSubHistory@MDatabaseReadonly@@UEAAHPEAUDBCachedContact@@@Z @704 NONAME