Mercurial > pidgin
annotate src/sound.c @ 10963:ad9f6c032092
[gaim-migrate @ 12768]
sf patch #1213081 and 1213083, from Bleeter Yaluser
Some kind of Yahoo! privacy stuff.
Honestly this could be a virus and I'd be none the wiser.
committer: Tailor Script <tailor@pidgin.im>
author | Mark Doliner <mark@kingant.net> |
---|---|
date | Wed, 01 Jun 2005 22:15:27 +0000 |
parents | 2a132b73a6e6 |
children | 11d30825c1bb |
rev | line source |
---|---|
1 | 1 /* |
2 * gaim | |
3 * | |
8046 | 4 * Gaim is the legal property of its developers, whose names are too numerous |
5 * to list here. Please refer to the COPYRIGHT file distributed with this | |
6 * source distribution. | |
1 | 7 * |
8 * This program is free software; you can redistribute it and/or modify | |
9 * it under the terms of the GNU General Public License as published by | |
10 * the Free Software Foundation; either version 2 of the License, or | |
11 * (at your option) any later version. | |
12 * | |
13 * This program is distributed in the hope that it will be useful, | |
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of | |
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
16 * GNU General Public License for more details. | |
17 * | |
18 * You should have received a copy of the GNU General Public License | |
19 * along with this program; if not, write to the Free Software | |
20 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | |
21 * | |
22 */ | |
5872
059d95c67cda
[gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents:
5684
diff
changeset
|
23 #include "internal.h" |
3630 | 24 |
10322 | 25 #include "blist.h" |
26 #include "prefs.h" | |
4561 | 27 #include "sound.h" |
1 | 28 |
5684 | 29 static GaimSoundUiOps *sound_ui_ops = NULL; |
3319 | 30 |
10322 | 31 void |
32 gaim_sound_play_file(const char *filename) | |
5684 | 33 { |
9944 | 34 /* FIXME */ |
35 #if 0 | |
5684 | 36 if(awaymessage && !gaim_prefs_get_bool("/core/sound/while_away")) |
4561 | 37 return; |
9944 | 38 #endif |
4430 | 39 |
5684 | 40 if(sound_ui_ops && sound_ui_ops->play_file) |
41 sound_ui_ops->play_file(filename); | |
1006
0a4d0ed65e17
[gaim-migrate @ 1016]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
899
diff
changeset
|
42 } |
0a4d0ed65e17
[gaim-migrate @ 1016]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
899
diff
changeset
|
43 |
10322 | 44 void |
45 gaim_sound_play_event(GaimSoundEventID event) | |
1 | 46 { |
9944 | 47 /* FIXME */ |
48 #if 0 | |
5684 | 49 if(awaymessage && !gaim_prefs_get_bool("/core/sound/while_away")) |
4561 | 50 return; |
9944 | 51 #endif |
4561 | 52 |
5684 | 53 if(sound_ui_ops && sound_ui_ops->play_event) |
54 sound_ui_ops->play_event(event); | |
4561 | 55 } |
10322 | 56 |
57 static void | |
58 sound_triggered_cb(GaimBuddy *buddy, GaimSoundEventID event) | |
59 { | |
60 gaim_sound_play_event(event); | |
61 } | |
62 | |
63 void | |
64 gaim_sound_set_ui_ops(GaimSoundUiOps *ops) | |
65 { | |
66 if(sound_ui_ops && sound_ui_ops->uninit) | |
67 sound_ui_ops->uninit(); | |
68 | |
69 sound_ui_ops = ops; | |
70 | |
71 if(sound_ui_ops && sound_ui_ops->init) | |
72 sound_ui_ops->init(); | |
73 } | |
74 | |
75 GaimSoundUiOps * | |
76 gaim_sound_get_ui_ops(void) | |
77 { | |
78 return sound_ui_ops; | |
79 } | |
80 | |
81 void * | |
82 gaim_sound_get_handle() { | |
83 static int handle; | |
84 | |
85 return &handle; | |
86 } | |
87 | |
88 void | |
89 gaim_sound_init() | |
90 { | |
91 void *handle = gaim_sound_get_handle(); | |
92 void *blist_handle = gaim_blist_get_handle(); | |
93 | |
94 gaim_prefs_add_none("/core/sound"); | |
95 gaim_prefs_add_bool("/core/sound/while_away", FALSE); | |
96 | |
97 gaim_signal_connect(blist_handle, "buddy-signed-on", | |
98 handle, GAIM_CALLBACK(sound_triggered_cb), | |
99 GINT_TO_POINTER(GAIM_SOUND_BUDDY_ARRIVE)); | |
100 gaim_signal_connect(blist_handle, "buddy-signed-off", | |
101 handle, GAIM_CALLBACK(sound_triggered_cb), | |
102 GINT_TO_POINTER(GAIM_SOUND_BUDDY_LEAVE)); | |
103 } | |
104 | |
105 void | |
106 gaim_sound_uninit() | |
107 { | |
108 gaim_signals_disconnect_by_handle(gaim_sound_get_handle()); | |
109 | |
110 if(sound_ui_ops && sound_ui_ops->uninit) | |
111 sound_ui_ops->uninit(); | |
112 } |