1
0
mirror of https://github.com/Tha14/toxic.git synced 2024-06-26 20:37:46 +02:00

add setting to disable welcome message

This commit is contained in:
Jfreegman 2014-09-19 01:06:18 -04:00
parent daf4614ba6
commit 9ee7a48910
8 changed files with 27 additions and 7 deletions

View File

@ -2,12 +2,12 @@
.\" Title: toxic .\" Title: toxic
.\" Author: [see the "AUTHORS" section] .\" Author: [see the "AUTHORS" section]
.\" Generator: DocBook XSL Stylesheets v1.78.1 <http://docbook.sf.net/> .\" Generator: DocBook XSL Stylesheets v1.78.1 <http://docbook.sf.net/>
.\" Date: 2014-09-15 .\" Date: 2014-09-19
.\" Manual: Toxic Manual .\" Manual: Toxic Manual
.\" Source: toxic __VERSION__ .\" Source: toxic __VERSION__
.\" Language: English .\" Language: English
.\" .\"
.TH "TOXIC" "1" "2014\-09\-15" "toxic __VERSION__" "Toxic Manual" .TH "TOXIC" "1" "2014\-09\-19" "toxic __VERSION__" "Toxic Manual"
.\" ----------------------------------------------------------------- .\" -----------------------------------------------------------------
.\" * Define some portability stuff .\" * Define some portability stuff
.\" ----------------------------------------------------------------- .\" -----------------------------------------------------------------
@ -62,7 +62,7 @@ Use default locale
.PP .PP
\-e, \-\-encrypt\-data \-e, \-\-encrypt\-data
.RS 4 .RS 4
Encrypt an unencrypted data file\&. An error will occur if this option is used with a non\-existent or encrypted data file\&. Encrypt an unencrypted data file\&. An error will occur if this option is used with an encrypted data file\&.
.RE .RE
.PP .PP
\-f, \-\-file data\-file \-f, \-\-file data\-file

View File

@ -32,7 +32,7 @@ OPTIONS
-e, --encrypt-data:: -e, --encrypt-data::
Encrypt an unencrypted data file. An error will occur if this option Encrypt an unencrypted data file. An error will occur if this option
is used with a non-existent or encrypted data file. is used with an encrypted data file.
-f, --file data-file:: -f, --file data-file::
Use specified 'data-file' instead of '~/.config/tox/data' Use specified 'data-file' instead of '~/.config/tox/data'

View File

@ -2,12 +2,12 @@
.\" Title: toxic.conf .\" Title: toxic.conf
.\" Author: [see the "AUTHORS" section] .\" Author: [see the "AUTHORS" section]
.\" Generator: DocBook XSL Stylesheets v1.78.1 <http://docbook.sf.net/> .\" Generator: DocBook XSL Stylesheets v1.78.1 <http://docbook.sf.net/>
.\" Date: 2014-08-21 .\" Date: 2014-08-26
.\" Manual: Toxic Manual .\" Manual: Toxic Manual
.\" Source: toxic __VERSION__ .\" Source: toxic __VERSION__
.\" Language: English .\" Language: English
.\" .\"
.TH "TOXIC\&.CONF" "5" "2014\-08\-21" "toxic __VERSION__" "Toxic Manual" .TH "TOXIC\&.CONF" "5" "2014\-08\-26" "toxic __VERSION__" "Toxic Manual"
.\" ----------------------------------------------------------------- .\" -----------------------------------------------------------------
.\" * Define some portability stuff .\" * Define some portability stuff
.\" ----------------------------------------------------------------- .\" -----------------------------------------------------------------
@ -96,6 +96,11 @@ Show when others are typing in a 1\-on\-1 chat\&. true or false
Show others when you\(cqre typing in a 1\-on\-1 chat\&. true or false Show others when you\(cqre typing in a 1\-on\-1 chat\&. true or false
.RE .RE
.PP .PP
\fBshow_welcome_msg\fR
.RS 4
Show welcome message on startup\&. true or false
.RE
.PP
\fBhistory_size\fR \fBhistory_size\fR
.RS 4 .RS 4
Maximum lines for chat window history\&. Integer value\&. (for example: 700) Maximum lines for chat window history\&. Integer value\&. (for example: 700)

View File

@ -60,6 +60,9 @@ OPTIONS
*show_typing_self*;; *show_typing_self*;;
Show others when you're typing in a 1-on-1 chat. true or false Show others when you're typing in a 1-on-1 chat. true or false
*show_welcome_msg*;;
Show welcome message on startup. true or false
*history_size*;; *history_size*;;
Maximum lines for chat window history. Integer value. (for example: 700) Maximum lines for chat window history. Integer value. (for example: 700)

View File

@ -23,6 +23,9 @@ ui = {
// true to show others when you're typing a message in 1-on-1 chats // true to show others when you're typing a message in 1-on-1 chats
show_typing_self=true; show_typing_self=true;
// true to show the welcome message on startup
show_welcome_msg=true;
// maximum lines for chat window history // maximum lines for chat window history
history_size=700; history_size=700;
}; };

View File

@ -464,7 +464,8 @@ static void prompt_onInit(ToxWindow *self, Tox *m)
scrollok(ctx->history, 0); scrollok(ctx->history, 0);
wmove(self->window, y2 - CURS_Y_OFFSET, 0); wmove(self->window, y2 - CURS_Y_OFFSET, 0);
print_welcome_msg(self); if (user_settings_->show_welcome_msg == SHOW_WELCOME_MSG_ON)
print_welcome_msg(self);
} }
ToxWindow new_prompt(void) ToxWindow new_prompt(void)

View File

@ -54,6 +54,7 @@ static struct _ui_strings {
const char* history_size; const char* history_size;
const char* show_typing_self; const char* show_typing_self;
const char* show_typing_other; const char* show_typing_other;
const char* show_welcome_msg;
} ui_strings = { } ui_strings = {
"ui", "ui",
"timestamps", "timestamps",
@ -64,6 +65,7 @@ static struct _ui_strings {
"history_size", "history_size",
"show_typing_self", "show_typing_self",
"show_typing_other", "show_typing_other",
"show_welcome_msg",
}; };
static void ui_defaults(struct user_settings* settings) static void ui_defaults(struct user_settings* settings)
@ -76,6 +78,7 @@ static void ui_defaults(struct user_settings* settings)
settings->history_size = 700; settings->history_size = 700;
settings->show_typing_self = SHOW_TYPING_ON; settings->show_typing_self = SHOW_TYPING_ON;
settings->show_typing_other = SHOW_TYPING_ON; settings->show_typing_other = SHOW_TYPING_ON;
settings->show_welcome_msg = SHOW_WELCOME_MSG_ON;
} }
static const struct _keys_strings { static const struct _keys_strings {
@ -250,6 +253,7 @@ int settings_load(struct user_settings *s, const char *patharg)
config_setting_lookup_int(setting, ui_strings.history_size, &s->history_size); config_setting_lookup_int(setting, ui_strings.history_size, &s->history_size);
config_setting_lookup_bool(setting, ui_strings.show_typing_self, &s->show_typing_self); 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_typing_other, &s->show_typing_other);
config_setting_lookup_bool(setting, ui_strings.show_welcome_msg, &s->show_welcome_msg);
config_setting_lookup_int(setting, ui_strings.time_format, &s->time); config_setting_lookup_int(setting, ui_strings.time_format, &s->time);
s->time = s->time == TIME_24 || s->time == TIME_12 ? s->time : TIME_24; /* Check defaults */ s->time = s->time == TIME_24 || s->time == TIME_12 ? s->time : TIME_24; /* Check defaults */
} }

View File

@ -35,6 +35,7 @@ struct user_settings {
int history_size; /* int between MIN_HISTORY and MAX_HISTORY */ int history_size; /* int between MIN_HISTORY and MAX_HISTORY */
int show_typing_self; /* boolean */ int show_typing_self; /* boolean */
int show_typing_other; /* boolean */ int show_typing_other; /* boolean */
int show_welcome_msg; /* boolean */
char download_path[PATH_MAX]; char download_path[PATH_MAX];
char chatlogs_path[PATH_MAX]; char chatlogs_path[PATH_MAX];
@ -74,6 +75,9 @@ enum {
SHOW_TYPING_OFF = 0, SHOW_TYPING_OFF = 0,
SHOW_TYPING_ON = 1, SHOW_TYPING_ON = 1,
SHOW_WELCOME_MSG_OFF = 0,
SHOW_WELCOME_MSG_ON = 1,
DFLT_HST_SIZE = 700, DFLT_HST_SIZE = 700,
} settings_values; } settings_values;