summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorGeorge Hazan <ghazan@miranda.im>2023-03-09 19:07:04 +0300
committerGeorge Hazan <ghazan@miranda.im>2023-03-09 19:07:04 +0300
commit9417dafded645981c314e73884c2dcca6a6a27ed (patch)
tree411d6bff787c38efcb4293b83f3964e737f8b3a5 /src
parentfabe33ee70142ddadacedb205a38b2b902e7b2c4 (diff)
added event for event deletion
Diffstat (limited to 'src')
-rw-r--r--src/mir_app/src/mir_app.def1
-rw-r--r--src/mir_app/src/mir_app64.def1
-rw-r--r--src/mir_app/src/proto_interface.cpp3
-rw-r--r--src/mir_core/src/db.cpp13
4 files changed, 16 insertions, 2 deletions
diff --git a/src/mir_app/src/mir_app.def b/src/mir_app/src/mir_app.def
index 765a1f46b0..022ce9a37b 100644
--- a/src/mir_app/src/mir_app.def
+++ b/src/mir_app/src/mir_app.def
@@ -822,3 +822,4 @@ Srmm_CreateHotkey @886 NONAME
?OnCreateAccMgrUI@PROTO_INTERFACE@@UAEPAUHWND__@@PAU2@@Z @937 NONAME
?getMStringU@PROTO_INTERFACE@@QAE?AV?$CMStringT@DV?$ChTraitsCRT@D@@@@IPBD0@Z @938 NONAME
?getMStringU@PROTO_INTERFACE@@QAE?AV?$CMStringT@DV?$ChTraitsCRT@D@@@@PBD0@Z @939 NONAME
+?OnEventDeleted@PROTO_INTERFACE@@UAEXII@Z @940 NONAME
diff --git a/src/mir_app/src/mir_app64.def b/src/mir_app/src/mir_app64.def
index 1431875262..196c8cba39 100644
--- a/src/mir_app/src/mir_app64.def
+++ b/src/mir_app/src/mir_app64.def
@@ -822,3 +822,4 @@ Srmm_CreateHotkey @886 NONAME
?OnCreateAccMgrUI@PROTO_INTERFACE@@UEAAPEAUHWND__@@PEAU2@@Z @937 NONAME
?getMStringU@PROTO_INTERFACE@@QEAA?AV?$CMStringT@DV?$ChTraitsCRT@D@@@@IPEBD0@Z @938 NONAME
?getMStringU@PROTO_INTERFACE@@QEAA?AV?$CMStringT@DV?$ChTraitsCRT@D@@@@PEBD0@Z @939 NONAME
+?OnEventDeleted@PROTO_INTERFACE@@UEAAXII@Z @940 NONAME
diff --git a/src/mir_app/src/proto_interface.cpp b/src/mir_app/src/proto_interface.cpp
index d1f8317c2d..a1b005d16b 100644
--- a/src/mir_app/src/proto_interface.cpp
+++ b/src/mir_app/src/proto_interface.cpp
@@ -79,6 +79,9 @@ MWindow PROTO_INTERFACE::OnCreateAccMgrUI(MWindow)
return nullptr; // error
}
+void PROTO_INTERFACE::OnEventDeleted(MCONTACT, MEVENT)
+{}
+
void PROTO_INTERFACE::OnEventEdited(MCONTACT, MEVENT)
{}
diff --git a/src/mir_core/src/db.cpp b/src/mir_core/src/db.cpp
index 5f77f45774..3c92e965c2 100644
--- a/src/mir_core/src/db.cpp
+++ b/src/mir_core/src/db.cpp
@@ -412,9 +412,18 @@ MIR_CORE_DLL(int) db_event_count(MCONTACT hContact)
return (g_pCurrDb == nullptr) ? 0 : g_pCurrDb->GetEventCount(hContact);
}
-MIR_CORE_DLL(int) db_event_delete(MEVENT hDbEvent)
+MIR_CORE_DLL(int) db_event_delete(MEVENT hDbEvent, bool bFromServer)
{
- return (g_pCurrDb == nullptr) ? 0 : g_pCurrDb->DeleteEvent(hDbEvent);
+ if (g_pCurrDb == nullptr)
+ return 0;
+
+ if (!bFromServer) {
+ MCONTACT hContact = g_pCurrDb->GetEventContact(hDbEvent);
+ if (auto *ppro = Proto_GetInstance(hContact))
+ ppro->OnEventDeleted(hContact, hDbEvent);
+ }
+
+ return g_pCurrDb->DeleteEvent(hDbEvent);
}
MIR_CORE_DLL(int) db_event_edit(MCONTACT hContact, MEVENT hDbEvent, const DBEVENTINFO *dbei)