diff options
author | George Hazan <george.hazan@gmail.com> | 2013-12-23 21:52:01 +0000 |
---|---|---|
committer | George Hazan <george.hazan@gmail.com> | 2013-12-23 21:52:01 +0000 |
commit | ef592f945f28b8167b88ef8a81cadc1a5846495e (patch) | |
tree | 6f2dfa8b25557e80fd0c5b414c40403822c87ef2 /plugins/StatusPlugins/AdvancedAutoAway/advancedautoaway.cpp | |
parent | b6b397336bddfdeceb9c6b2526621f1295cacb72 (diff) |
- added fullscreen detection into AAA;
- removed bunch of old clutches from it;
- version bump
git-svn-id: http://svn.miranda-ng.org/main/trunk@7362 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'plugins/StatusPlugins/AdvancedAutoAway/advancedautoaway.cpp')
-rw-r--r-- | plugins/StatusPlugins/AdvancedAutoAway/advancedautoaway.cpp | 216 |
1 files changed, 111 insertions, 105 deletions
diff --git a/plugins/StatusPlugins/AdvancedAutoAway/advancedautoaway.cpp b/plugins/StatusPlugins/AdvancedAutoAway/advancedautoaway.cpp index b3010317c5..297ec1d37c 100644 --- a/plugins/StatusPlugins/AdvancedAutoAway/advancedautoaway.cpp +++ b/plugins/StatusPlugins/AdvancedAutoAway/advancedautoaway.cpp @@ -37,7 +37,7 @@ int CompareSettings( const TAAAProtoSetting* p1, const TAAAProtoSetting* p2 ) return lstrcmpA( p1->szName, p2->szName );
}
-OBJLIST<TAAAProtoSetting> *autoAwaySettings;
+TAAAProtoSettingList autoAwaySettings(10, CompareSettings);
TAAAProtoSetting::TAAAProtoSetting( PROTOACCOUNT* pa )
{
@@ -99,7 +99,7 @@ extern char *StatusModeToDbSetting(int status,const char *suffix); /////////////////////////////////////////////////////////////////////////////////////////
// Load from DB
-void LoadOptions( OBJLIST<TAAAProtoSetting>& loadSettings, BOOL override)
+void LoadOptions(TAAAProtoSettingList &loadSettings, BOOL override)
{
// if override is enabled, samesettings will be ignored (for options loading)
int monitorMiranda = FALSE; // use windows hooks?
@@ -138,17 +138,17 @@ void LoadOptions( OBJLIST<TAAAProtoSetting>& loadSettings, BOOL override) hAutoAwayTimer = SetTimer(NULL,0, db_get_w(NULL, MODULENAME, SETTING_AWAYCHECKTIMEINSECS, 5)*1000,AutoAwayTimer);
}
-int LoadAutoAwaySetting(TAAAProtoSetting& autoAwaySetting, char* protoName)
+int LoadAutoAwaySetting(TAAAProtoSetting &autoAwaySetting, char* protoName)
{
char setting[128];
mir_snprintf(setting, sizeof(setting), "%s_OptionFlags", protoName);
- autoAwaySetting.optionFlags = db_get_b(NULL,MODULENAME,setting,FLAG_LV2ONINACTIVE|FLAG_RESET);
+ autoAwaySetting.optionFlags = db_get_w(NULL, MODULENAME, setting, FLAG_LV2ONINACTIVE | FLAG_RESET);
mir_snprintf(setting, sizeof(setting), "%s_AwayTime", protoName);
- autoAwaySetting.awayTime = db_get_w(NULL,MODULENAME,setting,SETTING_AWAYTIME_DEFAULT);
+ autoAwaySetting.awayTime = db_get_w(NULL, MODULENAME, setting, SETTING_AWAYTIME_DEFAULT);
mir_snprintf(setting, sizeof(setting), "%s_NATime", protoName);
- autoAwaySetting.naTime = db_get_w(NULL,MODULENAME,setting,SETTING_NATIME_DEFAULT);
+ autoAwaySetting.naTime = db_get_w(NULL, MODULENAME, setting, SETTING_NATIME_DEFAULT);
mir_snprintf(setting, sizeof(setting), "%s_StatusFlags", protoName);
- autoAwaySetting.statusFlags = db_get_w(NULL,MODULENAME,setting, StatusModeToProtoFlag(ID_STATUS_ONLINE)|StatusModeToProtoFlag(ID_STATUS_FREECHAT));
+ autoAwaySetting.statusFlags = db_get_w(NULL, MODULENAME, setting, StatusModeToProtoFlag(ID_STATUS_ONLINE) | StatusModeToProtoFlag(ID_STATUS_FREECHAT));
int flags;
if (db_get_b(NULL, MODULENAME, SETTING_SAMESETTINGS, 0))
@@ -165,21 +165,22 @@ int LoadAutoAwaySetting(TAAAProtoSetting& autoAwaySetting, char* protoName) static int ProcessProtoAck(WPARAM wParam,LPARAM lParam)
{
- ACKDATA *ack = ( ACKDATA* )lParam;
- if ( ack->type != ACKTYPE_STATUS )
- return 0;
- if ( ack->result != ACKRESULT_SUCCESS )
+ ACKDATA *ack = (ACKDATA*)lParam;
+ if (ack->type != ACKTYPE_STATUS || ack->result != ACKRESULT_SUCCESS)
return 0;
+
log_debugA("ProcessProtoAck: ack->szModule: %s", ack->szModule);
- for ( int i=0; i < autoAwaySettings->getCount(); i++ ) {
- log_debugA("chk: %s", (*autoAwaySettings)[i].szName);
- if (!strcmp((*autoAwaySettings)[i].szName, ack->szModule)) {
- log_debugA("ack->szModule: %s (*autoAwaySettings)[i].statusChanged: %d", ack->szModule, (*autoAwaySettings)[i].statusChanged);
- if (!(*autoAwaySettings)[i].statusChanged)
- (*autoAwaySettings)[i].mStatus = TRUE;
-
- (*autoAwaySettings)[i].statusChanged = FALSE;
- } }
+ for (int i = 0; i < autoAwaySettings.getCount(); i++) {
+ TAAAProtoSetting &p = autoAwaySettings[i];
+ log_debugA("chk: %s", p.szName);
+ if (!strcmp(p.szName, ack->szModule)) {
+ log_debugA("ack->szModule: %s p.statusChanged: %d", ack->szModule, p.statusChanged);
+ if (!p.statusChanged)
+ p.mStatus = TRUE;
+
+ p.statusChanged = FALSE;
+ }
+ }
return 0;
}
@@ -189,16 +190,16 @@ static int ProcessProtoAck(WPARAM wParam,LPARAM lParam) int OnAccChanged(WPARAM wParam,LPARAM lParam)
{
- PROTOACCOUNT* pa = (PROTOACCOUNT*)lParam;
- switch( wParam ) {
+ PROTOACCOUNT *pa = (PROTOACCOUNT*)lParam;
+ switch (wParam) {
case PRAC_ADDED:
- autoAwaySettings->insert( new TAAAProtoSetting(pa));
+ autoAwaySettings.insert(new TAAAProtoSetting(pa));
break;
-
+
case PRAC_REMOVED:
- for (int i=0; i < autoAwaySettings->getCount(); i++) {
- if ( !lstrcmpA( (*autoAwaySettings)[i].szName, pa->szModuleName )) {
- autoAwaySettings->remove( i );
+ for (int i = 0; i < autoAwaySettings.getCount(); i++) {
+ if (!lstrcmpA(autoAwaySettings[i].szName, pa->szModuleName)) {
+ autoAwaySettings.remove(i);
break;
}
}
@@ -208,9 +209,9 @@ int OnAccChanged(WPARAM wParam,LPARAM lParam) return 0;
}
-static char* status2descr( int status )
+static char* status2descr(int status)
{
- switch( status ) {
+ switch (status) {
case ACTIVE: return "ACTIVE";
case STATUS1_SET: return "STATUS1_SET";
case STATUS2_SET: return "STATUS2_SET";
@@ -228,11 +229,11 @@ static int changeState(TAAAProtoSetting& setting, STATES newState) setting.oldState = setting.curState;
setting.curState = newState;
- log_debugA("%s state change: %s -> %s", setting.szName,
+ log_debugA("%s state change: %s -> %s", setting.szName,
status2descr(setting.oldState), status2descr(setting.curState));
NotifyEventHooks(hStateChangedEvent, 0, (LPARAM)(AUTOAWAYSETTING*)&setting);
- if ( setting.curState != SET_ORGSTATUS && setting.curState != ACTIVE && setting.statusChanged ) {
+ if (setting.curState != SET_ORGSTATUS && setting.curState != ACTIVE && setting.statusChanged) {
/* change the awaymessage */
if (setting.szMsg != NULL) {
free(setting.szMsg);
@@ -244,59 +245,62 @@ static int changeState(TAAAProtoSetting& setting, STATES newState) if (!db_get_ts(NULL, MODULENAME, StatusModeToDbSetting(setting.status, SETTING_STATUSMSG), &dbv)) {
setting.szMsg = _tcsdup(dbv.ptszVal);
db_free(&dbv);
- } }
+ }
+ }
}
else if (setting.szMsg != NULL) {
free(setting.szMsg);
setting.szMsg = NULL;
}
-
+
return 0;
}
-static VOID CALLBACK AutoAwayTimer(HWND hwnd,UINT message,UINT_PTR idEvent,DWORD dwTime)
-{
+static VOID CALLBACK AutoAwayTimer(HWND hwnd, UINT message, UINT_PTR idEvent, DWORD dwTime)
+{
int statusChanged = FALSE;
int confirm = FALSE;
- for (int i=0; i < autoAwaySettings->getCount(); i++) {
- TAAAProtoSetting& aas = (*autoAwaySettings)[i];
+ for (int i = 0; i < autoAwaySettings.getCount(); i++) {
+ TAAAProtoSetting& aas = autoAwaySettings[i];
aas.status = ID_STATUS_DISABLED;
- BOOL screenSaver = FALSE, locked = FALSE;
+ BOOL bTrigger = false;
- if ( aas.optionFlags & FLAG_MONITORMIRANDA )
- mouseStationaryTimer = (GetTickCount() - lastMirandaInput)/1000;
+ if (aas.optionFlags & FLAG_MONITORMIRANDA)
+ mouseStationaryTimer = (GetTickCount() - lastMirandaInput) / 1000;
else {
LASTINPUTINFO ii = { sizeof(ii) };
GetLastInputInfo(&ii);
- mouseStationaryTimer = (GetTickCount() - ii.dwTime)/1000;
+ mouseStationaryTimer = (GetTickCount() - ii.dwTime) / 1000;
}
int sts1Time = aas.awayTime * SECS_PER_MINUTE;
int sts2Time = aas.naTime * SECS_PER_MINUTE;
- int sts1setTime = aas.sts1setTimer==0?0:(GetTickCount() - aas.sts1setTimer)/1000;
- int currentMode = CallProtoService(aas.szName,PS_GETSTATUS,0, 0);
- if (aas.optionFlags & FLAG_ONSAVER)
- screenSaver = IsScreenSaverRunning();
+ int sts1setTime = aas.sts1setTimer == 0 ? 0 : (GetTickCount() - aas.sts1setTimer) / 1000;
+ int currentMode = CallProtoService(aas.szName, PS_GETSTATUS, 0, 0);
+ if (aas.optionFlags & FLAG_ONSAVER)
+ bTrigger |= IsScreenSaverRunning();
if (aas.optionFlags & FLAG_ONLOCK)
- locked = IsWorkstationLocked();
-
+ bTrigger |= IsWorkstationLocked();
+ if (aas.optionFlags & FLAG_FULLSCREEN)
+ bTrigger |= IsFullScreen();
+
/* check states */
if (aas.curState == ACTIVE) {
- if ((( mouseStationaryTimer >= sts1Time && (aas.optionFlags & FLAG_ONMOUSE)) || screenSaver || locked ) && currentMode != aas.lv1Status && aas.statusFlags&StatusModeToProtoFlag(currentMode)) {
+ if (((mouseStationaryTimer >= sts1Time && (aas.optionFlags & FLAG_ONMOUSE)) || bTrigger) && currentMode != aas.lv1Status && aas.statusFlags&StatusModeToProtoFlag(currentMode)) {
/* from ACTIVE to STATUS1_SET */
- aas.lastStatus = aas.originalStatusMode = CallProtoService(aas.szName,PS_GETSTATUS,0, 0);
+ aas.lastStatus = aas.originalStatusMode = CallProtoService(aas.szName, PS_GETSTATUS, 0, 0);
aas.status = aas.lv1Status;
aas.sts1setTimer = GetTickCount();
sts1setTime = 0;
aas.statusChanged = statusChanged = TRUE;
changeState(aas, STATUS1_SET);
}
- else if ( mouseStationaryTimer >= sts2Time && currentMode == aas.lv1Status && currentMode != aas.lv2Status && (aas.optionFlags & FLAG_SETNA) && (aas.statusFlags & StatusModeToProtoFlag(currentMode))) {
+ else if (mouseStationaryTimer >= sts2Time && currentMode == aas.lv1Status && currentMode != aas.lv2Status && (aas.optionFlags & FLAG_SETNA) && (aas.statusFlags & StatusModeToProtoFlag(currentMode))) {
/* from ACTIVE to STATUS2_SET */
- aas.lastStatus = aas.originalStatusMode = CallProtoService(aas.szName,PS_GETSTATUS,0, 0);
+ aas.lastStatus = aas.originalStatusMode = CallProtoService(aas.szName, PS_GETSTATUS, 0, 0);
aas.status = aas.lv2Status;
aas.statusChanged = statusChanged = TRUE;
changeState(aas, STATUS2_SET);
@@ -304,86 +308,87 @@ static VOID CALLBACK AutoAwayTimer(HWND hwnd,UINT message,UINT_PTR idEvent,DWORD }
if (aas.curState == STATUS1_SET) {
- if (( mouseStationaryTimer < sts1Time && !screenSaver && !locked ) && !(aas.optionFlags & FLAG_RESET )) {
+ if ((mouseStationaryTimer < sts1Time && !bTrigger) && !(aas.optionFlags & FLAG_RESET)) {
/* from STATUS1_SET to HIDDEN_ACTIVE */
- changeState(aas, HIDDEN_ACTIVE);
- aas.lastStatus = CallProtoService(aas.szName,PS_GETSTATUS,0, 0);
+ changeState(aas, HIDDEN_ACTIVE);
+ aas.lastStatus = CallProtoService(aas.szName, PS_GETSTATUS, 0, 0);
}
- else if ( ((mouseStationaryTimer < sts1Time) && (!screenSaver) && (!locked)) &&
- ((aas.optionFlags&FLAG_LV2ONINACTIVE) || (!(aas.optionFlags&FLAG_SETNA))) &&
- (aas.optionFlags&FLAG_RESET)) {
+ else if (((mouseStationaryTimer < sts1Time) && !bTrigger) &&
+ ((aas.optionFlags & FLAG_LV2ONINACTIVE) || (!(aas.optionFlags&FLAG_SETNA))) &&
+ (aas.optionFlags & FLAG_RESET)) {
/* from STATUS1_SET to SET_ORGSTATUS */
changeState(aas, SET_ORGSTATUS);
}
- else if (( aas.optionFlags & FLAG_SETNA) && sts1setTime >= sts2Time ) {
+ else if ((aas.optionFlags & FLAG_SETNA) && sts1setTime >= sts2Time) {
/* when set STATUS2, currentMode doesn't have to be in the selected status list (statusFlags) */
/* from STATUS1_SET to STATUS2_SET */
- aas.lastStatus = CallProtoService(aas.szName,PS_GETSTATUS,0, 0);
+ aas.lastStatus = CallProtoService(aas.szName, PS_GETSTATUS, 0, 0);
aas.status = aas.lv2Status;
aas.statusChanged = statusChanged = TRUE;
changeState(aas, STATUS2_SET);
}
}
- if ( aas.curState == STATUS2_SET ) {
- if ( mouseStationaryTimer < sts2Time && !screenSaver && !locked && ( aas.optionFlags & FLAG_RESET )) {
+ if (aas.curState == STATUS2_SET) {
+ if (mouseStationaryTimer < sts2Time && !bTrigger && (aas.optionFlags & FLAG_RESET)) {
/* from STATUS2_SET to SET_ORGSTATUS */
changeState(aas, SET_ORGSTATUS);
}
- else if ( mouseStationaryTimer < sts2Time && !screenSaver && !locked && !( aas.optionFlags & FLAG_RESET )) {
+ else if (mouseStationaryTimer < sts2Time && !bTrigger && !(aas.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(aas, HIDDEN_ACTIVE);
- aas.lastStatus = CallProtoService(aas.szName,PS_GETSTATUS,0, 0);
+ aas.lastStatus = CallProtoService(aas.szName, PS_GETSTATUS, 0, 0);
}
}
- if ( aas.curState == HIDDEN_ACTIVE ) {
- if ( aas.mStatus ) {
+ if (aas.curState == HIDDEN_ACTIVE) {
+ if (aas.mStatus) {
/* HIDDEN_ACTIVE to ACTIVE */
//aas.statusChanged = FALSE;
changeState(aas, ACTIVE);
aas.sts1setTimer = 0;
aas.mStatus = FALSE;
}
- else if (( aas.optionFlags & FLAG_SETNA ) && currentMode == aas.lv1Status &&
+ else if ((aas.optionFlags & FLAG_SETNA) && currentMode == aas.lv1Status &&
currentMode != aas.lv2Status && (aas.statusFlags & StatusModeToProtoFlag(currentMode)) &&
- (mouseStationaryTimer >= sts2Time || (sts1setTime >= sts2Time && !(aas.optionFlags & FLAG_LV2ONINACTIVE )))) {
+ (mouseStationaryTimer >= sts2Time || (sts1setTime >= sts2Time && !(aas.optionFlags & FLAG_LV2ONINACTIVE)))) {
/* HIDDEN_ACTIVE to STATUS2_SET */
- aas.lastStatus = aas.originalStatusMode = CallProtoService(aas.szName,PS_GETSTATUS,0, 0);
+ aas.lastStatus = aas.originalStatusMode = CallProtoService(aas.szName, PS_GETSTATUS, 0, 0);
aas.status = aas.lv2Status;
aas.statusChanged = statusChanged = TRUE;
changeState(aas, STATUS2_SET);
}
}
- if ( aas.curState == SET_ORGSTATUS ) {
+ if (aas.curState == SET_ORGSTATUS) {
/* SET_ORGSTATUS to ACTIVE */
- aas.lastStatus = CallProtoService(aas.szName,PS_GETSTATUS,0, 0);
+ aas.lastStatus = CallProtoService(aas.szName, PS_GETSTATUS, 0, 0);
aas.status = aas.originalStatusMode;
- confirm = (aas.optionFlags&FLAG_CONFIRM)?TRUE:confirm;
+ confirm = (aas.optionFlags&FLAG_CONFIRM) ? TRUE : confirm;
aas.statusChanged = statusChanged = TRUE;
changeState(aas, ACTIVE);
aas.sts1setTimer = 0;
}
- (*autoAwaySettings)[i].mStatus = FALSE;
+ autoAwaySettings[i].mStatus = FALSE;
}
- if ( confirm || statusChanged ) {
- OBJLIST<TAAAProtoSetting> ps = *autoAwaySettings;
- for (int i=0; i < ps.getCount(); i++) {
+ if (confirm || statusChanged) {
+ TAAAProtoSettingList ps = autoAwaySettings;
+ for (int i = 0; i < ps.getCount(); i++) {
if (ps[i].szMsg)
ps[i].szMsg = _tcsdup(ps[i].szMsg);
if (ps[i].status == ID_STATUS_DISABLED)
ps[i].szName = "";
}
-
+
if (confirm)
confirmDialog = (HWND)CallService(MS_CS_SHOWCONFIRMDLGEX, (WPARAM)&ps, db_get_w(NULL, MODULENAME, SETTING_CONFIRMDELAY, 5));
else if (statusChanged)
CallService(MS_CS_SETSTATUSEX, (WPARAM)&ps, 0);
-} }
-
+ }
+}
+
/////////////////////////////////////////////////////////////////////////////////////////
// Windows hooks
@@ -391,9 +396,9 @@ static int HookWindowsHooks(int hookMiranda, int hookAll) {
if (hookMiranda) {
if (monitorKeyboard && hMirandaKeyBoardHook == NULL)
- hMirandaKeyBoardHook = SetWindowsHookEx(WH_KEYBOARD,MirandaKeyBoardHookFunction,NULL,GetCurrentThreadId());
+ hMirandaKeyBoardHook = SetWindowsHookEx(WH_KEYBOARD, MirandaKeyBoardHookFunction, NULL, GetCurrentThreadId());
if (monitorMouse && hMirandaMouseHook == NULL)
- hMirandaMouseHook = SetWindowsHookEx(WH_MOUSE,MirandaMouseHookFunction,NULL,GetCurrentThreadId());
+ hMirandaMouseHook = SetWindowsHookEx(WH_MOUSE, MirandaMouseHookFunction, NULL, GetCurrentThreadId());
}
if (hookAll) {
if (monitorKeyboard && hKeyBoardHook == NULL)
@@ -421,19 +426,19 @@ static LRESULT CALLBACK MirandaMouseHookFunction(int code, WPARAM wParam, LPARAM if (code >= 0) {
PMOUSEHOOKSTRUCT mouseInfo = (PMOUSEHOOKSTRUCT)lParam;
POINT pt = mouseInfo->pt;
-
+
/* TioDuke's KeyBoardNotifyExt: only update if a Miranda window is focused */
DWORD pid;
GetWindowThreadProcessId(GetForegroundWindow(), &pid);
if (pid != GetCurrentProcessId())
return CallNextHookEx(hMirandaMouseHook, code, wParam, lParam);
- if (pt.x!=lastMousePos.x || pt.y!=lastMousePos.y) {
+ if (pt.x != lastMousePos.x || pt.y != lastMousePos.y) {
lastMousePos = pt;
- lastMirandaInput = GetTickCount();
+ lastMirandaInput = GetTickCount();
}
}
-
+
return CallNextHookEx(hMirandaMouseHook, code, wParam, lParam);
}
@@ -442,12 +447,12 @@ static LRESULT CALLBACK MirandaKeyBoardHookFunction(int code, WPARAM wParam, LPA if (code >= 0) {
if (ignoreAltCombo) {
if (((GetKeyState(VK_MENU) < 0) || (wParam == VK_MENU)) ||
- ((GetKeyState(VK_TAB) < 0) || (wParam == VK_TAB)) ||
- ((GetKeyState(VK_SHIFT) < 0) || (wParam == VK_SHIFT)) ||
- ((GetKeyState(VK_CONTROL) < 0) || (wParam == VK_CONTROL)) ||
- ((GetKeyState(VK_ESCAPE) < 0) || (wParam == VK_ESCAPE)) ||
- ((GetKeyState(VK_LWIN) < 0) || (wParam == VK_LWIN)) ||
- ((GetKeyState(VK_RWIN) < 0) || (wParam == VK_RWIN)))
+ ((GetKeyState(VK_TAB) < 0) || (wParam == VK_TAB)) ||
+ ((GetKeyState(VK_SHIFT) < 0) || (wParam == VK_SHIFT)) ||
+ ((GetKeyState(VK_CONTROL) < 0) || (wParam == VK_CONTROL)) ||
+ ((GetKeyState(VK_ESCAPE) < 0) || (wParam == VK_ESCAPE)) ||
+ ((GetKeyState(VK_LWIN) < 0) || (wParam == VK_LWIN)) ||
+ ((GetKeyState(VK_RWIN) < 0) || (wParam == VK_RWIN)))
{
return CallNextHookEx(hMirandaKeyBoardHook, code, wParam, lParam);
}
@@ -477,7 +482,7 @@ static LRESULT CALLBACK MirandaKeyBoardHookFunction(int code, WPARAM wParam, LPA break;
}
}
-
+
return CallNextHookEx(hMirandaKeyBoardHook, code, wParam, lParam);
}
@@ -491,11 +496,12 @@ static LRESULT CALLBACK MouseHookFunction(int code, WPARAM wParam, LPARAM lParam if ((wParam >= WM_NCLBUTTONDOWN && wParam <= WM_NCXBUTTONDBLCLK && wParam != 0x00AA) || (wParam >= WM_LBUTTONDOWN && wParam <= WM_XBUTTONDBLCLK))
lastInput = GetTickCount();
- if (pt.x!=lastMousePos.x || pt.y!=lastMousePos.y) {
+ if (pt.x != lastMousePos.x || pt.y != lastMousePos.y) {
lastMousePos = pt;
- lastInput = GetTickCount();
- } }
-
+ lastInput = GetTickCount();
+ }
+ }
+
return CallNextHookEx(hMouseHook, code, wParam, lParam);
}
@@ -503,7 +509,7 @@ static LRESULT CALLBACK KeyBoardHookFunction(int code, WPARAM wParam, LPARAM lPa {
if (code >= 0) {
if (ignoreAltCombo) {
- if ( ((GetKeyState(VK_MENU) < 0) || (wParam == VK_MENU)) ||
+ if (((GetKeyState(VK_MENU) < 0) || (wParam == VK_MENU)) ||
((GetKeyState(VK_TAB) < 0) || (wParam == VK_TAB)) ||
((GetKeyState(VK_SHIFT) < 0) || (wParam == VK_SHIFT)) ||
((GetKeyState(VK_CONTROL) < 0) || (wParam == VK_CONTROL)) ||
@@ -539,14 +545,14 @@ static LRESULT CALLBACK KeyBoardHookFunction(int code, WPARAM wParam, LPARAM lPa break;
}
}
-
+
return CallNextHookEx(hKeyBoardHook, code, wParam, lParam);
}
/////////////////////////////////////////////////////////////////////////////////////////
// Inits & stuff
-static int AutoAwayShutdown(WPARAM wParam,LPARAM lParam)
+static int AutoAwayShutdown(WPARAM wParam, LPARAM lParam)
{
KillTimer(NULL, hAutoAwayTimer);
@@ -555,8 +561,8 @@ static int AutoAwayShutdown(WPARAM wParam,LPARAM lParam) #endif
UnhookWindowsHooks();
DestroyHookableEvent(hStateChangedEvent);
-
- autoAwaySettings->destroy();
+
+ autoAwaySettings.destroy();
return 0;
}
@@ -571,18 +577,18 @@ int CSModuleLoaded(WPARAM wParam, LPARAM lParam) ////////////////////////////////////////////////////////////////////////////////////////
- protoList = ( OBJLIST<PROTOCOLSETTINGEX>* )autoAwaySettings;
+ protoList = (OBJLIST<PROTOCOLSETTINGEX>*)&autoAwaySettings;
int count;
PROTOACCOUNT** protos;
ProtoEnumAccounts(&count, &protos);
- for ( int i=0; i < count; i++ )
- if ( IsSuitableProto( protos[i] ))
- autoAwaySettings->insert( new TAAAProtoSetting( protos[i] ));
+ for (int i = 0; i < count; i++)
+ if (IsSuitableProto(protos[i]))
+ autoAwaySettings.insert(new TAAAProtoSetting(protos[i]));
////////////////////////////////////////////////////////////////////////////////////////
- LoadOptions(*autoAwaySettings, FALSE);
+ LoadOptions(autoAwaySettings, FALSE);
return 0;
}
|