diff options
author | George Hazan <ghazan@miranda.im> | 2018-06-19 11:36:24 +0300 |
---|---|---|
committer | George Hazan <ghazan@miranda.im> | 2018-06-19 11:36:33 +0300 |
commit | aef4307d04fb8d8bbc05921d45d97a63e627fb4d (patch) | |
tree | 1647384407dcf778c7870eefa5209da9bec21ea2 /plugins/StatusManager/src | |
parent | 407b2e8d2e0161ef149bb44836f9692b3291e6c9 (diff) |
AAA:
- solved conflict with dead StdIdle, zihrono levraha;
- better idle mode detection
- version bump
Diffstat (limited to 'plugins/StatusManager/src')
-rw-r--r-- | plugins/StatusManager/src/AdvancedAutoAway/aaa_options.cpp | 5 | ||||
-rw-r--r-- | plugins/StatusManager/src/AdvancedAutoAway/advancedautoaway.cpp | 33 | ||||
-rw-r--r-- | plugins/StatusManager/src/resource.h | 1 | ||||
-rw-r--r-- | plugins/StatusManager/src/version.h | 2 |
4 files changed, 20 insertions, 21 deletions
diff --git a/plugins/StatusManager/src/AdvancedAutoAway/aaa_options.cpp b/plugins/StatusManager/src/AdvancedAutoAway/aaa_options.cpp index eb91254af3..2176847926 100644 --- a/plugins/StatusManager/src/AdvancedAutoAway/aaa_options.cpp +++ b/plugins/StatusManager/src/AdvancedAutoAway/aaa_options.cpp @@ -386,11 +386,6 @@ static INT_PTR CALLBACK DlgProcAutoAwayGeneralOpts(HWND hwndDlg, UINT msg, WPARA SetDlgItemInt(hwndDlg, IDC_AWAYCHECKTIMEINSECS, db_get_w(0, AAAMODULENAME, SETTING_AWAYCHECKTIMEINSECS, 5), FALSE); SetDlgItemInt(hwndDlg, IDC_CONFIRMDELAY, db_get_w(0, AAAMODULENAME, SETTING_CONFIRMDELAY, 5), FALSE); CheckDlgButton(hwndDlg, bSettingSame ? IDC_SAMESETTINGS : IDC_PERPROTOCOLSETTINGS, BST_CHECKED); - ShowWindow(GetDlgItem(hwndDlg, IDC_IDLEWARNING), db_get_b(0, "Idle", "AAEnable", 0)); - break; - - case WM_SHOWWINDOW: - ShowWindow(GetDlgItem(hwndDlg, IDC_IDLEWARNING), (db_get_b(0, "Idle", "AAEnable", 0))); break; case WM_COMMAND: diff --git a/plugins/StatusManager/src/AdvancedAutoAway/advancedautoaway.cpp b/plugins/StatusManager/src/AdvancedAutoAway/advancedautoaway.cpp index 270375e94c..7981175e5f 100644 --- a/plugins/StatusManager/src/AdvancedAutoAway/advancedautoaway.cpp +++ b/plugins/StatusManager/src/AdvancedAutoAway/advancedautoaway.cpp @@ -105,9 +105,6 @@ void AAALoadOptions() monitorAll = TRUE; } - if (db_get_b(0, "Idle", "AAEnable", 0)) - return; - HookWindowsHooks(monitorMiranda, monitorAll); hAutoAwayTimer = SetTimer(nullptr, 0, db_get_w(0, AAAMODULENAME, SETTING_AWAYCHECKTIMEINSECS, 5) * 1000, AutoAwayTimer); } @@ -208,6 +205,23 @@ static int changeState(SMProto &setting, int mode, STATES newState) return 0; } +static int getIdleMode(int options) +{ + if ((options & FLAG_ONSAVER) && IsScreenSaverRunning()) + return 1; + + if ((options & FLAG_ONLOCK) && IsWorkstationLocked()) + return 2; + + if ((options & FLAG_ONTS) && IsTerminalDisconnected()) + return 3; + + if ((options & FLAG_FULLSCREEN) && IsFullScreen()) + return 4; + + return 0; +} + static VOID CALLBACK AutoAwayTimer(HWND, UINT, UINT_PTR, DWORD) { int statusChanged = FALSE; @@ -216,8 +230,6 @@ static VOID CALLBACK AutoAwayTimer(HWND, UINT, UINT_PTR, DWORD) for (auto &it : protoList) { it->aaaStatus = ID_STATUS_DISABLED; - int mode = 0; - if (it->optionFlags & FLAG_MONITORMIRANDA) mouseStationaryTimer = (GetTickCount() - lastMirandaInput) / 1000; else { @@ -231,18 +243,11 @@ static VOID CALLBACK AutoAwayTimer(HWND, UINT, UINT_PTR, DWORD) int sts1setTime = it->sts1setTimer == 0 ? 0 : (GetTickCount() - it->sts1setTimer) / 1000; int currentMode = Proto_GetStatus(it->m_szName); - if (it->optionFlags & FLAG_ONSAVER) - 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; + int mode = getIdleMode(it->optionFlags); /* check states */ if (it->curState == ACTIVE) { - if (((mouseStationaryTimer >= sts1Time && (it->optionFlags & FLAG_ONMOUSE)) || mode) && 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; diff --git a/plugins/StatusManager/src/resource.h b/plugins/StatusManager/src/resource.h index b507e0c632..fba9f37f18 100644 --- a/plugins/StatusManager/src/resource.h +++ b/plugins/StatusManager/src/resource.h @@ -99,7 +99,6 @@ #define IDC_PROTOLIST 1079 #define IDC_ENABLECHECKING 1080 #define IDC_DISABLECHECKING 1081 -#define IDC_IDLEWARNING 1084 #define IDC_DESCRIPTION 1085 #define IDC_CONTCHECK 1087 #define IDC_BYPING 1088 diff --git a/plugins/StatusManager/src/version.h b/plugins/StatusManager/src/version.h index 307a57bb4a..d1ad4fa6a4 100644 --- a/plugins/StatusManager/src/version.h +++ b/plugins/StatusManager/src/version.h @@ -2,7 +2,7 @@ #define __MAJOR_VERSION 1 #define __MINOR_VERSION 2 #define __RELEASE_NUM 0 -#define __BUILD_NUM 2 +#define __BUILD_NUM 3 // other stuff for Version resource #include <stdver.h> |