|
40 | 40 | #define PACKAGE_DATADIR "." |
41 | 41 | #endif |
42 | 42 |
|
| 43 | +#define NO_SOUND "silent" |
| 44 | + |
43 | 45 | const struct _ui_strings { |
44 | 46 | const char* self; |
45 | 47 | const char* timestamps; |
@@ -202,44 +204,64 @@ int settings_load(struct user_settings *s, const char *patharg) |
202 | 204 | #ifdef _SOUND_NOTIFY |
203 | 205 | if ((setting = config_lookup(cfg, sound_strings.self)) != NULL) { |
204 | 206 | if ( (config_setting_lookup_string(setting, sound_strings.error, &str) != CONFIG_TRUE) || |
205 | | - !set_sound(error, str) ) |
206 | | - set_sound(error, PACKAGE_DATADIR "/sounds/Error.wav"); |
| 207 | + !set_sound(error, str) ) { |
| 208 | + if (strcasecmp(str, NO_SOUND)) |
| 209 | + set_sound(error, PACKAGE_DATADIR "/sounds/Error.wav"); |
| 210 | + } |
207 | 211 |
|
208 | 212 | if ( !config_setting_lookup_string(setting, sound_strings.user_log_in, &str) || |
209 | | - !set_sound(user_log_in, str) ) |
210 | | - set_sound(user_log_in, PACKAGE_DATADIR "/sounds/ContactLogsIn.wav"); |
| 213 | + !set_sound(user_log_in, str) ) { |
| 214 | + if (strcasecmp(str, NO_SOUND)) |
| 215 | + set_sound(user_log_in, PACKAGE_DATADIR "/sounds/ContactLogsIn.wav"); |
| 216 | + } |
211 | 217 |
|
212 | 218 | if ( !config_setting_lookup_string(setting, sound_strings.self_log_in, &str) || |
213 | | - !set_sound(self_log_in, str) ) |
214 | | - set_sound(self_log_in, PACKAGE_DATADIR "/sounds/LogIn.wav"); |
215 | | - |
| 219 | + !set_sound(self_log_in, str) ) { |
| 220 | + if (strcasecmp(str, NO_SOUND)) |
| 221 | + set_sound(self_log_in, PACKAGE_DATADIR "/sounds/LogIn.wav"); |
| 222 | + } |
| 223 | + |
216 | 224 | if ( !config_setting_lookup_string(setting, sound_strings.user_log_out, &str) || |
217 | | - !set_sound(user_log_out, str) ) |
218 | | - set_sound(user_log_out, PACKAGE_DATADIR "/sounds/ContactLogsOut.wav"); |
219 | | - |
| 225 | + !set_sound(user_log_out, str) ) { |
| 226 | + if (strcasecmp(str, NO_SOUND)) |
| 227 | + set_sound(user_log_out, PACKAGE_DATADIR "/sounds/ContactLogsOut.wav"); |
| 228 | + } |
| 229 | + |
220 | 230 | if ( !config_setting_lookup_string(setting, sound_strings.self_log_out, &str) || |
221 | | - !set_sound(self_log_out, str) ) |
222 | | - set_sound(self_log_out, PACKAGE_DATADIR "/sounds/LogOut.wav"); |
| 231 | + !set_sound(self_log_out, str) ) { |
| 232 | + if (strcasecmp(str, NO_SOUND)) |
| 233 | + set_sound(self_log_out, PACKAGE_DATADIR "/sounds/LogOut.wav"); |
| 234 | + } |
223 | 235 |
|
224 | 236 | if ( !config_setting_lookup_string(setting, sound_strings.call_incoming, &str) || |
225 | | - !set_sound(call_incoming, str) ) |
226 | | - set_sound(call_incoming, PACKAGE_DATADIR "/sounds/IncomingCall.wav"); |
| 237 | + !set_sound(call_incoming, str) ) { |
| 238 | + if (strcasecmp(str, NO_SOUND)) |
| 239 | + set_sound(call_incoming, PACKAGE_DATADIR "/sounds/IncomingCall.wav"); |
| 240 | + } |
227 | 241 |
|
228 | 242 | if ( !config_setting_lookup_string(setting, sound_strings.call_outgoing, &str) || |
229 | | - !set_sound(call_outgoing, str) ) |
230 | | - set_sound(call_outgoing, PACKAGE_DATADIR "/sounds/OutgoingCall.wav"); |
| 243 | + !set_sound(call_outgoing, str) ) { |
| 244 | + if (strcasecmp(str, NO_SOUND)) |
| 245 | + set_sound(call_outgoing, PACKAGE_DATADIR "/sounds/OutgoingCall.wav"); |
| 246 | + } |
231 | 247 |
|
232 | 248 | if ( config_setting_lookup_string(setting, sound_strings.generic_message, &str) || |
233 | | - !set_sound(generic_message, str) ) |
234 | | - set_sound(generic_message, PACKAGE_DATADIR "/sounds/NewMessage.wav"); |
| 249 | + !set_sound(generic_message, str) ) { |
| 250 | + if (strcasecmp(str, NO_SOUND)) |
| 251 | + set_sound(generic_message, PACKAGE_DATADIR "/sounds/NewMessage.wav"); |
| 252 | + } |
235 | 253 |
|
236 | 254 | if ( !config_setting_lookup_string(setting, sound_strings.transfer_pending, &str) || |
237 | | - !set_sound(transfer_pending, str) ) |
238 | | - set_sound(transfer_pending, PACKAGE_DATADIR "/sounds/TransferPending.wav"); |
| 255 | + !set_sound(transfer_pending, str) ) { |
| 256 | + if (strcasecmp(str, NO_SOUND)) |
| 257 | + set_sound(transfer_pending, PACKAGE_DATADIR "/sounds/TransferPending.wav"); |
| 258 | + } |
239 | 259 |
|
240 | 260 | if ( !config_setting_lookup_string(setting, sound_strings.transfer_completed, &str) || |
241 | | - !set_sound(transfer_completed, str) ) |
242 | | - set_sound(transfer_completed, PACKAGE_DATADIR "/sounds/TransferComplete.wav"); |
| 261 | + !set_sound(transfer_completed, str) ) { |
| 262 | + if (strcasecmp(str, NO_SOUND)) |
| 263 | + set_sound(transfer_completed, PACKAGE_DATADIR "/sounds/TransferComplete.wav"); |
| 264 | + } |
243 | 265 | } |
244 | 266 | else { |
245 | 267 | set_sound(error, PACKAGE_DATADIR "/sounds/Error.wav"); |
|
0 commit comments