diff options
| author | George Hazan <ghazan@miranda.im> | 2021-02-27 18:41:35 +0300 |
|---|---|---|
| committer | George Hazan <ghazan@miranda.im> | 2021-02-27 18:41:35 +0300 |
| commit | 60628b4face0c7715a8dd9f271a7a806b82fc08f (patch) | |
| tree | 411753d6e6e9b131a9111e8b080c0859d434c58c /plugins/NoHistory/src | |
| parent | 0723e910521a85953805ec63cbb723641cbf5d4a (diff) | |
fixes #2713 (NoHistory: add option to remove histories on startup)
Diffstat (limited to 'plugins/NoHistory/src')
| -rw-r--r-- | plugins/NoHistory/src/dllmain.cpp | 15 | ||||
| -rw-r--r-- | plugins/NoHistory/src/options.cpp | 10 | ||||
| -rw-r--r-- | plugins/NoHistory/src/resource.h | 5 | ||||
| -rw-r--r-- | plugins/NoHistory/src/stdafx.h | 1 | ||||
| -rw-r--r-- | plugins/NoHistory/src/version.h | 2 |
5 files changed, 23 insertions, 10 deletions
diff --git a/plugins/NoHistory/src/dllmain.cpp b/plugins/NoHistory/src/dllmain.cpp index c0e80b7676..a4b580fa84 100644 --- a/plugins/NoHistory/src/dllmain.cpp +++ b/plugins/NoHistory/src/dllmain.cpp @@ -42,8 +42,10 @@ PLUGININFOEX pluginInfoEx = CMPlugin::CMPlugin() :
PLUGIN<CMPlugin>(MODULENAME, pluginInfoEx),
- bEnabledForNew(MODULENAME, "EnabledForNew", true)
-{}
+ bEnabledForNew(MODULENAME, "EnabledForNew", true),
+ bWipeOnStartup(MODULENAME, "WipeOnStartup", false)
+{
+}
/////////////////////////////////////////////////////////////////////////////////////////
@@ -95,9 +97,11 @@ void RemoveAllEvents(MCONTACT hContact) pCursor.DeleteEvent();
}
-void CALLBACK TimerProc(HWND, UINT, UINT_PTR, DWORD)
+static void CALLBACK WipeOnStart()
{
- RemoveReadEvents();
+ for (auto &cc : Contacts())
+ if (g_plugin.getByte(cc, DBSETTING_REMOVE))
+ RemoveAllEvents(cc);
}
int OnDatabaseEventAdd(WPARAM hContact, LPARAM hDBEvent)
@@ -266,6 +270,9 @@ int CMPlugin::Load() InitIcons();
+ if (bWipeOnStartup)
+ Miranda_WaitOnHandle(WipeOnStart);
+
HookEvent(ME_CLIST_PREBUILDCONTACTMENU, PrebuildContactMenu);
HookEvent(ME_DB_CONTACT_ADDED, OnContactAdded);
HookEvent(ME_DB_EVENT_ADDED, OnDatabaseEventAdd);
diff --git a/plugins/NoHistory/src/options.cpp b/plugins/NoHistory/src/options.cpp index f34b580395..f6ec5a1fda 100644 --- a/plugins/NoHistory/src/options.cpp +++ b/plugins/NoHistory/src/options.cpp @@ -4,8 +4,6 @@ class CDlgOptionsDlg : public CDlgBase {
HANDLE hItemAll, hItemNew;
- CCtrlClc clist;
-
void SetListGroupIcons(HANDLE hFirstItem, HANDLE hParentItem, int *groupChildCount = nullptr)
{
int iconOn = 1;
@@ -79,11 +77,17 @@ class CDlgOptionsDlg : public CDlgBase }
}
+ CCtrlClc clist;
+ CCtrlCheck chkOnStartup;
+
public:
CDlgOptionsDlg() :
CDlgBase(g_plugin, IDD_OPT),
- clist(this, IDC_LIST)
+ clist(this, IDC_LIST),
+ chkOnStartup(this, IDC_ONSTARTUP)
{
+ CreateLink(chkOnStartup, g_plugin.bWipeOnStartup);
+
clist.OnNewContact = clist.OnListRebuilt = Callback(this, &CDlgOptionsDlg::onListRebuilt);
clist.OnOptionsChanged = Callback(this, &CDlgOptionsDlg::onOptionsChanged);
clist.OnContactMoved = Callback(this, &CDlgOptionsDlg::onContactMoved);
diff --git a/plugins/NoHistory/src/resource.h b/plugins/NoHistory/src/resource.h index 5640d91b59..ec1fc8a07d 100644 --- a/plugins/NoHistory/src/resource.h +++ b/plugins/NoHistory/src/resource.h @@ -13,14 +13,15 @@ #define IDC_ED_TIMEOUT 1004
#define IDC_SPIN1 1005
#define IDC_SPN_TIMEOUT 1005
+#define IDC_ONSTARTUP 1006
// Next default values for new objects
//
#ifdef APSTUDIO_INVOKED
#ifndef APSTUDIO_READONLY_SYMBOLS
-#define _APS_NEXT_RESOURCE_VALUE 104
+#define _APS_NEXT_RESOURCE_VALUE 105
#define _APS_NEXT_COMMAND_VALUE 40001
-#define _APS_NEXT_CONTROL_VALUE 1006
+#define _APS_NEXT_CONTROL_VALUE 1007
#define _APS_NEXT_SYMED_VALUE 101
#endif
#endif
diff --git a/plugins/NoHistory/src/stdafx.h b/plugins/NoHistory/src/stdafx.h index 82ca708c8a..612f2e2aea 100644 --- a/plugins/NoHistory/src/stdafx.h +++ b/plugins/NoHistory/src/stdafx.h @@ -31,6 +31,7 @@ struct CMPlugin : public PLUGIN<CMPlugin> CMPlugin();
CMOption<bool> bEnabledForNew;
+ CMOption<bool> bWipeOnStartup;
int Load() override;
int Unload() override;
diff --git a/plugins/NoHistory/src/version.h b/plugins/NoHistory/src/version.h index 177425eeaa..df6f3084da 100644 --- a/plugins/NoHistory/src/version.h +++ b/plugins/NoHistory/src/version.h @@ -1,7 +1,7 @@ #define __MAJOR_VERSION 0 #define __MINOR_VERSION 2 #define __RELEASE_NUM 3 -#define __BUILD_NUM 1 +#define __BUILD_NUM 2 #include <stdver.h> |
