comparison 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
comparison
equal deleted inserted replaced
11641:925c1960af34 11642:58bc500cf226
27 #include "sound.h" 27 #include "sound.h"
28 28
29 static GaimSoundUiOps *sound_ui_ops = NULL; 29 static GaimSoundUiOps *sound_ui_ops = NULL;
30 30
31 void 31 void
32 gaim_sound_play_file(const char *filename) 32 gaim_sound_play_file(const char *filename, const GaimAccount *account)
33 { 33 {
34 /* FIXME */ 34 GaimStatus *status;
35 #if 0 35
36 if(awaymessage && !gaim_prefs_get_bool("/core/sound/while_away")) 36 if ((account != NULL) && (!gaim_prefs_get_bool("/core/sounds/while_away")))
37 return; 37 {
38 #endif 38 status = gaim_account_get_active_status(account);
39 if (gaim_status_is_online(status) && !gaim_status_is_available(status))
40 return;
41 }
39 42
40 if(sound_ui_ops && sound_ui_ops->play_file) 43 if(sound_ui_ops && sound_ui_ops->play_file)
41 sound_ui_ops->play_file(filename); 44 sound_ui_ops->play_file(filename);
42 } 45 }
43 46
44 void 47 void
45 gaim_sound_play_event(GaimSoundEventID event) 48 gaim_sound_play_event(GaimSoundEventID event, const GaimAccount *account)
46 { 49 {
47 /* FIXME */ 50 GaimStatus *status;
48 #if 0 51
49 if(awaymessage && !gaim_prefs_get_bool("/core/sound/while_away")) 52 if ((account != NULL) && (!gaim_prefs_get_bool("/core/sounds/while_away")))
50 return; 53 {
51 #endif 54 status = gaim_account_get_active_status(account);
55 if (gaim_status_is_online(status) && !gaim_status_is_available(status))
56 return;
57 }
52 58
53 if(sound_ui_ops && sound_ui_ops->play_event) 59 if(sound_ui_ops && sound_ui_ops->play_event)
54 sound_ui_ops->play_event(event); 60 sound_ui_ops->play_event(event);
55 } 61 }
56 62