1
0
mirror of https://github.com/Tha14/toxic.git synced 2025-06-20 01:26:35 +02:00

Add further explanation to the beep_on* options

This also renames beep_on* to bell_on*.
This commit is contained in:
Marvin Ewald
2016-07-21 11:25:40 +02:00
parent 9aedcf7753
commit 5b1b420ac0
7 changed files with 87 additions and 78 deletions

View File

@ -160,10 +160,10 @@ static void recv_message_helper(ToxWindow *self, Tox *m, uint32_t num, const cha
write_to_log(msg, nick, ctx->log, false);
if (self->active_box != -1)
box_notify2(self, generic_message, NT_WNDALERT_1 | NT_NOFOCUS | user_settings->beep_on_message,
box_notify2(self, generic_message, NT_WNDALERT_1 | NT_NOFOCUS | user_settings->bell_on_message,
self->active_box, "%s", msg);
else
box_notify(self, generic_message, NT_WNDALERT_1 | NT_NOFOCUS | user_settings->beep_on_message,
box_notify(self, generic_message, NT_WNDALERT_1 | NT_NOFOCUS | user_settings->bell_on_message,
&self->active_box, nick, "%s", msg);
}
@ -176,10 +176,10 @@ static void recv_action_helper(ToxWindow *self, Tox *m, uint32_t num, const char
write_to_log(action, nick, ctx->log, true);
if (self->active_box != -1)
box_notify2(self, generic_message, NT_WNDALERT_1 | NT_NOFOCUS | user_settings->beep_on_message,
box_notify2(self, generic_message, NT_WNDALERT_1 | NT_NOFOCUS | user_settings->bell_on_message,
self->active_box, "* %s %s", nick, action );
else
box_notify(self, generic_message, NT_WNDALERT_1 | NT_NOFOCUS | user_settings->beep_on_message,
box_notify(self, generic_message, NT_WNDALERT_1 | NT_NOFOCUS | user_settings->bell_on_message,
&self->active_box, self->name, "* %s %s", nick, action );
}
@ -458,7 +458,7 @@ static void chat_onFileControl(ToxWindow *self, Tox *m, uint32_t friendnum, uint
char progline[MAX_STR_SIZE];
init_progress_bar(progline);
line_info_add(self, NULL, NULL, NULL, SYS_MSG, 0, 0, "%s", progline);
sound_notify(self, silent, NT_NOFOCUS | user_settings->beep_on_filetrans_accept | NT_WNDALERT_2, NULL);
sound_notify(self, silent, NT_NOFOCUS | user_settings->bell_on_filetrans_accept | NT_WNDALERT_2, NULL);
ft->line_id = self->chatwin->hst->line_end->id + 2;
} else if (ft->state == FILE_TRANSFER_PAUSED) { /* transfer is resumed */
ft->state = FILE_TRANSFER_STARTED;
@ -600,10 +600,10 @@ static void chat_onFileRecv(ToxWindow *self, Tox *m, uint32_t friendnum, uint32_
tox_file_get_file_id(m, friendnum, filenum, ft->file_id, NULL);
if (self->active_box != -1)
box_notify2(self, transfer_pending, NT_WNDALERT_0 | NT_NOFOCUS | user_settings->beep_on_filetrans,
box_notify2(self, transfer_pending, NT_WNDALERT_0 | NT_NOFOCUS | user_settings->bell_on_filetrans,
self->active_box, "Incoming file: %s", filename );
else
box_notify(self, transfer_pending, NT_WNDALERT_0 | NT_NOFOCUS | user_settings->beep_on_filetrans,
box_notify(self, transfer_pending, NT_WNDALERT_0 | NT_NOFOCUS | user_settings->bell_on_filetrans,
&self->active_box, self->name, "Incoming file: %s", filename );
}
@ -627,7 +627,7 @@ static void chat_onGroupInvite(ToxWindow *self, Tox *m, int32_t friendnumber, ui
Friends.list[friendnumber].group_invite.length = length;
Friends.list[friendnumber].group_invite.type = type;
sound_notify(self, generic_message, NT_WNDALERT_2 | user_settings->beep_on_invite, NULL);
sound_notify(self, generic_message, NT_WNDALERT_2 | user_settings->bell_on_invite, NULL);
char name[TOX_MAX_NAME_LENGTH];
get_nick_truncate(m, name, friendnumber);
@ -655,7 +655,7 @@ void chat_onInvite (ToxWindow *self, ToxAV *av, uint32_t friend_number, int stat
line_info_add(self, NULL, NULL, NULL, SYS_MSG, 0, 0, "Incoming audio call! Type: \"/answer\" or \"/reject\"");
if (self->ringing_sound == -1)
sound_notify(self, call_incoming, NT_LOOP | user_settings->beep_on_invite, &self->ringing_sound);
sound_notify(self, call_incoming, NT_LOOP | user_settings->bell_on_invite, &self->ringing_sound);
if (self->active_box != -1)
box_silent_notify2(self, NT_NOFOCUS | NT_WNDALERT_0, self->active_box, "Incoming audio call!");

View File

@ -258,7 +258,7 @@ static void groupchat_onGroupMessage(ToxWindow *self, Tox *m, int groupnum, int
/* Only play sound if mentioned by someone else */
if (strcasestr(msg, selfnick) && strcmp(selfnick, nick)) {
sound_notify(self, generic_message, NT_WNDALERT_0 | user_settings->beep_on_message, NULL);
sound_notify(self, generic_message, NT_WNDALERT_0 | user_settings->bell_on_message, NULL);
if (self->active_box != -1)
box_silent_notify2(self, NT_NOFOCUS, self->active_box, "%s %s", nick, msg);
@ -296,7 +296,7 @@ static void groupchat_onGroupAction(ToxWindow *self, Tox *m, int groupnum, int p
selfnick[n_len] = '\0';
if (strcasestr(action, selfnick)) {
sound_notify(self, generic_message, NT_WNDALERT_0 | user_settings->beep_on_message, NULL);
sound_notify(self, generic_message, NT_WNDALERT_0 | user_settings->bell_on_message, NULL);
if (self->active_box != -1)
box_silent_notify2(self, NT_NOFOCUS, self->active_box, "* %s %s", nick, action );

View File

@ -51,10 +51,10 @@ static struct ui_strings {
const char* timestamp_format;
const char* log_timestamp_format;
const char* alerts;
const char* beep_on_message;
const char* beep_on_filetrans;
const char* beep_on_filetrans_accept;
const char* beep_on_invite;
const char* bell_on_message;
const char* bell_on_filetrans;
const char* bell_on_filetrans_accept;
const char* bell_on_invite;
const char* native_colors;
const char* autolog;
const char* history_size;
@ -77,10 +77,10 @@ static struct ui_strings {
"timestamp_format",
"log_timestamp_format",
"alerts",
"beep_on_message",
"beep_on_filetrans",
"beep_on_filetrans_accept",
"beep_on_invite",
"bell_on_message",
"bell_on_filetrans",
"bell_on_filetrans_accept",
"bell_on_invite",
"native_colors",
"autolog",
"history_size",
@ -104,10 +104,10 @@ static void ui_defaults(struct user_settings* settings)
settings->autolog = AUTOLOG_OFF;
settings->alerts = ALERTS_ENABLED;
settings->beep_on_message = 0;
settings->beep_on_filetrans = 0;
settings->beep_on_filetrans_accept = 0;
settings->beep_on_invite = 0;
settings->bell_on_message = 0;
settings->bell_on_filetrans = 0;
settings->bell_on_filetrans_accept = 0;
settings->bell_on_invite = 0;
settings->colour_theme = DFLT_COLS;
settings->history_size = 700;
settings->show_typing_self = SHOW_TYPING_ON;
@ -332,17 +332,17 @@ int settings_load(struct user_settings *s, const char *patharg)
config_setting_lookup_bool(setting, ui_strings.alerts, &s->alerts);
if (config_setting_lookup_bool(setting, ui_strings.beep_on_message, &s->beep_on_message)) {
s->beep_on_message = s->beep_on_message ? NT_BEEP : 0;
if (config_setting_lookup_bool(setting, ui_strings.bell_on_message, &s->bell_on_message)) {
s->bell_on_message = s->bell_on_message ? NT_BEEP : 0;
}
if (config_setting_lookup_bool(setting, ui_strings.beep_on_filetrans, &s->beep_on_filetrans)) {
s->beep_on_filetrans = s->beep_on_filetrans ? NT_BEEP : 0;
if (config_setting_lookup_bool(setting, ui_strings.bell_on_filetrans, &s->bell_on_filetrans)) {
s->bell_on_filetrans = s->bell_on_filetrans ? NT_BEEP : 0;
}
if (config_setting_lookup_bool(setting, ui_strings.beep_on_filetrans_accept, &s->beep_on_filetrans_accept)) {
s->beep_on_filetrans_accept = s->beep_on_filetrans_accept ? NT_BEEP : 0;
if (config_setting_lookup_bool(setting, ui_strings.bell_on_filetrans_accept, &s->bell_on_filetrans_accept)) {
s->bell_on_filetrans_accept = s->bell_on_filetrans_accept ? NT_BEEP : 0;
}
if (config_setting_lookup_bool(setting, ui_strings.beep_on_invite, &s->beep_on_invite)) {
s->beep_on_invite = s->beep_on_invite ? NT_BEEP : 0;
if (config_setting_lookup_bool(setting, ui_strings.bell_on_invite, &s->bell_on_invite)) {
s->bell_on_invite = s->bell_on_invite ? NT_BEEP : 0;
}
config_setting_lookup_bool(setting, ui_strings.autolog, &s->autolog);

View File

@ -38,10 +38,10 @@ struct user_settings {
int alerts; /* boolean */
/* boolean (is set to NT_BEEP or 0 after loading) */
int beep_on_message;
int beep_on_filetrans;
int beep_on_filetrans_accept;
int beep_on_invite;
int bell_on_message;
int bell_on_filetrans;
int bell_on_filetrans_accept;
int bell_on_invite;
int timestamps; /* boolean */
char timestamp_format[TIME_STR_SIZE];