diff options
author | George Hazan <ghazan@miranda.im> | 2018-06-13 18:16:13 +0300 |
---|---|---|
committer | George Hazan <ghazan@miranda.im> | 2018-06-13 18:16:13 +0300 |
commit | 723bc42a5dfe925c655cced2c184ddfdfc144ada (patch) | |
tree | 0de1f13f2510af9761821d53039ba4684b37f218 | |
parent | e71725076a18bf48579275e196886dc2edb9aee1 (diff) |
System idle:
- plugin StdIdle that had been acting as an options dialog for StdAutoAway removed;
- service MS_IDLE_GETIDLEINFO moved into the core and replaced with Idle_GetInfo();
- new function Idle_Enter() is available to tell the core that Miranda is idle;
- StdAutoAway & StatusManager adapted for these changes;
41 files changed, 412 insertions, 726 deletions
diff --git a/bin15/mir_full.sln b/bin15/mir_full.sln index 8967976e64..ed706478f7 100644 --- a/bin15/mir_full.sln +++ b/bin15/mir_full.sln @@ -186,11 +186,6 @@ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "StdAutoAway", "..\src\core\ {D9EFEA4B-B817-4DE1-BD62-68A5DB8F5F60} = {D9EFEA4B-B817-4DE1-BD62-68A5DB8F5F60} EndProjectSection EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "StdIdle", "..\src\core\stdidle\stdidle.vcxproj", "{36C40BA6-E0B5-438A-919C-6A991933B313}" - ProjectSection(ProjectDependencies) = postProject - {D9EFEA4B-B817-4DE1-BD62-68A5DB8F5F60} = {D9EFEA4B-B817-4DE1-BD62-68A5DB8F5F60} - EndProjectSection -EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "StdUIHist", "..\src\core\stduihist\stduihist.vcxproj", "{DADAC956-3A54-440A-8B56-A07234DEE861}" ProjectSection(ProjectDependencies) = postProject {D9EFEA4B-B817-4DE1-BD62-68A5DB8F5F60} = {D9EFEA4B-B817-4DE1-BD62-68A5DB8F5F60} @@ -1128,14 +1123,6 @@ Global {A8F23706-E590-4A87-96CC-5F8E5082503F}.Release|Win32.Build.0 = Release|Win32 {A8F23706-E590-4A87-96CC-5F8E5082503F}.Release|x64.ActiveCfg = Release|x64 {A8F23706-E590-4A87-96CC-5F8E5082503F}.Release|x64.Build.0 = Release|x64 - {36C40BA6-E0B5-438A-919C-6A991933B313}.Debug|Win32.ActiveCfg = Debug|Win32 - {36C40BA6-E0B5-438A-919C-6A991933B313}.Debug|Win32.Build.0 = Debug|Win32 - {36C40BA6-E0B5-438A-919C-6A991933B313}.Debug|x64.ActiveCfg = Debug|x64 - {36C40BA6-E0B5-438A-919C-6A991933B313}.Debug|x64.Build.0 = Debug|x64 - {36C40BA6-E0B5-438A-919C-6A991933B313}.Release|Win32.ActiveCfg = Release|Win32 - {36C40BA6-E0B5-438A-919C-6A991933B313}.Release|Win32.Build.0 = Release|Win32 - {36C40BA6-E0B5-438A-919C-6A991933B313}.Release|x64.ActiveCfg = Release|x64 - {36C40BA6-E0B5-438A-919C-6A991933B313}.Release|x64.Build.0 = Release|x64 {DADAC956-3A54-440A-8B56-A07234DEE861}.Debug|Win32.ActiveCfg = Debug|Win32 {DADAC956-3A54-440A-8B56-A07234DEE861}.Debug|Win32.Build.0 = Debug|Win32 {DADAC956-3A54-440A-8B56-A07234DEE861}.Debug|x64.ActiveCfg = Debug|x64 @@ -2068,7 +2055,6 @@ Global {A5B558C6-C767-11E1-A335-F6EB6188709B} = {E7FB43FB-3563-4568-8846-A88FC37449BF} {6022990D-3FD5-46A9-8AB5-E444C51646F3} = {E7FB43FB-3563-4568-8846-A88FC37449BF} {A8F23706-E590-4A87-96CC-5F8E5082503F} = {E7FB43FB-3563-4568-8846-A88FC37449BF} - {36C40BA6-E0B5-438A-919C-6A991933B313} = {E7FB43FB-3563-4568-8846-A88FC37449BF} {DADAC956-3A54-440A-8B56-A07234DEE861} = {E7FB43FB-3563-4568-8846-A88FC37449BF} {D22C1BBB-E06A-4A28-8F33-17D1EA3E8563} = {E7FB43FB-3563-4568-8846-A88FC37449BF} {C14D6E0D-810E-4599-A6E0-17298AFA0501} = {E7FB43FB-3563-4568-8846-A88FC37449BF} diff --git a/bin15/miranda32.sln b/bin15/miranda32.sln index 2d7760e971..316e590ec7 100644 --- a/bin15/miranda32.sln +++ b/bin15/miranda32.sln @@ -76,11 +76,6 @@ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "StdAutoAway", "..\src\core\ {D9EFEA4B-B817-4DE1-BD62-68A5DB8F5F60} = {D9EFEA4B-B817-4DE1-BD62-68A5DB8F5F60} EndProjectSection EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "StdIdle", "..\src\core\stdidle\stdidle.vcxproj", "{36C40BA6-E0B5-438A-919C-6A991933B313}" - ProjectSection(ProjectDependencies) = postProject - {D9EFEA4B-B817-4DE1-BD62-68A5DB8F5F60} = {D9EFEA4B-B817-4DE1-BD62-68A5DB8F5F60} - EndProjectSection -EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "StdUIHist", "..\src\core\stduihist\stduihist.vcxproj", "{DADAC956-3A54-440A-8B56-A07234DEE861}" ProjectSection(ProjectDependencies) = postProject {D9EFEA4B-B817-4DE1-BD62-68A5DB8F5F60} = {D9EFEA4B-B817-4DE1-BD62-68A5DB8F5F60} @@ -384,14 +379,6 @@ Global {A8F23706-E590-4A87-96CC-5F8E5082503F}.Release|Win32.Build.0 = Release|Win32 {A8F23706-E590-4A87-96CC-5F8E5082503F}.Release|x64.ActiveCfg = Release|x64 {A8F23706-E590-4A87-96CC-5F8E5082503F}.Release|x64.Build.0 = Release|x64 - {36C40BA6-E0B5-438A-919C-6A991933B313}.Debug|Win32.ActiveCfg = Debug|Win32 - {36C40BA6-E0B5-438A-919C-6A991933B313}.Debug|Win32.Build.0 = Debug|Win32 - {36C40BA6-E0B5-438A-919C-6A991933B313}.Debug|x64.ActiveCfg = Debug|x64 - {36C40BA6-E0B5-438A-919C-6A991933B313}.Debug|x64.Build.0 = Debug|x64 - {36C40BA6-E0B5-438A-919C-6A991933B313}.Release|Win32.ActiveCfg = Release|Win32 - {36C40BA6-E0B5-438A-919C-6A991933B313}.Release|Win32.Build.0 = Release|Win32 - {36C40BA6-E0B5-438A-919C-6A991933B313}.Release|x64.ActiveCfg = Release|x64 - {36C40BA6-E0B5-438A-919C-6A991933B313}.Release|x64.Build.0 = Release|x64 {DADAC956-3A54-440A-8B56-A07234DEE861}.Debug|Win32.ActiveCfg = Debug|Win32 {DADAC956-3A54-440A-8B56-A07234DEE861}.Debug|Win32.Build.0 = Debug|Win32 {DADAC956-3A54-440A-8B56-A07234DEE861}.Debug|x64.ActiveCfg = Debug|x64 @@ -553,7 +540,6 @@ Global {A5B558C6-C767-11E1-A335-F6EB6188709B} = {85220459-761D-4E24-A381-D35A95880254} {6022990D-3FD5-46A9-8AB5-E444C51646F3} = {85220459-761D-4E24-A381-D35A95880254} {A8F23706-E590-4A87-96CC-5F8E5082503F} = {85220459-761D-4E24-A381-D35A95880254} - {36C40BA6-E0B5-438A-919C-6A991933B313} = {85220459-761D-4E24-A381-D35A95880254} {DADAC956-3A54-440A-8B56-A07234DEE861} = {85220459-761D-4E24-A381-D35A95880254} {D22C1BBB-E06A-4A28-8F33-17D1EA3E8563} = {85220459-761D-4E24-A381-D35A95880254} {C14D6E0D-810E-4599-A6E0-17298AFA0501} = {85220459-761D-4E24-A381-D35A95880254} diff --git a/include/delphi/m_api.pas b/include/delphi/m_api.pas index 59985b792f..2b41c77520 100644 --- a/include/delphi/m_api.pas +++ b/include/delphi/m_api.pas @@ -221,7 +221,6 @@ var {$include m_icolib.inc}
{$include m_iconheader.inc}
{$include m_icq.inc}
- {$include m_idle.inc}
{$include m_ignore.inc}
{$include m_imgsrvc.inc}
{$include m_json.inc}
diff --git a/include/delphi/m_idle.inc b/include/delphi/m_idle.inc deleted file mode 100644 index c8d3203028..0000000000 --- a/include/delphi/m_idle.inc +++ /dev/null @@ -1,74 +0,0 @@ -{
- Miranda IM: the free IM client for Microsoft Windows
-
- Copyright 2000-2005 Miranda ICQ/IM project,
- all portions of this codebase are copyrighted to the people
- listed in contributors.txt.
-
- This program is free software; you can redistribute it and/or
- modify it under the terms of the GNU General Public License
- as published by the Free Software Foundation; either version 2
- of the License, or (at your option) any later version.
-
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with this program; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-}
-
-{$IFNDEF M_IDLE}
-{$DEFINE M_IDLE}
-
- { The idle module checks how long the user has been idle, it can be at the Miranda level
- or the OS level - the user has optional two settings, one for "short" idle and another
- for "long" idle. Thie module will generate long/short events based on these user preferences
- and other information too. If you are unsure which idle mode to report for, report it
- for short idle. }
-const
- IDF_ISIDLE = $1; // idle has become active (if not set, inactive)
- IDF_PRIVACY = $8; // if set, the information provided shouldn't be given to third parties.
-
-const
-{
- wParam: 0
- lParam: IDF_ (or'd field)
- Affect: This event is fired when information about idle changes.
- Note: You will get multiple calls with IDF_ISIDLE set, the first is for short idle
- then long idle, then anytime during you might get IDF_ONFORCE if the screensaver
- or station become locked.
-
- It is up to you to keep state, i.e. once the idle that you care about is reported
- ignore other status notifications with IDF_ISIDLE set until you get one with
- IDF_ISIDLE isn't set.
- Version: 0.3.4a+ (2004/09/16)
-}
- ME_IDLE_CHANGED:PAnsiChar = 'Miranda/Idle/Changed';
-
-type
- PMIRANDA_IDLE_INFO = ^TMIRANDA_IDLE_INFO;
- TMIRANDA_IDLE_INFO = record
- cbSize : int; // sizeof()
- idleTime : int; // idle in mins, if zero then disabled
- privacy : int; // user doesnt want other people seeing anything more than they are idle
- aaStatus : int; // status to go to when user is auto away
- aaLock : int; // the status shouldn't be unset if its set
- idleType : int;
- idlesoundsoff: int;
- end;
-
-{
- wParam; 0
- lParam: address of MIRANDA_IDLE_INFO
- Affect: Return information about current idle settings, like short/long idle time in mins
- and if the user wants that info kept private, etc
- Returns: zero on success, non zero on failure
- Version: 0.3.4 (2004/09/16)
-}
-const
- MS_IDLE_GETIDLEINFO:PAnsiChar = 'Miranda/Idle/GetInfo';
-
-{$ENDIF}
diff --git a/include/m_idle.h b/include/m_idle.h index 74fcb54c46..53c0c281c0 100644 --- a/include/m_idle.h +++ b/include/m_idle.h @@ -25,39 +25,40 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #ifndef M_IDLE_H__
#define M_IDLE_H__ 1
-/* The idle module checks how long the user has been idle, it can be at the Miranda level
-or the OS level - the user has optional two settings, one for "short" idle and another
-for "long" idle. Thie module will generate long/short events based on these user preferences
-and other information too. If you are unsure which idle mode to report for, report it
-for short idle.*/
-
-/*
- wParam: 0
- lParam: IDF_* (or'd field)
- Affect: This event is fired when information about idle changes.
- Note: You will get multiple calls with IDF_ISIDLE set, the first is for short idle
- then long idle, then anytime during you might get IDF_ONFORCE if the screensaver or station
- become locked.
-
- It is up to you to keep state, i.e. once the idle that you care about is reported
- ignore other status notifications with IDF_ISIDLE set until you get one with IDF_ISIDLE isn't
- set.
- Version: 0.3.4a+ (2004/09/16)
-*/
+// The idle module checks how long the user has been idle, it can be at the Miranda level
+// or the OS level - the user has optional two settings, one for "short" idle and another
+// for "long" idle. Thie module will generate long/short events based on these user preferences
+// and other information too. If you are unsure which idle mode to report for, report it
+// for short idle.
+
+/////////////////////////////////////////////////////////////////////////////////////////
+// Idle_Enter() - enters (if type >= 0) or leaves (if type == -1) the idle mode
+// Each plugin that implements MIID_AUTOAWAY can set its own idle types
+
+EXTERN_C MIR_APP_DLL(void) Idle_Enter(int type = -1);
+
+/////////////////////////////////////////////////////////////////////////////////////////
+// ME_IDLE_CHANGED - called when the idle mode is changed
+// wParam: 0
+// lParam: IDF_* (or'd field)
+//
+// Affect: This event is fired when information about idle changes.
+// Note: You will get multiple calls with IDF_ISIDLE set, the first is for short idle
+// then long idle, then anytime during you might get IDF_ONFORCE if the screensaver or station
+// become locked.
+
+// It is up to you to keep state, i.e. once the idle that you care about is reported
+// ignore other status notifications with IDF_ISIDLE set until you get one with IDF_ISIDLE isn't
+// set.
#define IDF_ISIDLE 0x1 // idle has become active (if not set, inactive)
#define IDF_PRIVACY 0x8 // if set, the information provided shouldn't be given to third parties.
#define ME_IDLE_CHANGED "Miranda/Idle/Changed"
-/*
- wParam; 0
- lParam: &MIRANDA_IDLE_INFO
- Affect: Return information about current idle settings, like short/long idle time in mins
- and if the user wants that info kept private, etc
- Returns: zero on success, non zero on failure
- Version: 0.3.4 (2004/09/16)
-*/
+/////////////////////////////////////////////////////////////////////////////////////////
+// Returns information about current idle settings, like short/long idle time in mins
+// and if the user wants that info kept private, etc
struct MIRANDA_IDLE_INFO
{
@@ -69,11 +70,6 @@ struct MIRANDA_IDLE_INFO int idlesoundsoff;
};
-#define MS_IDLE_GETIDLEINFO "Miranda/Idle/GetInfo"
-
-__forceinline int Idle_GetInfo(MIRANDA_IDLE_INFO &pInfo)
-{
- return CallService(MS_IDLE_GETIDLEINFO, 0, (LPARAM)&pInfo);
-}
+EXTERN_C MIR_APP_DLL(void) Idle_GetInfo(MIRANDA_IDLE_INFO &pInfo);
#endif // M_IDLE_H__
diff --git a/include/newpluginapi.h b/include/newpluginapi.h index 709b099ace..e858c37b6d 100644 --- a/include/newpluginapi.h +++ b/include/newpluginapi.h @@ -74,7 +74,6 @@ MIR_APP_DLL(int) SetServiceModePlugin(const wchar_t *wszPluginName); #define MIID_UIHISTORY {0x7f7e3d98, 0xce1f, 0x4962, {0x82, 0x84, 0x96, 0x85, 0x50, 0xf1, 0xd3, 0xd9}}
#define MIID_AUTOAWAY {0x9c87f7dc, 0x3bd7, 0x4983, {0xb7, 0xfb, 0xb8, 0x48, 0xfd, 0xbc, 0x91, 0xf0}}
#define MIID_USERONLINE {0x130829e0, 0x2463, 0x4ff8, {0xbb, 0xc8, 0xce, 0x73, 0xc0, 0x18, 0x84, 0x42}}
-#define MIID_IDLE {0x296f9f3b, 0x5b6f, 0x40e5, {0x8f, 0xb0, 0xa6, 0x49, 0x6c, 0x18, 0xbf, 0x0a}}
#define MIID_CRYPTO {0x415ca6e1, 0x895f, 0x40e6, {0x87, 0xbd, 0x9b, 0x39, 0x60, 0x16, 0xd0, 0xe5}}
#define MIID_SSL {0x3bbbbd20, 0x20e6, 0x479b, {0xbd, 0x4b, 0xe8, 0x4d, 0xe2, 0x62, 0x71, 0x20}}
diff --git a/libs/win32/mir_app.lib b/libs/win32/mir_app.lib Binary files differindex 0a53ac8f12..9207016833 100644 --- a/libs/win32/mir_app.lib +++ b/libs/win32/mir_app.lib diff --git a/libs/win64/mir_app.lib b/libs/win64/mir_app.lib Binary files differindex bba5b4e599..8f3566dc61 100644 --- a/libs/win64/mir_app.lib +++ b/libs/win64/mir_app.lib diff --git a/plugins/StatusManager/res/resource.rc b/plugins/StatusManager/res/resource.rc index 7bd71d111b..0bb96d7e8c 100644 --- a/plugins/StatusManager/res/resource.rc +++ b/plugins/StatusManager/res/resource.rc @@ -65,9 +65,9 @@ END // AFX_DIALOG_LAYOUT // -IDD_OPT_SUBPLUGINS AFX_DIALOG_LAYOUT +IDD_OPT_SUBPLUGINS AFX_DIALOG_LAYOUT BEGIN - 0x0000 + 0 END #endif // English resources @@ -125,14 +125,13 @@ BEGIN PUSHBUTTON "Message",IDC_SETSTSMSG,131,100,50,14 END -IDD_OPT_AUTOAWAY DIALOGEX 0, 0, 298, 204 +IDD_OPT_AUTOAWAY DIALOGEX 0, 0, 298, 218 STYLE DS_SETFONT | DS_FIXEDSYS | WS_CHILD EXSTYLE WS_EX_CONTROLPARENT FONT 8, "MS Shell Dlg", 0, 0, 0x1 BEGIN LTEXT "Account:",IDC_STATIC,191,11,96,8 COMBOBOX IDC_PROTOCOL,190,22,106,138,CBS_DROPDOWNLIST | CBS_SORT | WS_VSCROLL | WS_TABSTOP - GROUPBOX "Away mode",IDC_STATIC,8,5,174,95 RTEXT "Set",IDC_STATIC,15,18,33,8 COMBOBOX IDC_LV1STATUS,51,16,65,101,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP @@ -144,7 +143,6 @@ BEGIN CONTROL "after",IDC_TIMED,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,15,86,32,8 EDITTEXT IDC_AWAYTIME,53,84,26,12,ES_AUTOHSCROLL LTEXT "minutes of inactivity",IDC_LV1AFTERSTR,85,86,89,8 - GROUPBOX "After away",IDC_STATIC,8,101,174,58 RTEXT "Set",IDC_STATIC,15,115,33,8 COMBOBOX IDC_LV2STATUS,51,113,65,101,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP @@ -152,14 +150,12 @@ BEGIN EDITTEXT IDC_NATIME,53,129,26,12,ES_AUTOHSCROLL LTEXT "minutes of level 1 mode",IDC_SETNASTR,84,131,89,8 CONTROL "only set when inactive",IDC_LV2ONINACTIVE,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,15,144,159,10 - CONTROL "Monitor Miranda's activity only",IDC_MONITORMIRANDA, - "Button",BS_AUTOCHECKBOX | WS_TABSTOP,8,163,174,12 - - CONTROL "Reset status on return",IDC_RESETSTATUS,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,8,176,174,11 + CONTROL "Monitor Miranda's activity only",IDC_MONITORMIRANDA, "Button",BS_AUTOCHECKBOX | WS_TABSTOP,8,163,174,10 + CONTROL "Reset status on return",IDC_RESETSTATUS,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,8,176,174,10 CONTROL "Confirm resetting status",IDC_CONFIRM,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,8,189,174,10 - + CONTROL "Enter idle mode",IDC_ENTERIDLE,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,8,202,174,10 LTEXT "Only set if current status is",IDC_STATIC,191,42,106,8 - CONTROL "",IDC_STATUSLIST,"SysListView32",LVS_REPORT | LVS_SINGLESEL | LVS_SHOWSELALWAYS | LVS_ALIGNLEFT | LVS_NOCOLUMNHEADER | WS_BORDER | WS_TABSTOP,191,52,107,146 + CONTROL "",IDC_STATUSLIST,"SysListView32",LVS_REPORT | LVS_SINGLESEL | LVS_SHOWSELALWAYS | LVS_ALIGNLEFT | LVS_NOCOLUMNHEADER | WS_BORDER | WS_TABSTOP,191,52,106,146 END IDD_CMDLOPTIONS DIALOGEX 0, 0, 315, 82 @@ -424,6 +420,7 @@ BEGIN IDD_OPT_AUTOAWAY, DIALOG BEGIN VERTGUIDE, 182 + BOTTOMMARGIN, 204 END IDD_PUOPT_KEEPSTATUS, DIALOG @@ -473,34 +470,34 @@ END // AFX_DIALOG_LAYOUT // -IDD_OPT_KS_ADV AFX_DIALOG_LAYOUT +IDD_OPT_KS_ADV AFX_DIALOG_LAYOUT BEGIN - 0x0000 + 0 END -IDD_OPT_AUTOAWAY AFX_DIALOG_LAYOUT +IDD_OPT_AUTOAWAY AFX_DIALOG_LAYOUT BEGIN - 0x0000 + 0 END -IDD_OPT_GENAUTOAWAY AFX_DIALOG_LAYOUT +IDD_OPT_GENAUTOAWAY AFX_DIALOG_LAYOUT BEGIN - 0x0000 + 0 END -IDD_OPT_KS_BASIC AFX_DIALOG_LAYOUT +IDD_OPT_KS_BASIC AFX_DIALOG_LAYOUT BEGIN - 0x0000 + 0 END -IDD_PUOPT_KEEPSTATUS AFX_DIALOG_LAYOUT +IDD_PUOPT_KEEPSTATUS AFX_DIALOG_LAYOUT BEGIN - 0x0000 + 0 END -IDD_TRG_AAASTATECHANGE AFX_DIALOG_LAYOUT +IDD_TRG_AAASTATECHANGE AFX_DIALOG_LAYOUT BEGIN - 0x0000 + 0 END @@ -538,7 +535,9 @@ END // Icon with lowest ID value placed first to ensure application icon // remains consistent on all systems. IDI_TTBDOWN ICON "ttbDown.ico" + IDI_TTBUP ICON "ttbUp.ico" + #endif // German (Germany) resources ///////////////////////////////////////////////////////////////////////////// diff --git a/plugins/StatusManager/src/AdvancedAutoAway/aaa_options.cpp b/plugins/StatusManager/src/AdvancedAutoAway/aaa_options.cpp index bd96bccb30..eb91254af3 100644 --- a/plugins/StatusManager/src/AdvancedAutoAway/aaa_options.cpp +++ b/plugins/StatusManager/src/AdvancedAutoAway/aaa_options.cpp @@ -66,6 +66,7 @@ static void SetDialogItems(HWND hwndDlg, SMProto *setting) CheckDlgButton(hwndDlg, IDC_SETNA, bSetNA ? BST_CHECKED : BST_UNCHECKED); CheckDlgButton(hwndDlg, IDC_CONFIRM, (setting->optionFlags & FLAG_CONFIRM) != 0 ? BST_CHECKED : BST_UNCHECKED); CheckDlgButton(hwndDlg, IDC_RESETSTATUS, (setting->optionFlags & FLAG_RESET) != 0 ? BST_CHECKED : BST_UNCHECKED); + CheckDlgButton(hwndDlg, IDC_ENTERIDLE, (setting->optionFlags & FLAG_ENTERIDLE) != 0 ? BST_CHECKED : BST_UNCHECKED); CheckDlgButton(hwndDlg, IDC_MONITORMIRANDA, (setting->optionFlags & FLAG_MONITORMIRANDA) != 0 ? BST_CHECKED : BST_UNCHECKED); CheckDlgButton(hwndDlg, IDC_LV2ONINACTIVE, (setting->optionFlags & FLAG_LV2ONINACTIVE) != 0 ? BST_CHECKED : BST_UNCHECKED); @@ -298,6 +299,11 @@ static INT_PTR CALLBACK DlgProcAutoAwayRulesOpts(HWND hwndDlg, UINT msg, WPARAM setting->optionFlags ^= FLAG_MONITORMIRANDA; SetDialogItems(hwndDlg, setting); break; + + case IDC_ENTERIDLE: + setting->optionFlags ^= FLAG_ENTERIDLE; + SetDialogItems(hwndDlg, setting); + break; } break; diff --git a/plugins/StatusManager/src/AdvancedAutoAway/advancedautoaway.cpp b/plugins/StatusManager/src/AdvancedAutoAway/advancedautoaway.cpp index 734d50ffdb..270375e94c 100644 --- a/plugins/StatusManager/src/AdvancedAutoAway/advancedautoaway.cpp +++ b/plugins/StatusManager/src/AdvancedAutoAway/advancedautoaway.cpp @@ -116,7 +116,7 @@ int LoadAutoAwaySetting(SMProto &autoAwaySetting, char* protoName) { char setting[128]; mir_snprintf(setting, "%s_OptionFlags", protoName); - autoAwaySetting.optionFlags = db_get_w(0, AAAMODULENAME, setting, FLAG_LV2ONINACTIVE | FLAG_RESET); + autoAwaySetting.optionFlags = db_get_w(0, AAAMODULENAME, setting, FLAG_LV2ONINACTIVE | FLAG_RESET | FLAG_ENTERIDLE); mir_snprintf(setting, "%s_AwayTime", protoName); autoAwaySetting.awayTime = db_get_w(0, AAAMODULENAME, setting, SETTING_AWAYTIME_DEFAULT); mir_snprintf(setting, "%s_NATime", protoName); @@ -173,7 +173,7 @@ static char* status2descr(int status) return "ERROR"; } -static int changeState(SMProto &setting, STATES newState) +static int changeState(SMProto &setting, int mode, STATES newState) { if (setting.curState == newState) return 0; @@ -198,6 +198,13 @@ static int changeState(SMProto &setting, STATES newState) setting.m_szMsg = nullptr; } + if (setting.optionFlags & FLAG_ENTERIDLE) { + if (newState == ACTIVE) // we're returning back + Idle_Enter(-1); + else + Idle_Enter(mode); + } + return 0; } @@ -209,7 +216,7 @@ static VOID CALLBACK AutoAwayTimer(HWND, UINT, UINT_PTR, DWORD) for (auto &it : protoList) { it->aaaStatus = ID_STATUS_DISABLED; - BOOL bTrigger = false; + int mode = 0; if (it->optionFlags & FLAG_MONITORMIRANDA) mouseStationaryTimer = (GetTickCount() - lastMirandaInput) / 1000; @@ -225,45 +232,48 @@ static VOID CALLBACK AutoAwayTimer(HWND, UINT, UINT_PTR, DWORD) int currentMode = Proto_GetStatus(it->m_szName); if (it->optionFlags & FLAG_ONSAVER) - bTrigger |= IsScreenSaverRunning(); - if (it->optionFlags & FLAG_ONLOCK) - bTrigger |= IsWorkstationLocked(); - if (it->optionFlags & FLAG_ONTS) - bTrigger |= IsTerminalDisconnected(); - if (it->optionFlags & FLAG_FULLSCREEN) - bTrigger |= IsFullScreen(); + mode = 1; + else if (it->optionFlags & FLAG_ONLOCK) + mode = 2; + else if (it->optionFlags & FLAG_ONTS) + mode = 3; + else if (it->optionFlags & FLAG_FULLSCREEN) + mode = 4; /* check states */ if (it->curState == ACTIVE) { - if (((mouseStationaryTimer >= sts1Time && (it->optionFlags & FLAG_ONMOUSE)) || bTrigger) && currentMode != it->lv1Status && it->statusFlags&StatusModeToProtoFlag(currentMode)) { + if (((mouseStationaryTimer >= sts1Time && (it->optionFlags & FLAG_ONMOUSE)) || mode) && currentMode != it->lv1Status && it->statusFlags&StatusModeToProtoFlag(currentMode)) { + if (it->optionFlags & FLAG_ONMOUSE) + mode = 5; + /* from ACTIVE to STATUS1_SET */ it->m_lastStatus = it->originalStatusMode = Proto_GetStatus(it->m_szName); it->aaaStatus = it->lv1Status; it->sts1setTimer = GetTickCount(); sts1setTime = 0; it->bStatusChanged = statusChanged = true; - changeState(*it, STATUS1_SET); + changeState(*it, mode, STATUS1_SET); } else if (mouseStationaryTimer >= sts2Time && currentMode == it->lv1Status && currentMode != it->lv2Status && (it->optionFlags & FLAG_SETNA) && (it->statusFlags & StatusModeToProtoFlag(currentMode))) { /* from ACTIVE to STATUS2_SET */ it->m_lastStatus = it->originalStatusMode = Proto_GetStatus(it->m_szName); it->aaaStatus = it->lv2Status; it->bStatusChanged = statusChanged = true; - changeState(*it, STATUS2_SET); + changeState(*it, mode, STATUS2_SET); } } if (it->curState == STATUS1_SET) { - if ((mouseStationaryTimer < sts1Time && !bTrigger) && !(it->optionFlags & FLAG_RESET)) { + if ((mouseStationaryTimer < sts1Time && !mode) && !(it->optionFlags & FLAG_RESET)) { /* from STATUS1_SET to HIDDEN_ACTIVE */ - changeState(*it, HIDDEN_ACTIVE); + changeState(*it, mode, HIDDEN_ACTIVE); it->m_lastStatus = Proto_GetStatus(it->m_szName); } - else if (((mouseStationaryTimer < sts1Time) && !bTrigger) && - ((it->optionFlags & FLAG_LV2ONINACTIVE) || (!(it->optionFlags&FLAG_SETNA))) && + else if (((mouseStationaryTimer < sts1Time) && !mode) && + ((it->optionFlags & FLAG_LV2ONINACTIVE) || (!(it->optionFlags & FLAG_SETNA))) && (it->optionFlags & FLAG_RESET)) { /* from STATUS1_SET to SET_ORGSTATUS */ - changeState(*it, SET_ORGSTATUS); + changeState(*it, mode, SET_ORGSTATUS); } else if ((it->optionFlags & FLAG_SETNA) && sts1setTime >= sts2Time) { /* when set STATUS2, currentMode doesn't have to be in the selected status list (statusFlags) */ @@ -271,19 +281,19 @@ static VOID CALLBACK AutoAwayTimer(HWND, UINT, UINT_PTR, DWORD) it->m_lastStatus = Proto_GetStatus(it->m_szName); it->aaaStatus = it->lv2Status; it->bStatusChanged = statusChanged = true; - changeState(*it, STATUS2_SET); + changeState(*it, mode, STATUS2_SET); } } if (it->curState == STATUS2_SET) { - if (mouseStationaryTimer < sts2Time && !bTrigger && (it->optionFlags & FLAG_RESET)) { + if (mouseStationaryTimer < sts2Time && !mode && (it->optionFlags & FLAG_RESET)) { /* from STATUS2_SET to SET_ORGSTATUS */ - changeState(*it, SET_ORGSTATUS); + changeState(*it, mode, SET_ORGSTATUS); } - else if (mouseStationaryTimer < sts2Time && !bTrigger && !(it->optionFlags & FLAG_RESET)) { + else if (mouseStationaryTimer < sts2Time && !mode && !(it->optionFlags & FLAG_RESET)) { /* from STATUS2_SET to HIDDEN_ACTIVE */ /* Remember: after status1 is set, and "only on inactive" is NOT set, it implies !reset. */ - changeState(*it, HIDDEN_ACTIVE); + changeState(*it, mode, HIDDEN_ACTIVE); it->m_lastStatus = Proto_GetStatus(it->m_szName); } } @@ -292,7 +302,7 @@ static VOID CALLBACK AutoAwayTimer(HWND, UINT, UINT_PTR, DWORD) if (it->bManualStatus) { /* HIDDEN_ACTIVE to ACTIVE */ // it->bStatusChanged = false; - changeState(*it, ACTIVE); + changeState(*it, mode, ACTIVE); it->sts1setTimer = 0; it->bManualStatus = false; } @@ -303,7 +313,7 @@ static VOID CALLBACK AutoAwayTimer(HWND, UINT, UINT_PTR, DWORD) it->m_lastStatus = it->originalStatusMode = Proto_GetStatus(it->m_szName); it->aaaStatus = it->lv2Status; it->bStatusChanged = statusChanged = true; - changeState(*it, STATUS2_SET); + changeState(*it, mode, STATUS2_SET); } } if (it->curState == SET_ORGSTATUS) { @@ -312,7 +322,7 @@ static VOID CALLBACK AutoAwayTimer(HWND, UINT, UINT_PTR, DWORD) it->aaaStatus = it->originalStatusMode; confirm = (it->optionFlags & FLAG_CONFIRM) ? TRUE : confirm; it->bStatusChanged = statusChanged = true; - changeState(*it, ACTIVE); + changeState(*it, mode, ACTIVE); it->sts1setTimer = 0; } it->bManualStatus = false; diff --git a/plugins/StatusManager/src/AdvancedAutoAway/advancedautoaway.h b/plugins/StatusManager/src/AdvancedAutoAway/advancedautoaway.h index b6ca5cbeb6..e2d6b4ec61 100644 --- a/plugins/StatusManager/src/AdvancedAutoAway/advancedautoaway.h +++ b/plugins/StatusManager/src/AdvancedAutoAway/advancedautoaway.h @@ -28,6 +28,7 @@ #define SETTING_MSGCUSTOM "Custom" #define SETTING_STATUSMSG "Msg" #define SETTING_CONFIRMDELAY "ConfirmTimeout" +#define SETTING_ENTERIDLE "EnterIdle" #define SETTING_AWAYTIME_DEFAULT 5 #define SETTING_NATIME_DEFAULT 20 diff --git a/plugins/StatusManager/src/commonstatus.h b/plugins/StatusManager/src/commonstatus.h index fe80354d9c..217903ff79 100644 --- a/plugins/StatusManager/src/commonstatus.h +++ b/plugins/StatusManager/src/commonstatus.h @@ -89,6 +89,7 @@ bool IsSuitableProto(PROTOACCOUNT *pa); #define FLAG_ONLOCK 0x0080 // db: on work station lock #define FLAG_FULLSCREEN 0x0100 // db: on full screen #define FLAG_ONTS 0x0200 // db: on terminal session disconnect +#define FLAG_ENTERIDLE 0x0400 // db: enter idle with AA mode typedef enum { diff --git a/plugins/StatusManager/src/resource.h b/plugins/StatusManager/src/resource.h index d3701f8c2f..b507e0c632 100644 --- a/plugins/StatusManager/src/resource.h +++ b/plugins/StatusManager/src/resource.h @@ -22,48 +22,57 @@ #define IDC_PROTOCOL 1000 #define IDC_STATUS 1001 #define IDC_PROFILE 1002 -#define IDC_STARTUPLIST 1008 -#define IDC_STATUSMSG 1008 -#define IDC_SETPROFILE 1010 -#define IDC_SETWINSTATE 1011 -#define IDC_WINSTATE 1012 -#define IDC_CLOSE 1013 -#define IDC_SHOWDIALOG 1014 -#define IDC_OFFLINECLOSE 1016 -#define IDC_CONFIRM 1017 -#define IDC_SHOWCMDL 1018 -#define IDC_COPY 1019 -#define IDC_CMDL 1020 -#define IDC_OK 1021 -#define IDC_SHORTCUT 1022 -#define IDC_CHECKCONNECTION 1025 -#define IDC_MAXRETRIES 1026 -#define IDC_INITDELAY 1027 -#define IDC_SETPROFILEDELAY 1027 -#define IDC_DOCKED 1028 -#define IDC_SETDOCKED 1029 -#define IDC_MAXDELAY 1031 -#define IDC_INCREASEEXPONENTIAL 1032 -#define IDC_LNOTHING 1032 -#define IDC_LCLOSE 1033 -#define IDC_LV1STATUS 1035 -#define IDC_LV2STATUS 1036 -#define IDC_STATUSLIST 1037 -#define IDC_LV1AFTERSTR 1038 -#define IDC_SHOWCONNECTIONPOPUPS 1040 -#define IDC_ADDPROFILE 1041 -#define IDC_DELPROFILE 1042 -#define IDC_PROFILENAME 1043 -#define IDC_CANCEL 1044 -#define IDC_MONITORMIRANDA 1045 -#define IDC_WINCOLORS 1045 -#define IDC_CHKINET 1045 -#define IDC_IGNLOCK 1045 -#define IDC_CREATETTB 1046 -#define IDC_PERPROTOCOLSETTINGS 1050 -#define IDC_SAMESETTINGS 1051 -#define IDC_RESETSTATUS 1052 -#define IDC_SETSTSMSG 1053 +#define IDC_STARTUPLIST 1003 +#define IDC_STATUSMSG 1004 +#define IDC_SETPROFILE 1005 +#define IDC_SETWINSTATE 1006 +#define IDC_WINSTATE 1007 +#define IDC_CLOSE 1008 +#define IDC_SHOWDIALOG 1009 +#define IDC_OFFLINECLOSE 1010 +#define IDC_CONFIRM 1011 +#define IDC_SHOWCMDL 1012 +#define IDC_COPY 1013 +#define IDC_CMDL 1014 +#define IDC_OK 1015 +#define IDC_SHORTCUT 1016 +#define IDC_CHECKCONNECTION 1017 +#define IDC_MAXRETRIES 1018 +#define IDC_INITDELAY 1019 +#define IDC_SETPROFILEDELAY 1020 +#define IDC_DOCKED 1021 +#define IDC_SETDOCKED 1022 +#define IDC_MAXDELAY 1023 +#define IDC_INCREASEEXPONENTIAL 1024 +#define IDC_LNOTHING 1025 +#define IDC_LCLOSE 1026 +#define IDC_LV1STATUS 1027 +#define IDC_LV2STATUS 1028 +#define IDC_STATUSLIST 1029 +#define IDC_LV1AFTERSTR 1030 +#define IDC_SHOWCONNECTIONPOPUPS 1031 +#define IDC_ADDPROFILE 1032 +#define IDC_DELPROFILE 1033 +#define IDC_PROFILENAME 1034 +#define IDC_CANCEL 1035 +#define IDC_MONITORMIRANDA 1036 +#define IDC_WINCOLORS 1037 +#define IDC_CHKINET 1038 +#define IDC_IGNLOCK 1039 +#define IDC_CREATETTB 1040 +#define IDC_PERPROTOCOLSETTINGS 1041 +#define IDC_SAMESETTINGS 1042 +#define IDC_RESETSTATUS 1043 +#define IDC_SETSTSMSG 1044 +#define IDC_SCREENSAVE 1045 +#define IDC_TIMED 1046 +#define IDC_AWAYTIME 1047 +#define IDC_SETNA 1048 +#define IDC_NATIME 1049 +#define IDC_FULLSCREEN 1050 +#define IDC_RADUSEMIRANDA 1051 +#define IDC_RADUSECUSTOM 1052 +#define IDC_SETNASTR 1053 #define IDC_DEFAULTCOLORS 1054 #define IDC_ONLOCK 1055 #define IDC_LOGINERR 1056 @@ -86,6 +95,7 @@ #define IDC_TEXTCOLOR 1075 #define IDC_PREV 1076 #define IDC_LOGINERR_DELAY 1077 +#define IDC_ENTERIDLE 1078 #define IDC_PROTOLIST 1079 #define IDC_ENABLECHECKING 1080 #define IDC_DISABLECHECKING 1081 @@ -139,15 +149,6 @@ #define IDC_ENABLE_KEEPSTATUS 1141 #define IDC_ENABLE_STARTUPSTATUS 1142 #define IDC_ENABLE_ADVANCEDAUTOAWAY 1143 -#define IDC_SCREENSAVE 1145 -#define IDC_TIMED 1146 -#define IDC_AWAYTIME 1147 -#define IDC_SETNA 1148 -#define IDC_NATIME 1149 -#define IDC_FULLSCREEN 1150 -#define IDC_RADUSEMIRANDA 1210 -#define IDC_RADUSECUSTOM 1212 -#define IDC_SETNASTR 1568 // Next default values for new objects // @@ -155,7 +156,7 @@ #ifndef APSTUDIO_READONLY_SYMBOLS #define _APS_NEXT_RESOURCE_VALUE 131 #define _APS_NEXT_COMMAND_VALUE 40001 -#define _APS_NEXT_CONTROL_VALUE 1144 +#define _APS_NEXT_CONTROL_VALUE 1145 #define _APS_NEXT_SYMED_VALUE 101 #endif #endif diff --git a/plugins/StatusManager/src/stdafx.h b/plugins/StatusManager/src/stdafx.h index dbf035fe4a..6767d08ef4 100644 --- a/plugins/StatusManager/src/stdafx.h +++ b/plugins/StatusManager/src/stdafx.h @@ -15,6 +15,7 @@ #include <m_skin.h> #include <m_clistint.h> #include <m_utils.h> +#include <m_idle.h> #include <m_icolib.h> #include <m_options.h> #include <m_protosvc.h> diff --git a/src/core/stdautoaway/res/resource.rc b/src/core/stdautoaway/res/resource.rc index 16038b37b3..ac6ee6fb77 100644 --- a/src/core/stdautoaway/res/resource.rc +++ b/src/core/stdautoaway/res/resource.rc @@ -25,6 +25,37 @@ LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US // Dialog
//
+IDD_OPT_IDLE DIALOGEX 0, 0, 312, 193
+STYLE DS_SETFONT | DS_FIXEDSYS | WS_CHILD
+EXSTYLE WS_EX_CONTROLPARENT
+FONT 8, "MS Shell Dlg", 0, 0, 0x1
+BEGIN
+ CONTROL "Become idle if the following is left unattended:",IDC_IDLESHORT,
+ "Button",BS_AUTOCHECKBOX | WS_TABSTOP,25,18,259,9
+ CONTROL "Windows",IDC_IDLEONWINDOWS,"Button",BS_AUTORADIOBUTTON,45,31,104,9
+ CONTROL "Miranda",IDC_IDLEONMIRANDA,"Button",BS_AUTORADIOBUTTON,45,43,103,9
+ EDITTEXT IDC_IDLE1STTIME,59,59,27,14,ES_AUTOHSCROLL | ES_NUMBER
+ CONTROL "Spin2",IDC_IDLESPIN,"msctls_updown32",UDS_SETBUDDYINT | UDS_ALIGNRIGHT | UDS_AUTOBUDDY | UDS_ARROWKEYS | UDS_NOTHOUSANDS | UDS_HOTTRACK,86,59,11,14
+ CONTROL "Become idle if the screen saver is active",IDC_SCREENSAVER,
+ "Button",BS_AUTOCHECKBOX | WS_TABSTOP,25,83,265,9
+ CONTROL "Become idle if the computer is locked",IDC_LOCKED,
+ "Button",BS_AUTOCHECKBOX | WS_TABSTOP,25,105,265,9
+ CONTROL "Become idle if a terminal session is disconnected",IDC_IDLETERMINAL,
+ "Button",BS_AUTOCHECKBOX | WS_TABSTOP,25,116,265,10
+ CONTROL "Do not let protocols report any idle information",IDC_IDLEPRIVATE,
+ "Button",BS_AUTOCHECKBOX | WS_TABSTOP,25,131,251,9
+ LTEXT "minute(s)",IDC_STATIC,99,61,76,9
+ RTEXT "for",IDC_STATIC,12,62,41,8
+ COMBOBOX IDC_AASTATUS,161,146,64,50,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP
+ CONTROL "Change my status mode to:",IDC_AASHORTIDLE,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,25,147,132,11
+ CONTROL "Do not set status back to online when returning from idle",IDC_IDLESTATUSLOCK,
+ "Button",BS_AUTOCHECKBOX | WS_TABSTOP,35,164,254,10
+ GROUPBOX "Idle options",IDC_STATIC,3,1,304,192
+ CONTROL "Become idle if application full screen",IDC_FULLSCREEN,
+ "Button",BS_AUTOCHECKBOX | WS_TABSTOP,25,94,265,9
+ CONTROL "Disable sounds on idle",IDC_IDLESOUNDSOFF,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,25,177,265,9
+END
+
#endif // APSTUDIO_INVOKED
/////////////////////////////////////////////////////////////////////////////
diff --git a/src/core/stdautoaway/src/idle.cpp b/src/core/stdautoaway/src/idle.cpp new file mode 100644 index 0000000000..add27610b8 --- /dev/null +++ b/src/core/stdautoaway/src/idle.cpp @@ -0,0 +1,87 @@ +/* + +Miranda NG: the free IM client for Microsoft* Windows* + +Copyright (c) 2012-18 Miranda NG team (https://miranda-ng.org), +Copyright (c) 2000-12 Miranda IM project, +all portions of this codebase are copyrighted to the people +listed in contributors.txt. + +This program is free software; you can redistribute it and/or +modify it under the terms of the GNU General Public License +as published by the Free Software Foundation; either version 2 +of the License, or (at your option) any later version. + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with this program; if not, write to the Free Software +Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +*/ + +#include "stdafx.h" + +static UINT_PTR g_hTimer; + +int IdleOptInit(WPARAM wParam, LPARAM); + +static int IdleObject_IsUserIdle() +{ + if (g_plugin.bIdleMethod) { + DWORD dwTick; + CallService(MS_SYSTEM_GETIDLE, 0, (LPARAM)&dwTick); + return GetTickCount() - dwTick > (g_plugin.iIdleTime1st * 60 * 1000); + } + + LASTINPUTINFO ii = { sizeof(ii) }; + if (GetLastInputInfo(&ii)) + return GetTickCount() - ii.dwTime > (g_plugin.iIdleTime1st * 60 * 1000); + + return FALSE; +} + +static void CALLBACK IdleTimer(HWND, UINT, UINT_PTR idEvent, DWORD) +{ + if (g_hTimer == idEvent) { + if (g_plugin.bIdleCheck && IdleObject_IsUserIdle()) + Idle_Enter(1); + + else if (g_plugin.bIdleOnSaver && IsScreenSaverRunning()) + Idle_Enter(2); + + else if (g_plugin.bIdleOnFullScr && IsFullScreen()) + Idle_Enter(3); + + else if (g_plugin.bIdleOnLock && IsWorkstationLocked()) + Idle_Enter(4); + + else if (g_plugin.bIdleOnTerminal && IsTerminalDisconnected()) + Idle_Enter(5); + } +} + +void IdleObject_Create() +{ + g_hTimer = SetTimer(nullptr, 0, 2000, IdleTimer); +} + +void IdleObject_Destroy() +{ + KillTimer(nullptr, g_hTimer); +} + +int LoadIdleModule(void) +{ + IdleObject_Create(); + + HookEvent(ME_OPT_INITIALISE, IdleOptInit); + return 0; +} + +void UnloadIdleModule() +{ + IdleObject_Destroy(); +} diff --git a/src/core/stdautoaway/src/main.cpp b/src/core/stdautoaway/src/main.cpp index 08cb2a891c..4aed198a66 100644 --- a/src/core/stdautoaway/src/main.cpp +++ b/src/core/stdautoaway/src/main.cpp @@ -41,8 +41,21 @@ PLUGININFOEX pluginInfoEx = { };
CMPlugin::CMPlugin() :
- PLUGIN<CMPlugin>(MODULENAME, pluginInfoEx)
-{}
+ PLUGIN<CMPlugin>(MODULENAME, pluginInfoEx),
+ bIdleCheck(IDLENAME, "UserIdleCheck", 0),
+ bIdleMethod(IDLENAME, "IdleMethod", 0),
+ bIdleOnSaver(IDLENAME, "IdleOnSaver", 0),
+ bIdleOnFullScr(IDLENAME, "IdleOnFullScr", 0),
+ bIdleOnLock(IDLENAME, "IdleOnLock", 0),
+ bIdlePrivate(IDLENAME, "IdlePrivate", 0),
+ bIdleSoundsOff(IDLENAME, "IdleSoundsOff", 1),
+ bIdleOnTerminal(IDLENAME, "IdleOnTerminalDisconnect", 0),
+ bIdleStatusLock(IDLENAME, "IdleStatusLock", 0),
+ bAAEnable(IDLENAME, "AAEnable", 0),
+ bAAStatus(IDLENAME, "AAStatus", 0),
+ iIdleTime1st(IDLENAME, "IdleTime1st", 10)
+{
+}
/////////////////////////////////////////////////////////////////////////////////////////
diff --git a/src/core/stdidle/src/options.cpp b/src/core/stdautoaway/src/options.cpp index 71b8c14f27..e8ee0669da 100644 --- a/src/core/stdidle/src/options.cpp +++ b/src/core/stdautoaway/src/options.cpp @@ -73,41 +73,41 @@ public: chkFullScreen(this, IDC_FULLSCREEN), chkScreenSaver(this, IDC_SCREENSAVER) { - CreateLink(chkShort, S.bIdleCheck); - CreateLink(chkLocked, S.bIdleOnLock); - CreateLink(chkPrivate, S.bIdlePrivate); - CreateLink(chkTerminal, S.bIdleOnTerminal); - CreateLink(chkShortIdle, S.bAAEnable); - CreateLink(chkOnMiranda, S.bIdleMethod); - CreateLink(chkSoundsOff, S.bIdleSoundsOff); - CreateLink(chkStatusLock, S.bIdleStatusLock); - CreateLink(chkFullScreen, S.bIdleOnFullScr); - CreateLink(chkScreenSaver, S.bIdleOnSaver); + CreateLink(chkShort, g_plugin.bIdleCheck); + CreateLink(chkLocked, g_plugin.bIdleOnLock); + CreateLink(chkPrivate, g_plugin.bIdlePrivate); + CreateLink(chkTerminal, g_plugin.bIdleOnTerminal); + CreateLink(chkShortIdle, g_plugin.bAAEnable); + CreateLink(chkOnMiranda, g_plugin.bIdleMethod); + CreateLink(chkSoundsOff, g_plugin.bIdleSoundsOff); + CreateLink(chkStatusLock, g_plugin.bIdleStatusLock); + CreateLink(chkFullScreen, g_plugin.bIdleOnFullScr); + CreateLink(chkScreenSaver, g_plugin.bIdleOnSaver); chkShortIdle.OnChange = chkShort.OnChange = Callback(this, &COptionsDlg::onChange); } virtual void OnInitDialog() override { - chkOnWindows.SetState(!S.bIdleMethod); + chkOnWindows.SetState(!g_plugin.bIdleMethod); spinIdle.SetRange(60, 1); - spinIdle.SetPosition(S.iIdleTime1st); + spinIdle.SetPosition(g_plugin.iIdleTime1st); for (auto &it : aa_Status) cmbAAStatus.AddString(Clist_GetStatusModeDescription(it, 0)); - cmbAAStatus.SetCurSel(IdleGetStatusIndex(S.bAAStatus)); + cmbAAStatus.SetCurSel(IdleGetStatusIndex(g_plugin.bAAStatus)); ShowHide(); } virtual void OnApply() override { - S.iIdleTime1st = spinIdle.GetPosition(); + g_plugin.iIdleTime1st = spinIdle.GetPosition(); int curSel = cmbAAStatus.GetCurSel(); if (curSel != CB_ERR) - S.bAAStatus = aa_Status[curSel]; + g_plugin.bAAStatus = aa_Status[curSel]; // destroy any current idle and reset settings. IdleObject_Destroy(); diff --git a/src/core/stdautoaway/src/stdafx.h b/src/core/stdautoaway/src/stdafx.h index 6c55b9c1b5..98f1ef29c5 100644 --- a/src/core/stdautoaway/src/stdafx.h +++ b/src/core/stdautoaway/src/stdafx.h @@ -45,6 +45,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #include <newpluginapi.h>
#include <m_utils.h>
#include <m_netlib.h>
+#include <m_clist.h>
#include <m_crypto.h>
#include <m_langpack.h>
#include <m_button.h>
@@ -60,16 +61,27 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #include <m_idle.h>
#include <m_icolib.h>
#include <m_timezones.h>
+#include <m_gui.h>
#include "version.h"
#include "../../mir_app/src/resource.h"
#define MODULENAME "AutoAway"
+#define IDLENAME "Idle"
struct CMPlugin : public PLUGIN<CMPlugin>
{
CMPlugin();
int Load() override;
+
+ CMOption<BYTE> bIdleCheck, bIdleMethod, bIdleOnSaver, bIdleOnFullScr, bIdleOnLock;
+ CMOption<BYTE> bIdlePrivate, bIdleSoundsOff, bIdleOnTerminal, bIdleStatusLock;
+ CMOption<BYTE> bAAEnable;
+ CMOption<WORD> bAAStatus;
+ CMOption<DWORD> iIdleTime1st;
};
+
+void IdleObject_Destroy();
+void IdleObject_Create();
diff --git a/src/core/stdidle/CMakeLists.txt b/src/core/stdidle/CMakeLists.txt deleted file mode 100644 index 67735cfc07..0000000000 --- a/src/core/stdidle/CMakeLists.txt +++ /dev/null @@ -1,2 +0,0 @@ -set(TARGET StdIdle) -include(${CMAKE_SOURCE_DIR}/cmake/core.cmake)
\ No newline at end of file diff --git a/src/core/stdidle/res/resource.rc b/src/core/stdidle/res/resource.rc deleted file mode 100644 index 1b926065de..0000000000 --- a/src/core/stdidle/res/resource.rc +++ /dev/null @@ -1,90 +0,0 @@ -// Microsoft Visual C++ generated resource script.
-//
-#include "..\..\mir_app\src\resource.h"
-
-#define APSTUDIO_READONLY_SYMBOLS
-/////////////////////////////////////////////////////////////////////////////
-//
-// Generated from the TEXTINCLUDE 2 resource.
-//
-#include <windows.h>
-#include <winres.h>
-
-/////////////////////////////////////////////////////////////////////////////
-#undef APSTUDIO_READONLY_SYMBOLS
-
-/////////////////////////////////////////////////////////////////////////////
-// English (United States) resources
-
-#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU)
-LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US
-#pragma code_page(1252)
-
-/////////////////////////////////////////////////////////////////////////////
-//
-// Dialog
-//
-
-IDD_OPT_IDLE DIALOGEX 0, 0, 312, 193
-STYLE DS_SETFONT | DS_FIXEDSYS | WS_CHILD
-EXSTYLE WS_EX_CONTROLPARENT
-FONT 8, "MS Shell Dlg", 0, 0, 0x1
-BEGIN
- CONTROL "Become idle if the following is left unattended:",IDC_IDLESHORT,
- "Button",BS_AUTOCHECKBOX | WS_TABSTOP,25,18,259,9
- CONTROL "Windows",IDC_IDLEONWINDOWS,"Button",BS_AUTORADIOBUTTON,45,31,104,9
- CONTROL "Miranda",IDC_IDLEONMIRANDA,"Button",BS_AUTORADIOBUTTON,45,43,103,9
- EDITTEXT IDC_IDLE1STTIME,59,59,27,14,ES_AUTOHSCROLL | ES_NUMBER
- CONTROL "Spin2",IDC_IDLESPIN,"msctls_updown32",UDS_SETBUDDYINT | UDS_ALIGNRIGHT | UDS_AUTOBUDDY | UDS_ARROWKEYS | UDS_NOTHOUSANDS | UDS_HOTTRACK,86,59,11,14
- CONTROL "Become idle if the screen saver is active",IDC_SCREENSAVER,
- "Button",BS_AUTOCHECKBOX | WS_TABSTOP,25,83,265,9
- CONTROL "Become idle if the computer is locked",IDC_LOCKED,
- "Button",BS_AUTOCHECKBOX | WS_TABSTOP,25,105,265,9
- CONTROL "Become idle if a terminal session is disconnected",IDC_IDLETERMINAL,
- "Button",BS_AUTOCHECKBOX | WS_TABSTOP,25,116,265,10
- CONTROL "Do not let protocols report any idle information",IDC_IDLEPRIVATE,
- "Button",BS_AUTOCHECKBOX | WS_TABSTOP,25,131,251,9
- LTEXT "minute(s)",IDC_STATIC,99,61,76,9
- RTEXT "for",IDC_STATIC,12,62,41,8
- COMBOBOX IDC_AASTATUS,161,146,64,50,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP
- CONTROL "Change my status mode to:",IDC_AASHORTIDLE,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,25,147,132,11
- CONTROL "Do not set status back to online when returning from idle",IDC_IDLESTATUSLOCK,
- "Button",BS_AUTOCHECKBOX | WS_TABSTOP,35,164,254,10
- GROUPBOX "Idle options",IDC_STATIC,3,1,304,192
- CONTROL "Become idle if application full screen",IDC_FULLSCREEN,
- "Button",BS_AUTOCHECKBOX | WS_TABSTOP,25,94,265,9
- CONTROL "Disable sounds on idle",IDC_IDLESOUNDSOFF,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,25,177,265,9
-END
-
-#endif // APSTUDIO_INVOKED
-
-/////////////////////////////////////////////////////////////////////////////
-//
-// DESIGNINFO
-//
-
-#ifdef APSTUDIO_INVOKED
-/////////////////////////////////////////////////////////////////////////////
-//
-// TEXTINCLUDE
-//
-
-1 TEXTINCLUDE
-BEGIN
- "..\..\mir_app\src\resource.h\0"
-END
-
-2 TEXTINCLUDE
-BEGIN
- "#include <windows.h>\r\n"
- "#include <winres.h>\r\n"
- "\0"
-END
-
-3 TEXTINCLUDE
-BEGIN
- "\r\n"
- "\0"
-END
-
-#endif // APSTUDIO_INVOKED
diff --git a/src/core/stdidle/res/version.rc b/src/core/stdidle/res/version.rc deleted file mode 100644 index 5a5ddd63ed..0000000000 --- a/src/core/stdidle/res/version.rc +++ /dev/null @@ -1,9 +0,0 @@ -// Microsoft Visual C++ generated resource script. -// -#ifdef APSTUDIO_INVOKED -#error this file is not editable by Microsoft Visual C++ -#endif //APSTUDIO_INVOKED - -#include "..\src\version.h" - -#include "..\..\build\Version.rc" diff --git a/src/core/stdidle/src/idle.cpp b/src/core/stdidle/src/idle.cpp deleted file mode 100644 index 309375ed67..0000000000 --- a/src/core/stdidle/src/idle.cpp +++ /dev/null @@ -1,146 +0,0 @@ -/*
-
-Miranda NG: the free IM client for Microsoft* Windows*
-
-Copyright (c) 2012-18 Miranda NG team (https://miranda-ng.org),
-Copyright (c) 2000-12 Miranda IM project,
-all portions of this codebase are copyrighted to the people
-listed in contributors.txt.
-
-This program is free software; you can redistribute it and/or
-modify it under the terms of the GNU General Public License
-as published by the Free Software Foundation; either version 2
-of the License, or (at your option) any later version.
-
-This program is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-GNU General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with this program; if not, write to the Free Software
-Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-*/
-
-#include "stdafx.h"
-
-Settings S;
-
-static bool bModuleInitialized = false;
-
-static UINT_PTR g_hTimer;
-static int g_idleType;
-static int g_bIsIdle;
-
-static HANDLE hIdleEvent;
-
-void CALLBACK IdleTimer(HWND hwnd, UINT umsg, UINT_PTR idEvent, DWORD dwTime);
-int IdleOptInit(WPARAM wParam, LPARAM);
-
-void IdleObject_Create()
-{
- g_idleType = g_bIsIdle = 0;
- g_hTimer = SetTimer(nullptr, 0, 2000, IdleTimer);
-}
-
-void IdleObject_Destroy()
-{
- if (g_bIsIdle) {
- NotifyEventHooks(hIdleEvent, 0, 0);
- g_bIsIdle = false;
- }
- KillTimer(nullptr, g_hTimer);
-}
-
-static int IdleObject_IsUserIdle()
-{
- if (S.bIdleMethod) {
- DWORD dwTick;
- CallService(MS_SYSTEM_GETIDLE, 0, (LPARAM)&dwTick);
- return GetTickCount() - dwTick > (S.iIdleTime1st * 60 * 1000);
- }
-
- LASTINPUTINFO ii = { sizeof(ii) };
- if (GetLastInputInfo(&ii))
- return GetTickCount() - ii.dwTime > (S.iIdleTime1st * 60 * 1000);
-
- return FALSE;
-}
-
-static void IdleObject_Tick()
-{
- bool idle = false;
- int idleType = 0, flags = 0;
-
- if (S.bIdleCheck && IdleObject_IsUserIdle()) {
- idleType = 1; idle = true;
- }
- else if (S.bIdleOnSaver && IsScreenSaverRunning()) {
- idleType = 2; idle = true;
- }
- else if (S.bIdleOnFullScr && IsFullScreen()) {
- idleType = 5; idle = true;
- }
- else if (S.bIdleOnLock && IsWorkstationLocked()) {
- idleType = 3; idle = true;
- }
- else if (S.bIdleOnTerminal && IsTerminalDisconnected()) {
- idleType = 4; idle = true;
- }
-
- if (S.bIdlePrivate)
- flags |= IDF_PRIVACY;
-
- if (!g_bIsIdle && idle) {
- g_bIsIdle = true;
- g_idleType = idleType;
- NotifyEventHooks(hIdleEvent, 0, IDF_ISIDLE | flags);
- }
-
- if (g_bIsIdle && !idle) {
- g_bIsIdle = false;
- g_idleType = 0;
- NotifyEventHooks(hIdleEvent, 0, flags);
- }
-}
-
-void CALLBACK IdleTimer(HWND, UINT, UINT_PTR idEvent, DWORD)
-{
- if (g_hTimer == idEvent)
- IdleObject_Tick();
-}
-
-static INT_PTR IdleGetInfo(WPARAM, LPARAM lParam)
-{
- MIRANDA_IDLE_INFO *mii = (MIRANDA_IDLE_INFO*)lParam;
- if (!mii)
- return 1;
-
- mii->idleTime = S.iIdleTime1st;
- mii->privacy = S.bIdlePrivate;
- mii->aaStatus = (S.bAAEnable) ? S.bAAStatus : 0;
- mii->aaLock = S.bIdleStatusLock;
- mii->idlesoundsoff = S.bIdleSoundsOff;
- mii->idleType = g_idleType;
- return 0;
-}
-
-int LoadIdleModule(void)
-{
- bModuleInitialized = TRUE;
-
- hIdleEvent = CreateHookableEvent(ME_IDLE_CHANGED);
- IdleObject_Create();
- CreateServiceFunction(MS_IDLE_GETIDLEINFO, IdleGetInfo);
- HookEvent(ME_OPT_INITIALISE, IdleOptInit);
- return 0;
-}
-
-void UnloadIdleModule()
-{
- if (!bModuleInitialized) return;
-
- IdleObject_Destroy();
- DestroyHookableEvent(hIdleEvent);
- hIdleEvent = nullptr;
-}
diff --git a/src/core/stdidle/src/main.cpp b/src/core/stdidle/src/main.cpp deleted file mode 100644 index a77bcba4d3..0000000000 --- a/src/core/stdidle/src/main.cpp +++ /dev/null @@ -1,66 +0,0 @@ -/*
-
-Standard idle state module for Miranda NG
-
-Copyright (c) 2012-18 Miranda NG team (https://miranda-ng.org)
-
-This program is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2 of the License, or
-(at your option) any later version.
-
-This program is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-GNU General Public License for more details.
-
-You should have received a copy of the GNU General Public License along
-with this program; if not, write to the Free Software Foundation, Inc.,
-51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
-*/
-
-#include "stdafx.h"
-
-int LoadIdleModule(void);
-void UnloadIdleModule(void);
-
-CMPlugin g_plugin;
-
-/////////////////////////////////////////////////////////////////////////////////////////
-
-PLUGININFOEX pluginInfoEx = {
- sizeof(PLUGININFOEX),
- __PLUGIN_NAME,
- MIRANDA_VERSION_DWORD,
- __DESCRIPTION,
- __AUTHOR,
- __COPYRIGHT,
- __AUTHORWEB,
- UNICODE_AWARE,
- // 53ac190b-e223-4341-825f-709d8520215b
- { 0x53ac190b, 0xe223, 0x4341, {0x82, 0x5f, 0x70, 0x9d, 0x85, 0x20, 0x21, 0x5b}}
-};
-
-CMPlugin::CMPlugin() :
- PLUGIN<CMPlugin>(MODULENAME, pluginInfoEx)
-{}
-
-/////////////////////////////////////////////////////////////////////////////////////////
-
-extern "C" __declspec(dllexport) const MUUID MirandaInterfaces[] = { MIID_IDLE, MIID_LAST };
-
-/////////////////////////////////////////////////////////////////////////////////////////
-
-int CMPlugin::Load()
-{
- LoadIdleModule();
- return 0;
-}
-
-/////////////////////////////////////////////////////////////////////////////////////////
-
-int CMPlugin::Unload()
-{
- UnloadIdleModule();
- return 0;
-}
diff --git a/src/core/stdidle/src/stdafx.cxx b/src/core/stdidle/src/stdafx.cxx deleted file mode 100644 index 716dda68f1..0000000000 --- a/src/core/stdidle/src/stdafx.cxx +++ /dev/null @@ -1,2 +0,0 @@ -#include "stdafx.h"
-
diff --git a/src/core/stdidle/src/stdafx.h b/src/core/stdidle/src/stdafx.h deleted file mode 100644 index 1efc351565..0000000000 --- a/src/core/stdidle/src/stdafx.h +++ /dev/null @@ -1,105 +0,0 @@ -/*
-
-Miranda NG: the free IM client for Microsoft* Windows*
-
-Copyright (c) 2012-18 Miranda NG team (https://miranda-ng.org),
-Copyright (c) 2000-12 Miranda IM project,
-all portions of this codebase are copyrighted to the people
-listed in contributors.txt.
-
-This program is free software; you can redistribute it and/or
-modify it under the terms of the GNU General Public License
-as published by the Free Software Foundation; either version 2
-of the License, or (at your option) any later version.
-
-This program is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-GNU General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with this program; if not, write to the Free Software
-Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-*/
-
-#pragma once
-
-#include <winsock2.h>
-#include <shlobj.h>
-#include <commctrl.h>
-#include <vssym32.h>
-
-#include <stdio.h>
-#include <time.h>
-#include <stddef.h>
-#include <process.h>
-#include <io.h>
-#include <limits.h>
-#include <string.h>
-#include <locale.h>
-#include <direct.h>
-#include <malloc.h>
-
-#include <win2k.h>
-#include <m_system.h>
-#include <newpluginapi.h>
-#include <m_utils.h>
-#include <m_netlib.h>
-#include <m_langpack.h>
-#include <m_clistint.h>
-#include <m_button.h>
-#include <m_protosvc.h>
-#include <m_protocols.h>
-#include <m_options.h>
-#include <m_skin.h>
-#include <m_gui.h>
-#include <m_contacts.h>
-#include <m_message.h>
-#include <m_userinfo.h>
-#include <m_findadd.h>
-#include <m_idle.h>
-#include <m_icolib.h>
-#include <m_timezones.h>
-
-#include "version.h"
-
-#include "../../mir_app/src/resource.h"
-
-#define MODULENAME "Idle"
-
-struct CMPlugin : public PLUGIN<CMPlugin>
-{
- CMPlugin();
-
- int Load() override;
- int Unload() override;
-};
-
-struct Settings
-{
- Settings() :
- bIdleCheck(MODULENAME, "UserIdleCheck", 0),
- bIdleMethod(MODULENAME, "IdleMethod", 0),
- bIdleOnSaver(MODULENAME, "IdleOnSaver", 0),
- bIdleOnFullScr(MODULENAME, "IdleOnFullScr", 0),
- bIdleOnLock(MODULENAME, "IdleOnLock", 0),
- bIdlePrivate(MODULENAME, "IdlePrivate", 0),
- bIdleSoundsOff(MODULENAME, "IdleSoundsOff", 1),
- bIdleOnTerminal(MODULENAME, "IdleOnTerminalDisconnect", 0),
- bIdleStatusLock(MODULENAME, "IdleStatusLock", 0),
- bAAEnable(MODULENAME, "AAEnable", 0),
- bAAStatus(MODULENAME, "AAStatus", 0),
- iIdleTime1st(MODULENAME, "IdleTime1st", 10)
- {}
-
- CMOption<BYTE> bIdleCheck, bIdleMethod, bIdleOnSaver, bIdleOnFullScr, bIdleOnLock;
- CMOption<BYTE> bIdlePrivate, bIdleSoundsOff, bIdleOnTerminal, bIdleStatusLock;
- CMOption<BYTE> bAAEnable;
- CMOption<WORD> bAAStatus;
- CMOption<DWORD> iIdleTime1st;
-};
-
-extern Settings S;
-
-void IdleObject_Destroy();
-void IdleObject_Create();
diff --git a/src/core/stdidle/src/version.h b/src/core/stdidle/src/version.h deleted file mode 100644 index 0c72bc1c1e..0000000000 --- a/src/core/stdidle/src/version.h +++ /dev/null @@ -1,11 +0,0 @@ -#include <m_version.h>
-
-#define __FILEVERSION_STRING MIRANDA_VERSION_FILEVERSION
-#define __VERSION_STRING MIRANDA_VERSION_STRING
-
-#define __PLUGIN_NAME "Standard Idle module"
-#define __FILENAME "stdidle.dll"
-#define __DESCRIPTION "Core module for idle state processing."
-#define __AUTHOR "Miranda NG team"
-#define __AUTHORWEB "https://miranda-ng.org/p/StdIdle/"
-#define __COPYRIGHT "© 2012-18 Miranda NG team"
diff --git a/src/core/stdidle/stdidle.vcxproj b/src/core/stdidle/stdidle.vcxproj deleted file mode 100644 index 28b53db407..0000000000 --- a/src/core/stdidle/stdidle.vcxproj +++ /dev/null @@ -1,28 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?>
-<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
- <ItemGroup Label="ProjectConfigurations">
- <ProjectConfiguration Include="Debug|Win32">
- <Configuration>Debug</Configuration>
- <Platform>Win32</Platform>
- </ProjectConfiguration>
- <ProjectConfiguration Include="Debug|x64">
- <Configuration>Debug</Configuration>
- <Platform>x64</Platform>
- </ProjectConfiguration>
- <ProjectConfiguration Include="Release|Win32">
- <Configuration>Release</Configuration>
- <Platform>Win32</Platform>
- </ProjectConfiguration>
- <ProjectConfiguration Include="Release|x64">
- <Configuration>Release</Configuration>
- <Platform>x64</Platform>
- </ProjectConfiguration>
- </ItemGroup>
- <PropertyGroup Label="Globals">
- <ProjectName>StdIdle</ProjectName>
- <ProjectGuid>{36c40ba6-e0b5-438a-919c-6a991933b313}</ProjectGuid>
- </PropertyGroup>
- <ImportGroup Label="PropertySheets">
- <Import Project="$(ProjectDir)..\..\..\build\vc.common\core.props" />
- </ImportGroup>
-</Project>
\ No newline at end of file diff --git a/src/core/stdidle/stdidle.vcxproj.filters b/src/core/stdidle/stdidle.vcxproj.filters deleted file mode 100644 index e39f86d5d6..0000000000 --- a/src/core/stdidle/stdidle.vcxproj.filters +++ /dev/null @@ -1,4 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?>
-<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
- <Import Project="$(ProjectDir)..\..\..\build\vc.common\common.filters" />
-</Project>
\ No newline at end of file diff --git a/src/mir_app/src/idle.cpp b/src/mir_app/src/idle.cpp new file mode 100644 index 0000000000..bc58e6b587 --- /dev/null +++ b/src/mir_app/src/idle.cpp @@ -0,0 +1,87 @@ +/* + +Miranda NG: the free IM client for Microsoft* Windows* + +Copyright (c) 2012-18 Miranda NG team (https://miranda-ng.org), +Copyright (c) 2000-12 Miranda IM project, +all portions of this codebase are copyrighted to the people +listed in contributors.txt. + +This program is free software; you can redistribute it and/or +modify it under the terms of the GNU General Public License +as published by the Free Software Foundation; either version 2 +of the License, or (at your option) any later version. + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with this program; if not, write to the Free Software +Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +*/ + +#include "stdafx.h" + +#define MODULENAME "Idle" + +static bool bModuleInitialized = false; + +static int g_idleType; +static int g_bIsIdle; + +static HANDLE hIdleEvent; + +MIR_APP_DLL(void) Idle_Enter(int type) +{ + int flags = 0; + + if (db_get_b(0, MODULENAME, "IdlePrivate")) + flags |= IDF_PRIVACY; + + if (!g_bIsIdle && type != -1) { + g_bIsIdle = true; + g_idleType = type; + NotifyEventHooks(hIdleEvent, 0, IDF_ISIDLE | flags); + } + + if (g_bIsIdle && type == -1) { + g_bIsIdle = false; + g_idleType = 0; + NotifyEventHooks(hIdleEvent, 0, flags); + } +} + +MIR_APP_DLL(void) Idle_GetInfo(MIRANDA_IDLE_INFO &pInfo) +{ + pInfo.idleTime = db_get_dw(0, MODULENAME, "IdleTime1st"); + pInfo.privacy = db_get_b(0, MODULENAME, "IdlePrivate"); + pInfo.aaStatus = db_get_b(0, MODULENAME, "AAEnable", 1) ? db_get_w(0, MODULENAME, "AAStatus") : 0; + pInfo.aaLock = db_get_b(0, MODULENAME, "IdleStatusLock"); + pInfo.idlesoundsoff = db_get_b(0, MODULENAME, "IdleSoundsOff"); + pInfo.idleType = g_idleType; +} + +int LoadIdleModule(void) +{ + bModuleInitialized = true; + + hIdleEvent = CreateHookableEvent(ME_IDLE_CHANGED); + + g_idleType = g_bIsIdle = 0; + return 0; +} + +void UnloadIdleModule() +{ + if (!bModuleInitialized) return; + + if (g_bIsIdle) { + NotifyEventHooks(hIdleEvent, 0, 0); + g_bIsIdle = false; + } + + DestroyHookableEvent(hIdleEvent); + hIdleEvent = nullptr; +} diff --git a/src/mir_app/src/mir_app.def b/src/mir_app/src/mir_app.def index cde723cefb..eb583a156b 100644 --- a/src/mir_app/src/mir_app.def +++ b/src/mir_app/src/mir_app.def @@ -622,3 +622,5 @@ Srmm_ClickStatusIcon @649 ?LockName@MDatabaseCommon@@IAE_NPB_W@Z @651 NONAME
?UnlockName@MDatabaseCommon@@IAEXXZ @652 NONAME
Profile_CheckOpened @653
+Idle_Enter @654 NONAME
+Idle_GetInfo @655 NONAME
diff --git a/src/mir_app/src/mir_app64.def b/src/mir_app/src/mir_app64.def index 44634d5ce9..111d7ba071 100644 --- a/src/mir_app/src/mir_app64.def +++ b/src/mir_app/src/mir_app64.def @@ -622,3 +622,5 @@ Srmm_ClickStatusIcon @649 ?LockName@MDatabaseCommon@@IEAA_NPEB_W@Z @651 NONAME
?UnlockName@MDatabaseCommon@@IEAAXXZ @652 NONAME
Profile_CheckOpened @653
+Idle_Enter @654 NONAME
+Idle_GetInfo @655 NONAME
diff --git a/src/mir_app/src/miranda.h b/src/mir_app/src/miranda.h index a381d71f3d..eeee17772d 100644 --- a/src/mir_app/src/miranda.h +++ b/src/mir_app/src/miranda.h @@ -57,6 +57,11 @@ extern LIST<DATABASELINK> arDbPlugins; int InitIni(void);
void UninitIni(void);
+/**** idle.cpp *************************************************************************/
+
+int LoadIdleModule(void);
+void UnloadIdleModule(void);
+
/**** miranda.cpp **********************************************************************/
extern DWORD hMainThreadId;
diff --git a/src/mir_app/src/modules.cpp b/src/mir_app/src/modules.cpp index 600683eaa4..20ee0ef05a 100644 --- a/src/mir_app/src/modules.cpp +++ b/src/mir_app/src/modules.cpp @@ -155,12 +155,14 @@ int LoadDefaultModules(void) if (LoadFindAddModule()) return 1;
if (LoadIgnoreModule()) return 1;
if (LoadVisibilityModule()) return 1;
+ if (LoadIdleModule()) return 1;
if (LoadStdPlugins()) return 1;
return 0;
}
void UnloadDefaultModules(void)
{
+ UnloadIdleModule();
UnloadChatModule();
UnloadAccountsModule();
UnloadMetacontacts();
diff --git a/src/mir_app/src/newplugins.cpp b/src/mir_app/src/newplugins.cpp index 2be85d985e..be9af32af5 100644 --- a/src/mir_app/src/newplugins.cpp +++ b/src/mir_app/src/newplugins.cpp @@ -109,6 +109,7 @@ static const MUUID pluginBannedList[] = { 0x3750a5a3, 0xbf0d, 0x490e, { 0xb6, 0x5d, 0x41, 0xac, 0x4d, 0x29, 0xae, 0xb3 } }, // aim
{ 0x7c070f7c, 0x459e, 0x46b7, { 0x8e, 0x6d, 0xbc, 0x6e, 0xfa, 0xa2, 0x2f, 0x78 } }, // advaimg
{ 0xa0138fc6, 0x4c52, 0x4501, { 0xaf, 0x93, 0x7d, 0x3e, 0x20, 0xbc, 0xae, 0x5b } }, // dbchecker
+ { 0x53ac190b, 0xe223, 0x4341, { 0x82, 0x5f, 0x70, 0x9d, 0x85, 0x20, 0x21, 0x5b } }, // stdidle
};
static bool isPluginBanned(const MUUID &u1)
@@ -131,10 +132,9 @@ static MuuidReplacement pluginDefault[] = { MIID_SREMAIL, L"stdemail", nullptr }, // 3
{ MIID_SRFILE, L"stdfile", nullptr }, // 4
{ MIID_UIHISTORY, L"stduihist", nullptr }, // 5
- { MIID_IDLE, L"stdidle", nullptr }, // 6
- { MIID_AUTOAWAY, L"stdautoaway", nullptr }, // 7
- { MIID_USERONLINE, L"stduseronline", nullptr }, // 8
- { MIID_SRAWAY, L"stdaway", nullptr }, // 9
+ { MIID_AUTOAWAY, L"stdautoaway", nullptr }, // 6
+ { MIID_USERONLINE, L"stduseronline", nullptr }, // 7
+ { MIID_SRAWAY, L"stdaway", nullptr }, // 8
};
int getDefaultPluginIdx(const MUUID &muuid)
diff --git a/src/mir_app/src/stdafx.h b/src/mir_app/src/stdafx.h index c9b5e8fa10..1158f779fa 100644 --- a/src/mir_app/src/stdafx.h +++ b/src/mir_app/src/stdafx.h @@ -71,6 +71,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #include <m_clistint.h>
#include <m_avatars.h>
#include <m_button.h>
+#include <m_idle.h>
#include <m_protosvc.h>
#include <m_protocols.h>
#include <m_protoint.h>
diff --git a/tools/build_scripts/bin15/z2_PackPluginUpdater_x32.txt b/tools/build_scripts/bin15/z2_PackPluginUpdater_x32.txt index 0180227ea6..235ffafbb4 100644 --- a/tools/build_scripts/bin15/z2_PackPluginUpdater_x32.txt +++ b/tools/build_scripts/bin15/z2_PackPluginUpdater_x32.txt @@ -174,7 +174,6 @@ Core\stdclist.dll Core\stdcrypt.dll Core\stdemail.dll Core\stdfile.dll -Core\stdidle.dll Core\stdmsg.dll Core\stdssl.dll Core\stduihist.dll diff --git a/tools/build_scripts/bin15/z2_PackPluginUpdater_x64.txt b/tools/build_scripts/bin15/z2_PackPluginUpdater_x64.txt index 694dc091e6..064c8734f0 100644 --- a/tools/build_scripts/bin15/z2_PackPluginUpdater_x64.txt +++ b/tools/build_scripts/bin15/z2_PackPluginUpdater_x64.txt @@ -172,7 +172,6 @@ Core\stdclist.dll Core\stdcrypt.dll Core\stdemail.dll Core\stdfile.dll -Core\stdidle.dll Core\stdmsg.dll Core\stdssl.dll Core\stduihist.dll diff --git a/tools/build_scripts/bin15/z3_PackArchives.txt b/tools/build_scripts/bin15/z3_PackArchives.txt index c5255a2a2f..54b5daee33 100644 --- a/tools/build_scripts/bin15/z3_PackArchives.txt +++ b/tools/build_scripts/bin15/z3_PackArchives.txt @@ -49,7 +49,6 @@ Core\StdClist.dll Core\StdCrypt.dll Core\StdEmail.dll Core\StdFile.dll -Core\StdIdle.dll Core\StdMsg.dll Core\StdSSL.dll Core\StdUIHist.dll diff --git a/tools/build_scripts/z2_PackPluginUpdater.txt b/tools/build_scripts/z2_PackPluginUpdater.txt index 425becfbe0..b7f58c95cd 100644 --- a/tools/build_scripts/z2_PackPluginUpdater.txt +++ b/tools/build_scripts/z2_PackPluginUpdater.txt @@ -47,7 +47,6 @@ Core\StdClist.dll Core\StdCrypt.dll Core\StdEmail.dll Core\StdFile.dll -Core\StdIdle.dll Core\StdMsg.dll Core\StdSSL.dll Core\StdUIHist.dll |