From 14f435dc730cf2b242cae1cc2a2f4d4c2a65162e Mon Sep 17 00:00:00 2001 From: Kirill Volinsky Date: Sat, 30 Jun 2012 15:23:04 +0000 Subject: better logic for disabling sounds during idle git-svn-id: http://svn.miranda-ng.org/main/trunk@694 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c --- src/modules/autoaway/autoaway.cpp | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) (limited to 'src/modules/autoaway') diff --git a/src/modules/autoaway/autoaway.cpp b/src/modules/autoaway/autoaway.cpp index 46aadca316..278fff1af4 100644 --- a/src/modules/autoaway/autoaway.cpp +++ b/src/modules/autoaway/autoaway.cpp @@ -26,6 +26,13 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. void Proto_SetStatus(const char* szProto, unsigned status); +static int iBreakSounds = 0; + +static int AutoAwaySound(WPARAM, LPARAM lParam) +{ + return iBreakSounds; +} + static int AutoAwayEvent(WPARAM, LPARAM lParam) { int i; @@ -63,20 +70,15 @@ static int AutoAwayEvent(WPARAM, LPARAM lParam) if ( !mii.aaLock) Proto_SetStatus(pa->szModuleName, ID_STATUS_ONLINE); } } } - - if ((lParam&IDF_ISIDLE) && mii.idlesoundsoff && DBGetContactSettingByte(0, "Skin", "UseSound", 1)) { - BYTE oldsound = DBGetContactSettingByte(0, "Skin", "UseSound", 1); - DBWriteContactSettingByte(NULL, "Skin", "UseSound", 0); - DBWriteContactSettingByte(NULL, AA_MODULE, "OldSound", oldsound); - } - else if (!(lParam & IDF_ISIDLE) && mii.idlesoundsoff) - DBWriteContactSettingByte(NULL, "Skin", "UseSound", DBGetContactSettingByte(NULL, AA_MODULE, "OldSound", 1)); + if (mii.idlesoundsoff) + iBreakSounds = (lParam&IDF_ISIDLE) != 0; return 0; } int LoadAutoAwayModule(void) { + HookEvent(ME_SKIN_PLAYINGSOUND, AutoAwaySound); HookEvent(ME_IDLE_CHANGED, AutoAwayEvent); return 0; } -- cgit v1.2.3