summaryrefslogtreecommitdiff
path: root/src/modules/autoaway
diff options
context:
space:
mode:
authorKirill Volinsky <mataes2007@gmail.com>2012-06-30 15:23:04 +0000
committerKirill Volinsky <mataes2007@gmail.com>2012-06-30 15:23:04 +0000
commit14f435dc730cf2b242cae1cc2a2f4d4c2a65162e (patch)
tree0fa384d3861099a8c0849b8e897c5e07c700d88d /src/modules/autoaway
parentcc71add32b4b47e49c39f13905f86e08b88d5281 (diff)
better logic for disabling sounds during idle
git-svn-id: http://svn.miranda-ng.org/main/trunk@694 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'src/modules/autoaway')
-rw-r--r--src/modules/autoaway/autoaway.cpp18
1 files changed, 10 insertions, 8 deletions
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;
}