Mercurial > pidgin.yaz
changeset 16813:3205cc84ce54
Don't play the same sound twice within 2 seconds. Maybe this will fix Luke's gst problems. It fixes #140 in either case
author | Sean Egan <seanegan@gmail.com> |
---|---|
date | Thu, 03 May 2007 07:43:27 +0000 |
parents | 53448dd9f448 |
children | 9410f6c2c542 |
files | libpurple/sound.c |
diffstat | 1 files changed, 7 insertions(+), 0 deletions(-) [+] |
line wrap: on
line diff
--- a/libpurple/sound.c Thu May 03 06:47:51 2007 +0000 +++ b/libpurple/sound.c Thu May 03 07:43:27 2007 +0000 @@ -31,6 +31,8 @@ #define STATUS_AVAILABLE 1 #define STATUS_AWAY 2 +static time_t last_played[PURPLE_NUM_SOUNDS]; + static gboolean purple_sound_play_required(const PurpleAccount *account) { @@ -77,6 +79,10 @@ if (!purple_sound_play_required(account)) return; + if (time(NULL) - last_played[event] < 2) + return; + last_played[event] = time(NULL); + if(sound_ui_ops && sound_ui_ops->play_event) { int plugin_return; @@ -127,6 +133,7 @@ purple_prefs_add_none("/purple/sound"); purple_prefs_add_int("/purple/sound/while_status", STATUS_AVAILABLE); + memset(last_played, 0, sizeof(last_played)); } void