summaryrefslogtreecommitdiff
path: root/plugins/NewStory/src
diff options
context:
space:
mode:
authorGeorge Hazan <ghazan@miranda.im>2021-06-10 16:29:02 +0300
committerGeorge Hazan <ghazan@miranda.im>2021-06-10 16:29:02 +0300
commitc6519db3afea05236cd41a144110a8a74f3daa96 (patch)
treea30afee305efb54be06a4b7bf1fafdbc6f2ce9ce /plugins/NewStory/src
parent2ad5c23a591fb5aa4c34f1148ee565cc015d1384 (diff)
fixes #2914 (unified empty history menu items)
Diffstat (limited to 'plugins/NewStory/src')
-rw-r--r--plugins/NewStory/src/history.cpp2
-rw-r--r--plugins/NewStory/src/history.h1
-rw-r--r--plugins/NewStory/src/history_menus.cpp28
3 files changed, 4 insertions, 27 deletions
diff --git a/plugins/NewStory/src/history.cpp b/plugins/NewStory/src/history.cpp
index d69706efad..78001166de 100644
--- a/plugins/NewStory/src/history.cpp
+++ b/plugins/NewStory/src/history.cpp
@@ -602,7 +602,7 @@ public:
void onClick_Delete(CCtrlButton *)
{
- svcEmptyHistory(m_hContact, 0);
+ CallService(MS_HISTORY_EMPTY, m_hContact, 0);
m_histControl.SendMsg(NSM_CLEAR, 0, 0);
UpdateTitle();
diff --git a/plugins/NewStory/src/history.h b/plugins/NewStory/src/history.h
index f7f448abd1..9a8caeca08 100644
--- a/plugins/NewStory/src/history.h
+++ b/plugins/NewStory/src/history.h
@@ -32,7 +32,6 @@ extern MWindowList hNewstoryWindows;
void InitHistory();
void InitMenus();
-INT_PTR svcEmptyHistory(WPARAM hContact, LPARAM);
INT_PTR svcShowNewstory(WPARAM wParam, LPARAM lParam);
CSrmmLogWindow* __cdecl NewStory_Stub(CMsgDialog &pDlg);
diff --git a/plugins/NewStory/src/history_menus.cpp b/plugins/NewStory/src/history_menus.cpp
index 2a5b05c240..f7275a3016 100644
--- a/plugins/NewStory/src/history_menus.cpp
+++ b/plugins/NewStory/src/history_menus.cpp
@@ -1,31 +1,17 @@
#include "stdafx.h"
-static HGENMENU hmiHistory, hmiEmpty;
-
-INT_PTR svcEmptyHistory(WPARAM hContact, LPARAM)
-{
- if (IDYES != MessageBoxW(nullptr, TranslateT("Are you sure to remove all events from history?"), _T(MODULETITLE), MB_YESNOCANCEL | MB_ICONQUESTION))
- return 1;
-
- DB::ECPTR pCursor(DB::Events(hContact));
- while (pCursor.FetchNext())
- pCursor.DeleteEvent();
- return 0;
-}
+static HGENMENU hmiHistory;
static int OnPrebuildContactMenu(WPARAM hContact, LPARAM)
{
- bool bShow = (db_event_first(hContact) != 0);
- Menu_ShowItem(hmiEmpty, bShow);
- Menu_ShowItem(hmiHistory, bShow);
+ Menu_ShowItem(hmiHistory, db_event_first(hContact) != 0);
return 0;
}
void InitMenus()
{
- CMenuItem mi(&g_plugin);
-
// Contact menu items
+ CMenuItem mi(&g_plugin);
SET_UID(mi, 0xc20d7a69, 0x7607, 0x4aad, 0xa7, 0x42, 0x10, 0x86, 0xfb, 0x32, 0x49, 0x21);
mi.pszService = MS_HISTORY_SHOWCONTACTHISTORY;
mi.name.a = LPGEN("User history");
@@ -34,13 +20,5 @@ void InitMenus()
hmiHistory = Menu_AddContactMenuItem(&mi);
CreateServiceFunction(mi.pszService, svcShowNewstory);
- SET_UID(mi, 0x0d4306aa, 0xe31e, 0x46ee, 0x89, 0x88, 0x3a, 0x2e, 0x05, 0xa6, 0xf3, 0xbc);
- mi.pszService = "Newstory/EmptyHistory";
- mi.name.a = LPGEN("Empty history");
- mi.position = 1000090001;
- mi.hIcon = Skin_LoadIcon(SKINICON_OTHER_DELETE);
- hmiEmpty = Menu_AddContactMenuItem(&mi);
- CreateServiceFunction(mi.pszService, svcEmptyHistory);
-
HookEvent(ME_CLIST_PREBUILDCONTACTMENU, OnPrebuildContactMenu);
}