1
0
mirror of https://github.com/Tha14/toxic.git synced 2024-11-22 09:23:02 +01:00

Add settings option to disable friend connection change notifications

This commit is contained in:
Jfreegman 2016-02-25 17:06:49 -05:00
parent 93835f0455
commit a474e3bf39
No known key found for this signature in database
GPG Key ID: 3627F3144076AE63
8 changed files with 39 additions and 7 deletions

View File

@ -2,12 +2,12 @@
.\" Title: toxic
.\" Author: [see the "AUTHORS" section]
.\" Generator: DocBook XSL Stylesheets v1.78.1 <http://docbook.sf.net/>
.\" Date: 2015-07-08
.\" Date: 2015-12-07
.\" Manual: Toxic Manual
.\" Source: toxic __VERSION__
.\" Language: English
.\"
.TH "TOXIC" "1" "2015\-07\-08" "toxic __VERSION__" "Toxic Manual"
.TH "TOXIC" "1" "2015\-12\-07" "toxic __VERSION__" "Toxic Manual"
.\" -----------------------------------------------------------------
.\" * Define some portability stuff
.\" -----------------------------------------------------------------
@ -70,7 +70,7 @@ Encrypt an unencrypted data file\&. An error will occur if this option is used w
Use specified
\fIdata\-file\fR
instead of
\fI~/\&.config/tox/toxic_profile.tox\fR
\fI~/\&.config/tox/toxic_profile\&.tox\fR
.RE
.PP
\-h, \-\-help
@ -127,7 +127,7 @@ __DATADIR__/DHTnodes
Default list of DHT bootstrap nodes\&.
.RE
.PP
~/\&.config/tox/toxic_profile.tox
~/\&.config/tox/toxic_profile\&.tox
.RS 4
Savestate which contains your personal info (nickname, Tox ID, contacts, etc)
.RE

View File

@ -2,12 +2,12 @@
.\" Title: toxic.conf
.\" Author: [see the "AUTHORS" section]
.\" Generator: DocBook XSL Stylesheets v1.78.1 <http://docbook.sf.net/>
.\" Date: 2015-03-28
.\" Date: 2016-01-19
.\" Manual: Toxic Manual
.\" Source: toxic __VERSION__
.\" Language: English
.\"
.TH "TOXIC\&.CONF" "5" "2015\-03\-28" "toxic __VERSION__" "Toxic Manual"
.TH "TOXIC\&.CONF" "5" "2016\-01\-19" "toxic __VERSION__" "Toxic Manual"
.\" -----------------------------------------------------------------
.\" * Define some portability stuff
.\" -----------------------------------------------------------------
@ -113,6 +113,11 @@ Show others when you\(cqre typing in a 1\-on\-1 chat\&. true or false
Show welcome message on startup\&. true or false
.RE
.PP
\fBshow_connection_msg\fR
.RS 4
Enable friend connection change notifications\&. true or false
.RE
.PP
\fBhistory_size\fR
.RS 4
Maximum lines for chat window history\&. Integer value\&. (for example: 700)
@ -189,6 +194,11 @@ Path for your avatar (file must be a \&.png and cannot exceed 16\&.3 KiB)
.RS 4
Default path for chatlogs\&. String value\&. Absolute path for chatlog files\&.
.RE
.PP
\fBpassword_eval\fR
.RS 4
Replace password prompt by running this command and using its output as the password\&.
.RE
.RE
.PP
\fBsounds\fR

View File

@ -71,6 +71,9 @@ OPTIONS
*show_welcome_msg*;;
Show welcome message on startup. true or false
*show_connection_msg*;;
Enable friend connection change notifications. true or false
*history_size*;;
Maximum lines for chat window history. Integer value. (for example: 700)

View File

@ -29,6 +29,9 @@ ui = {
// true to show the welcome message on startup
show_welcome_msg=true;
// true to show friend connection change messages on the home screen
show_connection_msg=true;
// maximum lines for chat window history
history_size=700;
@ -57,7 +60,7 @@ audio = {
// preferred audio output device; numbers correspond to /lsdev out
output_device=0;
// default VAD treshold; float (recommended values are around 40)
VAD_treshold=40.0;
};

View File

@ -215,6 +215,10 @@ static void chat_onConnectionChange(ToxWindow *self, Tox *m, uint32_t num, TOX_C
char nick[TOX_MAX_NAME_LENGTH];
get_nick_truncate(m, nick, num);
if (user_settings->show_connection_msg == SHOW_WELCOME_MSG_OFF) {
return;
}
if (connection_status != TOX_CONNECTION_NONE && statusbar->connection == TOX_CONNECTION_NONE) {
Friends.list[num].is_typing = user_settings->show_typing_other == SHOW_TYPING_ON
? tox_friend_get_typing(m, num, NULL) : false;

View File

@ -383,6 +383,10 @@ static void prompt_onConnectionChange(ToxWindow *self, Tox *m, uint32_t friendnu
get_time_str(timefrmt, sizeof(timefrmt));
const char *msg;
if (user_settings->show_connection_msg == SHOW_WELCOME_MSG_OFF) {
return;
}
if (connection_status != TOX_CONNECTION_NONE && Friends.list[friendnum].connection_status == TOX_CONNECTION_NONE) {
msg = "has come online";
line_info_add(self, timefrmt, nick, NULL, CONNECTION, 0, GREEN, msg);

View File

@ -57,6 +57,7 @@ static struct ui_strings {
const char* show_typing_self;
const char* show_typing_other;
const char* show_welcome_msg;
const char* show_connection_msg;
const char* line_join;
const char* line_quit;
@ -78,6 +79,7 @@ static struct ui_strings {
"show_typing_self",
"show_typing_other",
"show_welcome_msg",
"show_connection_msg",
"line_join",
"line_quit",
"line_alert",
@ -99,6 +101,7 @@ static void ui_defaults(struct user_settings* settings)
settings->show_typing_self = SHOW_TYPING_ON;
settings->show_typing_other = SHOW_TYPING_ON;
settings->show_welcome_msg = SHOW_WELCOME_MSG_ON;
settings->show_connection_msg = SHOW_CONNECTION_MSG_ON;
snprintf(settings->line_join, LINE_HINT_MAX + 1, "%s", LINE_JOIN);
snprintf(settings->line_quit, LINE_HINT_MAX + 1, "%s", LINE_QUIT);
@ -311,6 +314,7 @@ int settings_load(struct user_settings *s, const char *patharg)
config_setting_lookup_bool(setting, ui_strings.show_typing_self, &s->show_typing_self);
config_setting_lookup_bool(setting, ui_strings.show_typing_other, &s->show_typing_other);
config_setting_lookup_bool(setting, ui_strings.show_welcome_msg, &s->show_welcome_msg);
config_setting_lookup_bool(setting, ui_strings.show_connection_msg, &s->show_connection_msg);
if ( config_setting_lookup_string(setting, ui_strings.line_join, &str) ) {
snprintf(s->line_join, sizeof(s->line_join), "%s", str);

View File

@ -46,6 +46,7 @@ struct user_settings {
int show_typing_self; /* boolean */
int show_typing_other; /* boolean */
int show_welcome_msg; /* boolean */
int show_connection_msg; /* boolean */
char line_join[LINE_HINT_MAX + 1];
char line_quit[LINE_HINT_MAX + 1];
@ -97,6 +98,9 @@ enum {
SHOW_WELCOME_MSG_OFF = 0,
SHOW_WELCOME_MSG_ON = 1,
SHOW_CONNECTION_MSG_OFF = 0,
SHOW_CONNECTION_MSG_ON = 1,
DFLT_HST_SIZE = 700,
MPLEX_OFF = 0,