1
0
mirror of https://github.com/Tha14/toxic.git synced 2024-11-13 02:33:03 +01:00

allow disabling of individual sounds

This commit is contained in:
Jfreegman 2014-07-23 14:59:36 -04:00
parent 04fbf5f724
commit 9476db02a9
No known key found for this signature in database
GPG Key ID: 3627F3144076AE63
3 changed files with 47 additions and 22 deletions

View File

@ -252,6 +252,8 @@ tox = {
.br
};
.br
// To disable a sound set the path to "silent"
.br
sounds = {
.br
error="__DATADIR__/sounds/Error.wav";

View File

@ -37,6 +37,7 @@ tox = {
// download_path="/home/USERNAME/Downloads/";
};
// To disable a sound set the path to "silent"
sounds = {
error="__DATADIR__/sounds/Error.wav";
self_log_in="__DATADIR__/sounds/LogIn.wav";

View File

@ -40,6 +40,8 @@
#define PACKAGE_DATADIR "."
#endif
#define NO_SOUND "silent"
const struct _ui_strings {
const char* self;
const char* timestamps;
@ -202,44 +204,64 @@ int settings_load(struct user_settings *s, const char *patharg)
#ifdef _SOUND_NOTIFY
if ((setting = config_lookup(cfg, sound_strings.self)) != NULL) {
if ( (config_setting_lookup_string(setting, sound_strings.error, &str) != CONFIG_TRUE) ||
!set_sound(error, str) )
set_sound(error, PACKAGE_DATADIR "/sounds/Error.wav");
!set_sound(error, str) ) {
if (strcasecmp(str, NO_SOUND))
set_sound(error, PACKAGE_DATADIR "/sounds/Error.wav");
}
if ( !config_setting_lookup_string(setting, sound_strings.user_log_in, &str) ||
!set_sound(user_log_in, str) )
set_sound(user_log_in, PACKAGE_DATADIR "/sounds/ContactLogsIn.wav");
!set_sound(user_log_in, str) ) {
if (strcasecmp(str, NO_SOUND))
set_sound(user_log_in, PACKAGE_DATADIR "/sounds/ContactLogsIn.wav");
}
if ( !config_setting_lookup_string(setting, sound_strings.self_log_in, &str) ||
!set_sound(self_log_in, str) )
set_sound(self_log_in, PACKAGE_DATADIR "/sounds/LogIn.wav");
!set_sound(self_log_in, str) ) {
if (strcasecmp(str, NO_SOUND))
set_sound(self_log_in, PACKAGE_DATADIR "/sounds/LogIn.wav");
}
if ( !config_setting_lookup_string(setting, sound_strings.user_log_out, &str) ||
!set_sound(user_log_out, str) )
set_sound(user_log_out, PACKAGE_DATADIR "/sounds/ContactLogsOut.wav");
!set_sound(user_log_out, str) ) {
if (strcasecmp(str, NO_SOUND))
set_sound(user_log_out, PACKAGE_DATADIR "/sounds/ContactLogsOut.wav");
}
if ( !config_setting_lookup_string(setting, sound_strings.self_log_out, &str) ||
!set_sound(self_log_out, str) )
set_sound(self_log_out, PACKAGE_DATADIR "/sounds/LogOut.wav");
!set_sound(self_log_out, str) ) {
if (strcasecmp(str, NO_SOUND))
set_sound(self_log_out, PACKAGE_DATADIR "/sounds/LogOut.wav");
}
if ( !config_setting_lookup_string(setting, sound_strings.call_incoming, &str) ||
!set_sound(call_incoming, str) )
set_sound(call_incoming, PACKAGE_DATADIR "/sounds/IncomingCall.wav");
!set_sound(call_incoming, str) ) {
if (strcasecmp(str, NO_SOUND))
set_sound(call_incoming, PACKAGE_DATADIR "/sounds/IncomingCall.wav");
}
if ( !config_setting_lookup_string(setting, sound_strings.call_outgoing, &str) ||
!set_sound(call_outgoing, str) )
set_sound(call_outgoing, PACKAGE_DATADIR "/sounds/OutgoingCall.wav");
!set_sound(call_outgoing, str) ) {
if (strcasecmp(str, NO_SOUND))
set_sound(call_outgoing, PACKAGE_DATADIR "/sounds/OutgoingCall.wav");
}
if ( config_setting_lookup_string(setting, sound_strings.generic_message, &str) ||
!set_sound(generic_message, str) )
set_sound(generic_message, PACKAGE_DATADIR "/sounds/NewMessage.wav");
!set_sound(generic_message, str) ) {
if (strcasecmp(str, NO_SOUND))
set_sound(generic_message, PACKAGE_DATADIR "/sounds/NewMessage.wav");
}
if ( !config_setting_lookup_string(setting, sound_strings.transfer_pending, &str) ||
!set_sound(transfer_pending, str) )
set_sound(transfer_pending, PACKAGE_DATADIR "/sounds/TransferPending.wav");
!set_sound(transfer_pending, str) ) {
if (strcasecmp(str, NO_SOUND))
set_sound(transfer_pending, PACKAGE_DATADIR "/sounds/TransferPending.wav");
}
if ( !config_setting_lookup_string(setting, sound_strings.transfer_completed, &str) ||
!set_sound(transfer_completed, str) )
set_sound(transfer_completed, PACKAGE_DATADIR "/sounds/TransferComplete.wav");
!set_sound(transfer_completed, str) ) {
if (strcasecmp(str, NO_SOUND))
set_sound(transfer_completed, PACKAGE_DATADIR "/sounds/TransferComplete.wav");
}
}
else {
set_sound(error, PACKAGE_DATADIR "/sounds/Error.wav");