Mon, 12 Dec 2005 07:35:43 +0000
[gaim-migrate @ 14773]
SF Patch #1377719 from Evan Schoenberg
"A recent reorganization of how the chat_add_users() conversation UI op is
sent removed passing to the UI of whether the additions are new arrivals
or not. This information lets the UI make decisions about how to handle
the new people, what if anything to display, etc."
committer: Richard Laager <rlaager@pidgin.im>
| 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
754c63f29b77
[gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents:
5684
diff
changeset
|
23 | #include "internal.h" |
| 3630 | 24 | |
|
10322
06e23196da4b
[gaim-migrate @ 11529]
Mark Doliner <markdoliner@pidgin.im>
parents:
9993
diff
changeset
|
25 | #include "blist.h" |
|
06e23196da4b
[gaim-migrate @ 11529]
Mark Doliner <markdoliner@pidgin.im>
parents:
9993
diff
changeset
|
26 | #include "prefs.h" |
| 4561 | 27 | #include "sound.h" |
| 1 | 28 | |
| 5684 | 29 | static GaimSoundUiOps *sound_ui_ops = NULL; |
| 3319 | 30 | |
|
10322
06e23196da4b
[gaim-migrate @ 11529]
Mark Doliner <markdoliner@pidgin.im>
parents:
9993
diff
changeset
|
31 | void |
|
11642
76b60f0bf467
[gaim-migrate @ 13919]
Casey Harkins <charkins@pidgin.im>
parents:
11563
diff
changeset
|
32 | gaim_sound_play_file(const char *filename, const GaimAccount *account) |
| 5684 | 33 | { |
|
11642
76b60f0bf467
[gaim-migrate @ 13919]
Casey Harkins <charkins@pidgin.im>
parents:
11563
diff
changeset
|
34 | GaimStatus *status; |
|
76b60f0bf467
[gaim-migrate @ 13919]
Casey Harkins <charkins@pidgin.im>
parents:
11563
diff
changeset
|
35 | |
|
11652
ec80ecebb264
[gaim-migrate @ 13936]
Mark Doliner <markdoliner@pidgin.im>
parents:
11642
diff
changeset
|
36 | if ((account != NULL) && (!gaim_prefs_get_bool("/core/sound/while_away"))) |
|
11642
76b60f0bf467
[gaim-migrate @ 13919]
Casey Harkins <charkins@pidgin.im>
parents:
11563
diff
changeset
|
37 | { |
|
76b60f0bf467
[gaim-migrate @ 13919]
Casey Harkins <charkins@pidgin.im>
parents:
11563
diff
changeset
|
38 | status = gaim_account_get_active_status(account); |
|
76b60f0bf467
[gaim-migrate @ 13919]
Casey Harkins <charkins@pidgin.im>
parents:
11563
diff
changeset
|
39 | if (gaim_status_is_online(status) && !gaim_status_is_available(status)) |
|
76b60f0bf467
[gaim-migrate @ 13919]
Casey Harkins <charkins@pidgin.im>
parents:
11563
diff
changeset
|
40 | return; |
|
76b60f0bf467
[gaim-migrate @ 13919]
Casey Harkins <charkins@pidgin.im>
parents:
11563
diff
changeset
|
41 | } |
|
4430
95df701e8cdf
[gaim-migrate @ 4705]
Robert McQueen <robot101@debian.org>
parents:
4429
diff
changeset
|
42 | |
| 5684 | 43 | if(sound_ui_ops && sound_ui_ops->play_file) |
| 44 | sound_ui_ops->play_file(filename); | |
|
1006
fb2f2a403962
[gaim-migrate @ 1016]
Eric Warmenhoven <warmenhoven@yahoo.com>
parents:
899
diff
changeset
|
45 | } |
|
fb2f2a403962
[gaim-migrate @ 1016]
Eric Warmenhoven <warmenhoven@yahoo.com>
parents:
899
diff
changeset
|
46 | |
|
10322
06e23196da4b
[gaim-migrate @ 11529]
Mark Doliner <markdoliner@pidgin.im>
parents:
9993
diff
changeset
|
47 | void |
|
11642
76b60f0bf467
[gaim-migrate @ 13919]
Casey Harkins <charkins@pidgin.im>
parents:
11563
diff
changeset
|
48 | gaim_sound_play_event(GaimSoundEventID event, const GaimAccount *account) |
| 1 | 49 | { |
|
11642
76b60f0bf467
[gaim-migrate @ 13919]
Casey Harkins <charkins@pidgin.im>
parents:
11563
diff
changeset
|
50 | GaimStatus *status; |
|
76b60f0bf467
[gaim-migrate @ 13919]
Casey Harkins <charkins@pidgin.im>
parents:
11563
diff
changeset
|
51 | |
| 12291 | 52 | if ((account != NULL) && |
| 53 | (!gaim_prefs_get_bool("/core/sound/while_away"))) | |
|
11642
76b60f0bf467
[gaim-migrate @ 13919]
Casey Harkins <charkins@pidgin.im>
parents:
11563
diff
changeset
|
54 | { |
|
76b60f0bf467
[gaim-migrate @ 13919]
Casey Harkins <charkins@pidgin.im>
parents:
11563
diff
changeset
|
55 | status = gaim_account_get_active_status(account); |
| 12291 | 56 | if (gaim_status_is_online(status) && |
| 57 | !gaim_status_is_available(status)) | |
|
11642
76b60f0bf467
[gaim-migrate @ 13919]
Casey Harkins <charkins@pidgin.im>
parents:
11563
diff
changeset
|
58 | return; |
|
76b60f0bf467
[gaim-migrate @ 13919]
Casey Harkins <charkins@pidgin.im>
parents:
11563
diff
changeset
|
59 | } |
| 4561 | 60 | |
| 12291 | 61 | if(sound_ui_ops && sound_ui_ops->play_event) { |
| 62 | int plugin_return; | |
| 63 | ||
| 64 | plugin_return = GPOINTER_TO_INT(gaim_signal_emit_return_1( | |
| 65 | gaim_sounds_get_handle(), "playing-sound-event", | |
| 66 | event, account)); | |
| 67 | ||
| 68 | if (plugin_return) | |
| 69 | return; | |
| 70 | else | |
| 71 | sound_ui_ops->play_event(event); | |
| 72 | } | |
| 4561 | 73 | } |
|
10322
06e23196da4b
[gaim-migrate @ 11529]
Mark Doliner <markdoliner@pidgin.im>
parents:
9993
diff
changeset
|
74 | |
|
06e23196da4b
[gaim-migrate @ 11529]
Mark Doliner <markdoliner@pidgin.im>
parents:
9993
diff
changeset
|
75 | void |
|
06e23196da4b
[gaim-migrate @ 11529]
Mark Doliner <markdoliner@pidgin.im>
parents:
9993
diff
changeset
|
76 | gaim_sound_set_ui_ops(GaimSoundUiOps *ops) |
|
06e23196da4b
[gaim-migrate @ 11529]
Mark Doliner <markdoliner@pidgin.im>
parents:
9993
diff
changeset
|
77 | { |
|
06e23196da4b
[gaim-migrate @ 11529]
Mark Doliner <markdoliner@pidgin.im>
parents:
9993
diff
changeset
|
78 | if(sound_ui_ops && sound_ui_ops->uninit) |
|
06e23196da4b
[gaim-migrate @ 11529]
Mark Doliner <markdoliner@pidgin.im>
parents:
9993
diff
changeset
|
79 | sound_ui_ops->uninit(); |
|
06e23196da4b
[gaim-migrate @ 11529]
Mark Doliner <markdoliner@pidgin.im>
parents:
9993
diff
changeset
|
80 | |
|
06e23196da4b
[gaim-migrate @ 11529]
Mark Doliner <markdoliner@pidgin.im>
parents:
9993
diff
changeset
|
81 | sound_ui_ops = ops; |
|
06e23196da4b
[gaim-migrate @ 11529]
Mark Doliner <markdoliner@pidgin.im>
parents:
9993
diff
changeset
|
82 | |
|
06e23196da4b
[gaim-migrate @ 11529]
Mark Doliner <markdoliner@pidgin.im>
parents:
9993
diff
changeset
|
83 | if(sound_ui_ops && sound_ui_ops->init) |
|
06e23196da4b
[gaim-migrate @ 11529]
Mark Doliner <markdoliner@pidgin.im>
parents:
9993
diff
changeset
|
84 | sound_ui_ops->init(); |
|
06e23196da4b
[gaim-migrate @ 11529]
Mark Doliner <markdoliner@pidgin.im>
parents:
9993
diff
changeset
|
85 | } |
|
06e23196da4b
[gaim-migrate @ 11529]
Mark Doliner <markdoliner@pidgin.im>
parents:
9993
diff
changeset
|
86 | |
|
06e23196da4b
[gaim-migrate @ 11529]
Mark Doliner <markdoliner@pidgin.im>
parents:
9993
diff
changeset
|
87 | GaimSoundUiOps * |
|
06e23196da4b
[gaim-migrate @ 11529]
Mark Doliner <markdoliner@pidgin.im>
parents:
9993
diff
changeset
|
88 | gaim_sound_get_ui_ops(void) |
|
06e23196da4b
[gaim-migrate @ 11529]
Mark Doliner <markdoliner@pidgin.im>
parents:
9993
diff
changeset
|
89 | { |
|
06e23196da4b
[gaim-migrate @ 11529]
Mark Doliner <markdoliner@pidgin.im>
parents:
9993
diff
changeset
|
90 | return sound_ui_ops; |
|
06e23196da4b
[gaim-migrate @ 11529]
Mark Doliner <markdoliner@pidgin.im>
parents:
9993
diff
changeset
|
91 | } |
|
06e23196da4b
[gaim-migrate @ 11529]
Mark Doliner <markdoliner@pidgin.im>
parents:
9993
diff
changeset
|
92 | |
|
06e23196da4b
[gaim-migrate @ 11529]
Mark Doliner <markdoliner@pidgin.im>
parents:
9993
diff
changeset
|
93 | void |
|
06e23196da4b
[gaim-migrate @ 11529]
Mark Doliner <markdoliner@pidgin.im>
parents:
9993
diff
changeset
|
94 | gaim_sound_init() |
|
06e23196da4b
[gaim-migrate @ 11529]
Mark Doliner <markdoliner@pidgin.im>
parents:
9993
diff
changeset
|
95 | { |
| 12291 | 96 | void *handle = gaim_sounds_get_handle(); |
| 97 | ||
| 98 | /********************************************************************** | |
| 99 | * Register signals | |
| 100 | **********************************************************************/ | |
| 101 | ||
| 102 | gaim_signal_register(handle, "playing-sound-event", | |
| 103 | gaim_marshal_BOOLEAN__INT_POINTER, | |
| 104 | gaim_value_new(GAIM_TYPE_BOOLEAN), 2, | |
| 105 | gaim_value_new(GAIM_TYPE_INT), | |
| 106 | gaim_value_new(GAIM_TYPE_POINTER)); | |
| 107 | ||
|
10322
06e23196da4b
[gaim-migrate @ 11529]
Mark Doliner <markdoliner@pidgin.im>
parents:
9993
diff
changeset
|
108 | gaim_prefs_add_none("/core/sound"); |
|
06e23196da4b
[gaim-migrate @ 11529]
Mark Doliner <markdoliner@pidgin.im>
parents:
9993
diff
changeset
|
109 | gaim_prefs_add_bool("/core/sound/while_away", FALSE); |
|
06e23196da4b
[gaim-migrate @ 11529]
Mark Doliner <markdoliner@pidgin.im>
parents:
9993
diff
changeset
|
110 | |
|
06e23196da4b
[gaim-migrate @ 11529]
Mark Doliner <markdoliner@pidgin.im>
parents:
9993
diff
changeset
|
111 | } |
|
06e23196da4b
[gaim-migrate @ 11529]
Mark Doliner <markdoliner@pidgin.im>
parents:
9993
diff
changeset
|
112 | |
|
06e23196da4b
[gaim-migrate @ 11529]
Mark Doliner <markdoliner@pidgin.im>
parents:
9993
diff
changeset
|
113 | void |
|
06e23196da4b
[gaim-migrate @ 11529]
Mark Doliner <markdoliner@pidgin.im>
parents:
9993
diff
changeset
|
114 | gaim_sound_uninit() |
|
06e23196da4b
[gaim-migrate @ 11529]
Mark Doliner <markdoliner@pidgin.im>
parents:
9993
diff
changeset
|
115 | { |
|
06e23196da4b
[gaim-migrate @ 11529]
Mark Doliner <markdoliner@pidgin.im>
parents:
9993
diff
changeset
|
116 | if(sound_ui_ops && sound_ui_ops->uninit) |
|
06e23196da4b
[gaim-migrate @ 11529]
Mark Doliner <markdoliner@pidgin.im>
parents:
9993
diff
changeset
|
117 | sound_ui_ops->uninit(); |
| 12291 | 118 | |
| 119 | gaim_signals_unregister_by_instance(gaim_sounds_get_handle()); | |
|
10322
06e23196da4b
[gaim-migrate @ 11529]
Mark Doliner <markdoliner@pidgin.im>
parents:
9993
diff
changeset
|
120 | } |
| 12291 | 121 | |
| 122 | void * | |
| 123 | gaim_sounds_get_handle() | |
| 124 | { | |
| 125 | static int handle; | |
| 126 | ||
| 127 | return &handle; | |
| 128 | } |