diff options
| author | dartraiden <wowemuh@gmail.com> | 2023-01-02 21:10:29 +0300 |
|---|---|---|
| committer | dartraiden <wowemuh@gmail.com> | 2023-01-02 21:10:29 +0300 |
| commit | 1979fd80424d16b2e489f9b57d01d9c7811d25a2 (patch) | |
| tree | 960d42c5fe4a51f0fe2850bea91256e226bce221 /src/core/stdautoaway | |
| parent | adfbbb217d4f4a05acf198755f219a5223d31c27 (diff) | |
Update copyrights
Diffstat (limited to 'src/core/stdautoaway')
| -rw-r--r-- | src/core/stdautoaway/src/autoaway.cpp | 2 | ||||
| -rw-r--r-- | src/core/stdautoaway/src/idle.cpp | 178 | ||||
| -rw-r--r-- | src/core/stdautoaway/src/main.cpp | 2 | ||||
| -rw-r--r-- | src/core/stdautoaway/src/options.cpp | 268 | ||||
| -rw-r--r-- | src/core/stdautoaway/src/stdafx.h | 2 | ||||
| -rw-r--r-- | src/core/stdautoaway/src/version.h | 2 |
6 files changed, 227 insertions, 227 deletions
diff --git a/src/core/stdautoaway/src/autoaway.cpp b/src/core/stdautoaway/src/autoaway.cpp index f9a7fa8379..024487ed5a 100644 --- a/src/core/stdautoaway/src/autoaway.cpp +++ b/src/core/stdautoaway/src/autoaway.cpp @@ -2,7 +2,7 @@ Miranda NG: the free IM client for Microsoft* Windows*
-Copyright (C) 2012-22 Miranda NG team (https://miranda-ng.org),
+Copyright (C) 2012-23 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.
diff --git a/src/core/stdautoaway/src/idle.cpp b/src/core/stdautoaway/src/idle.cpp index aaabe0ddb2..b4faa31c4b 100644 --- a/src/core/stdautoaway/src/idle.cpp +++ b/src/core/stdautoaway/src/idle.cpp @@ -1,89 +1,89 @@ -/* - -Miranda NG: the free IM client for Microsoft* Windows* - -Copyright (C) 2012-22 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) { - uint32_t dwTick = Miranda_GetIdle(); - 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) - return; - - 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); - - else // not idle - Idle_Enter(-1); -} - -void IdleObject_Create() -{ - g_hTimer = SetTimer(nullptr, 0, 2000, IdleTimer); -} - -void IdleObject_Destroy() -{ - KillTimer(nullptr, g_hTimer); -} - -void LoadIdleModule(void) -{ - IdleObject_Create(); - - HookEvent(ME_OPT_INITIALISE, IdleOptInit); -} - -void UnloadIdleModule() -{ - IdleObject_Destroy(); -} +/*
+
+Miranda NG: the free IM client for Microsoft* Windows*
+
+Copyright (C) 2012-23 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) {
+ uint32_t dwTick = Miranda_GetIdle();
+ 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)
+ return;
+
+ 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);
+
+ else // not idle
+ Idle_Enter(-1);
+}
+
+void IdleObject_Create()
+{
+ g_hTimer = SetTimer(nullptr, 0, 2000, IdleTimer);
+}
+
+void IdleObject_Destroy()
+{
+ KillTimer(nullptr, g_hTimer);
+}
+
+void LoadIdleModule(void)
+{
+ IdleObject_Create();
+
+ HookEvent(ME_OPT_INITIALISE, IdleOptInit);
+}
+
+void UnloadIdleModule()
+{
+ IdleObject_Destroy();
+}
diff --git a/src/core/stdautoaway/src/main.cpp b/src/core/stdautoaway/src/main.cpp index 971fd166ff..1022f2a4d5 100644 --- a/src/core/stdautoaway/src/main.cpp +++ b/src/core/stdautoaway/src/main.cpp @@ -2,7 +2,7 @@ Standard auto away module for Miranda NG
-Copyright (C) 2012-22 Miranda NG team (https://miranda-ng.org)
+Copyright (C) 2012-23 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
diff --git a/src/core/stdautoaway/src/options.cpp b/src/core/stdautoaway/src/options.cpp index 17a8f8381b..fed12a11f8 100644 --- a/src/core/stdautoaway/src/options.cpp +++ b/src/core/stdautoaway/src/options.cpp @@ -1,134 +1,134 @@ -/* - -Miranda NG: the free IM client for Microsoft* Windows* - -Copyright (C) 2012-22 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 const uint16_t aa_Status[] = { ID_STATUS_AWAY, ID_STATUS_NA, ID_STATUS_OCCUPIED, ID_STATUS_DND }; - -int IdleGetStatusIndex(uint16_t status) -{ - for (int j = 0; j < _countof(aa_Status); j++) - if (aa_Status[j] == status) - return j; - - return 0; -} - -class COptionsDlg : public CDlgBase -{ - CCtrlEdit edt1sttime; - CCtrlSpin spinIdle; - CCtrlCombo cmbAAStatus; - CCtrlCheck chkShort, chkOnWindows, chkOnMiranda, chkScreenSaver, chkFullScreen, chkLocked; - CCtrlCheck chkPrivate, chkStatusLock, chkTerminal, chkSoundsOff, chkShortIdle; - - void ShowHide() - { - BOOL bChecked = chkShort.GetState(); - chkOnWindows.Enable(bChecked); - chkOnMiranda.Enable(bChecked); - edt1sttime.Enable(bChecked); - - bChecked = chkShortIdle.GetState(); - cmbAAStatus.Enable(bChecked); - chkStatusLock.Enable(bChecked); - } - -public: - COptionsDlg() : - CDlgBase(g_plugin, IDD_OPT_IDLE), - edt1sttime(this, IDC_IDLE1STTIME), - spinIdle(this, IDC_IDLESPIN, 60, 1), - cmbAAStatus(this, IDC_AASTATUS), - chkShort(this, IDC_IDLESHORT), - chkLocked(this, IDC_LOCKED), - chkPrivate(this, IDC_IDLEPRIVATE), - chkTerminal(this, IDC_IDLETERMINAL), - chkOnWindows(this, IDC_IDLEONWINDOWS), - chkSoundsOff(this, IDC_IDLESOUNDSOFF), - chkOnMiranda(this, IDC_IDLEONMIRANDA), - chkShortIdle(this, IDC_AASHORTIDLE), - chkStatusLock(this, IDC_IDLESTATUSLOCK), - chkFullScreen(this, IDC_FULLSCREEN), - chkScreenSaver(this, IDC_SCREENSAVER) - { - 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); - } - - bool OnInitDialog() override - { - chkOnWindows.SetState(!g_plugin.bIdleMethod); - - spinIdle.SetPosition(g_plugin.iIdleTime1st); - - for (auto &it : aa_Status) - cmbAAStatus.AddString(Clist_GetStatusModeDescription(it, 0)); - cmbAAStatus.SetCurSel(IdleGetStatusIndex(g_plugin.bAAStatus)); - - ShowHide(); - return true; - } - - bool OnApply() override - { - g_plugin.iIdleTime1st = spinIdle.GetPosition(); - - int curSel = cmbAAStatus.GetCurSel(); - if (curSel != CB_ERR) - g_plugin.bAAStatus = aa_Status[curSel]; - - // destroy any current idle and reset settings. - IdleObject_Destroy(); - IdleObject_Create(); - return true; - } - - void onChange(CCtrlCheck*) - { - ShowHide(); - } -}; - -int IdleOptInit(WPARAM wParam, LPARAM) -{ - OPTIONSDIALOGPAGE odp = {}; - odp.position = 100000000; - odp.szGroup.a = LPGEN("Status"); - odp.szTitle.a = LPGEN("Idle"); - odp.flags = ODPF_BOLDGROUPS; - odp.pDialog = new COptionsDlg(); - g_plugin.addOptions(wParam, &odp); - return 0; -} +/*
+
+Miranda NG: the free IM client for Microsoft* Windows*
+
+Copyright (C) 2012-23 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 const uint16_t aa_Status[] = { ID_STATUS_AWAY, ID_STATUS_NA, ID_STATUS_OCCUPIED, ID_STATUS_DND };
+
+int IdleGetStatusIndex(uint16_t status)
+{
+ for (int j = 0; j < _countof(aa_Status); j++)
+ if (aa_Status[j] == status)
+ return j;
+
+ return 0;
+}
+
+class COptionsDlg : public CDlgBase
+{
+ CCtrlEdit edt1sttime;
+ CCtrlSpin spinIdle;
+ CCtrlCombo cmbAAStatus;
+ CCtrlCheck chkShort, chkOnWindows, chkOnMiranda, chkScreenSaver, chkFullScreen, chkLocked;
+ CCtrlCheck chkPrivate, chkStatusLock, chkTerminal, chkSoundsOff, chkShortIdle;
+
+ void ShowHide()
+ {
+ BOOL bChecked = chkShort.GetState();
+ chkOnWindows.Enable(bChecked);
+ chkOnMiranda.Enable(bChecked);
+ edt1sttime.Enable(bChecked);
+
+ bChecked = chkShortIdle.GetState();
+ cmbAAStatus.Enable(bChecked);
+ chkStatusLock.Enable(bChecked);
+ }
+
+public:
+ COptionsDlg() :
+ CDlgBase(g_plugin, IDD_OPT_IDLE),
+ edt1sttime(this, IDC_IDLE1STTIME),
+ spinIdle(this, IDC_IDLESPIN, 60, 1),
+ cmbAAStatus(this, IDC_AASTATUS),
+ chkShort(this, IDC_IDLESHORT),
+ chkLocked(this, IDC_LOCKED),
+ chkPrivate(this, IDC_IDLEPRIVATE),
+ chkTerminal(this, IDC_IDLETERMINAL),
+ chkOnWindows(this, IDC_IDLEONWINDOWS),
+ chkSoundsOff(this, IDC_IDLESOUNDSOFF),
+ chkOnMiranda(this, IDC_IDLEONMIRANDA),
+ chkShortIdle(this, IDC_AASHORTIDLE),
+ chkStatusLock(this, IDC_IDLESTATUSLOCK),
+ chkFullScreen(this, IDC_FULLSCREEN),
+ chkScreenSaver(this, IDC_SCREENSAVER)
+ {
+ 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);
+ }
+
+ bool OnInitDialog() override
+ {
+ chkOnWindows.SetState(!g_plugin.bIdleMethod);
+
+ spinIdle.SetPosition(g_plugin.iIdleTime1st);
+
+ for (auto &it : aa_Status)
+ cmbAAStatus.AddString(Clist_GetStatusModeDescription(it, 0));
+ cmbAAStatus.SetCurSel(IdleGetStatusIndex(g_plugin.bAAStatus));
+
+ ShowHide();
+ return true;
+ }
+
+ bool OnApply() override
+ {
+ g_plugin.iIdleTime1st = spinIdle.GetPosition();
+
+ int curSel = cmbAAStatus.GetCurSel();
+ if (curSel != CB_ERR)
+ g_plugin.bAAStatus = aa_Status[curSel];
+
+ // destroy any current idle and reset settings.
+ IdleObject_Destroy();
+ IdleObject_Create();
+ return true;
+ }
+
+ void onChange(CCtrlCheck*)
+ {
+ ShowHide();
+ }
+};
+
+int IdleOptInit(WPARAM wParam, LPARAM)
+{
+ OPTIONSDIALOGPAGE odp = {};
+ odp.position = 100000000;
+ odp.szGroup.a = LPGEN("Status");
+ odp.szTitle.a = LPGEN("Idle");
+ odp.flags = ODPF_BOLDGROUPS;
+ odp.pDialog = new COptionsDlg();
+ g_plugin.addOptions(wParam, &odp);
+ return 0;
+}
diff --git a/src/core/stdautoaway/src/stdafx.h b/src/core/stdautoaway/src/stdafx.h index be6446162a..aed3748da5 100644 --- a/src/core/stdautoaway/src/stdafx.h +++ b/src/core/stdautoaway/src/stdafx.h @@ -2,7 +2,7 @@ Miranda NG: the free IM client for Microsoft* Windows*
-Copyright (C) 2012-22 Miranda NG team (https://miranda-ng.org),
+Copyright (C) 2012-23 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.
diff --git a/src/core/stdautoaway/src/version.h b/src/core/stdautoaway/src/version.h index 50fcd17758..e85f99715c 100644 --- a/src/core/stdautoaway/src/version.h +++ b/src/core/stdautoaway/src/version.h @@ -8,4 +8,4 @@ #define __DESCRIPTION "Core module for away state processing."
#define __AUTHOR "Miranda NG team"
#define __AUTHORWEB "https://miranda-ng.org/p/StdAutoAway"
-#define __COPYRIGHT "© 2012-22 Miranda NG team"
+#define __COPYRIGHT "© 2012-23 Miranda NG team"
|
