# HG changeset patch # User Sean Egan # Date 1178178207 0 # Node ID 3205cc84ce54e5e33d66af9ab5be810ce2ccea97 # Parent 53448dd9f4488f2f5cd84d233df0bba7668ee473 Don't play the same sound twice within 2 seconds. Maybe this will fix Luke's gst problems. It fixes #140 in either case diff -r 53448dd9f448 -r 3205cc84ce54 libpurple/sound.c --- 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