diff src/sound.c @ 11642:58bc500cf226

[gaim-migrate @ 13919] sf patch #1324285, from Casey Harkins fix "sounds while away" in HEAD This patch adds a GaimAccount as a parameter to the sound playing functions, allowing the caller to specify the account the sound is related to. If the account is not NULL and the while_away preference is not set, then the account is checked to see if it is away, if so, the sound is not played. committer: Tailor Script <tailor@pidgin.im>
author Mark Doliner <mark@kingant.net>
date Wed, 12 Oct 2005 02:27:32 +0000
parents 8d0ac3c37831
children a66ee70c614c
line wrap: on
line diff
--- a/src/sound.c	Tue Oct 11 16:20:29 2005 +0000
+++ b/src/sound.c	Wed Oct 12 02:27:32 2005 +0000
@@ -29,26 +29,32 @@
 static GaimSoundUiOps *sound_ui_ops = NULL;
 
 void
-gaim_sound_play_file(const char *filename)
+gaim_sound_play_file(const char *filename, const GaimAccount *account)
 {
-	/* FIXME */
-#if 0
-	if(awaymessage && !gaim_prefs_get_bool("/core/sound/while_away"))
-		return;
-#endif
+	GaimStatus *status;
+
+	if ((account != NULL) && (!gaim_prefs_get_bool("/core/sounds/while_away")))
+	{
+		status = gaim_account_get_active_status(account);
+		if (gaim_status_is_online(status) && !gaim_status_is_available(status))
+			return;
+	}
 
 	if(sound_ui_ops && sound_ui_ops->play_file)
 		sound_ui_ops->play_file(filename);
 }
 
 void
-gaim_sound_play_event(GaimSoundEventID event)
+gaim_sound_play_event(GaimSoundEventID event, const GaimAccount *account)
 {
-	/* FIXME */
-#if 0
-	if(awaymessage && !gaim_prefs_get_bool("/core/sound/while_away"))
-		return;
-#endif
+	GaimStatus *status;
+
+	if ((account != NULL) && (!gaim_prefs_get_bool("/core/sounds/while_away")))
+	{
+		status = gaim_account_get_active_status(account);
+		if (gaim_status_is_online(status) && !gaim_status_is_available(status))
+			return;
+	}
 
 	if(sound_ui_ops && sound_ui_ops->play_event)
 		sound_ui_ops->play_event(event);