summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGeorge Hazan <ghazan@miranda.im>2023-03-09 20:06:37 +0300
committerGeorge Hazan <ghazan@miranda.im>2023-03-09 20:06:37 +0300
commit7a0e4f4a10e80063ca5d7c1b32131e9fc506ac1f (patch)
tree71906285267d9aee78c45da82308270d18512fef
parent6c1480116ccabd92de7544179126478f4b243353 (diff)
ME_HISTORY_EMPTY - a hook to handle history wiping
-rw-r--r--include/m_history.h8
-rw-r--r--src/mir_app/mir_app.vcxproj.filters6
-rw-r--r--src/mir_app/src/srmm_statusicon.cpp6
3 files changed, 16 insertions, 4 deletions
diff --git a/include/m_history.h b/include/m_history.h
index 402e019e8b..2145f72e5b 100644
--- a/include/m_history.h
+++ b/include/m_history.h
@@ -41,4 +41,12 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#define MS_HISTORY_EMPTY "History/EmptyHistory"
+/////////////////////////////////////////////////////////////////////////////////////////
+// Event called when someone gonna wipe contact's history
+// wParam = (MCONTACT)hContact
+// hContact can be NULL to wipe system history
+// returns 0 if the core should wipe local history or any other value to cancel wiping
+
+#define ME_HISTORY_EMPTY "History/OnEmptyHistory"
+
#endif // M_HISTORY_H__
diff --git a/src/mir_app/mir_app.vcxproj.filters b/src/mir_app/mir_app.vcxproj.filters
index d7960c2ea2..d18b1ac64c 100644
--- a/src/mir_app/mir_app.vcxproj.filters
+++ b/src/mir_app/mir_app.vcxproj.filters
@@ -158,9 +158,6 @@
<ClCompile Include="src\chat_ui.cpp">
<Filter>Source Files\Chats</Filter>
</ClCompile>
- <ClCompile Include="src\clc.cpp">
- <Filter>Source Files\Contact list</Filter>
- </ClCompile>
<ClCompile Include="src\clcfiledrop.cpp">
<Filter>Source Files\Contact list</Filter>
</ClCompile>
@@ -401,6 +398,9 @@
<ClCompile Include="src\clccontact.cpp">
<Filter>Source Files\Contact list</Filter>
</ClCompile>
+ <ClCompile Include="src\clc.cpp">
+ <Filter>Source Files\MetaContacts</Filter>
+ </ClCompile>
</ItemGroup>
<ItemGroup>
<ClInclude Include="src\filter.h">
diff --git a/src/mir_app/src/srmm_statusicon.cpp b/src/mir_app/src/srmm_statusicon.cpp
index 580cf6d424..94de15aa2f 100644
--- a/src/mir_app/src/srmm_statusicon.cpp
+++ b/src/mir_app/src/srmm_statusicon.cpp
@@ -26,7 +26,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
HCURSOR g_hCurHyperlinkHand;
HANDLE hHookSrmmEvent;
-static HANDLE hHookIconsChanged, hHookIconPressedEvt;
+static HANDLE hHookIconsChanged, hHookIconPressedEvt, hHookEmptyHistory;
static mir_cs csIcons;
void LoadSrmmToolbarModule();
@@ -272,6 +272,9 @@ static HGENMENU hmiEmpty;
static INT_PTR svcEmptyHistory(WPARAM hContact, LPARAM lParam)
{
+ if (NotifyEventHooks(hHookEmptyHistory))
+ return 2;
+
if (lParam == 0)
if (IDYES != MessageBoxW(nullptr, TranslateT("Are you sure to remove all events from history?"), L"Miranda", MB_YESNO | MB_ICONQUESTION))
return 1;
@@ -319,6 +322,7 @@ int LoadSrmmModule()
LoadSrmmToolbarModule();
CreateServiceFunction(MS_HISTORY_EMPTY, svcEmptyHistory);
+ hHookEmptyHistory = CreateHookableEvent(ME_HISTORY_EMPTY);
hHookSrmmEvent = CreateHookableEvent(ME_MSG_WINDOWEVENT);
hHookIconsChanged = CreateHookableEvent(ME_MSG_ICONSCHANGED);