From 6f2c99a32c9e539fc61edb6b836e8805b013a180 Mon Sep 17 00:00:00 2001 From: George Hazan Date: Thu, 21 Mar 2013 20:43:46 +0000 Subject: - unused constant MIRANDA_IDLE_INFO_SIZE_1 removed; - proper tracking of autoaway sound options; - code cleanup for MIRANDA_IDLE_INFO initialization; git-svn-id: http://svn.miranda-ng.org/main/trunk@4156 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c --- src/core/stdautoaway/autoaway.cpp | 13 +++++++------ src/core/stdaway/sendmsg.cpp | 3 +-- src/core/stdidle/idle.cpp | 6 ++---- 3 files changed, 10 insertions(+), 12 deletions(-) (limited to 'src/core') diff --git a/src/core/stdautoaway/autoaway.cpp b/src/core/stdautoaway/autoaway.cpp index 4e5d9e7fd8..a96c788c48 100644 --- a/src/core/stdautoaway/autoaway.cpp +++ b/src/core/stdautoaway/autoaway.cpp @@ -66,9 +66,13 @@ static void Proto_SetStatus(const char* szProto, unsigned status) static int AutoAwayEvent(WPARAM, LPARAM lParam) { - MIRANDA_IDLE_INFO mii; - mii.cbSize = sizeof(mii); + MIRANDA_IDLE_INFO mii = { sizeof(mii) }; CallService(MS_IDLE_GETIDLEINFO, 0, (LPARAM)&mii); + + if (mii.idlesoundsoff) + iBreakSounds = (lParam & IDF_ISIDLE) != 0; + + // we don't need to switch the status if (mii.aaStatus == 0) return 0; @@ -109,13 +113,10 @@ static int AutoAwayEvent(WPARAM, LPARAM lParam) } } - if (mii.idlesoundsoff) - iBreakSounds = (lParam & IDF_ISIDLE) != 0; - return 0; } -int LoadAutoAwayModule(void) +int LoadAutoAwayModule() { HookEvent(ME_SKIN_PLAYINGSOUND, AutoAwaySound); HookEvent(ME_IDLE_CHANGED, AutoAwayEvent); diff --git a/src/core/stdaway/sendmsg.cpp b/src/core/stdaway/sendmsg.cpp index ac9c01d74d..c0742aeb9a 100644 --- a/src/core/stdaway/sendmsg.cpp +++ b/src/core/stdaway/sendmsg.cpp @@ -111,8 +111,7 @@ static TCHAR* GetAwayMessage(int statusMode, char *szProto) TCHAR substituteStr[128]; if ( !_tcsnicmp(dbv.ptszVal + i, _T("%time%"), 6)) { - MIRANDA_IDLE_INFO mii = {0}; - mii.cbSize = sizeof(mii); + MIRANDA_IDLE_INFO mii = { sizeof(mii) }; CallService(MS_IDLE_GETIDLEINFO, 0, (LPARAM)&mii); if (mii.idleType == 1) { diff --git a/src/core/stdidle/idle.cpp b/src/core/stdidle/idle.cpp index fc547c8b92..3f73f6511f 100644 --- a/src/core/stdidle/idle.cpp +++ b/src/core/stdidle/idle.cpp @@ -460,7 +460,7 @@ static int IdleOptInit(WPARAM wParam, LPARAM) static INT_PTR IdleGetInfo(WPARAM, LPARAM lParam) { MIRANDA_IDLE_INFO *mii = (MIRANDA_IDLE_INFO*)lParam; - if ( !mii || (mii->cbSize != sizeof(MIRANDA_IDLE_INFO) && mii->cbSize != MIRANDA_IDLE_INFO_SIZE_1)) + if ( !mii || mii->cbSize != sizeof(MIRANDA_IDLE_INFO)) return 1; mii->idleTime = gIdleObject.minutes; @@ -468,9 +468,7 @@ static INT_PTR IdleGetInfo(WPARAM, LPARAM lParam) mii->aaStatus = gIdleObject.aastatus; mii->aaLock = gIdleObject.state&0x20; mii->idlesoundsoff = gIdleObject.aasoundsoff; - - if (mii->cbSize == sizeof(MIRANDA_IDLE_INFO)) - mii->idleType = gIdleObject.idleType; + mii->idleType = gIdleObject.idleType; return 0; } -- cgit v1.2.3