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

add setting option to disable timestamps

This commit is contained in:
Jfreegman
2014-06-28 20:33:46 -04:00
parent a2e6a25fc8
commit 97536d2a72
5 changed files with 33 additions and 3 deletions

View File

@ -36,6 +36,7 @@
static void uset_autolog(struct user_settings *s, const char *val);
static void uset_time(struct user_settings *s, const char *val);
static void uset_timestamps(struct user_settings *s, const char *val);
static void uset_alerts(struct user_settings *s, const char *val);
static void uset_colours(struct user_settings *s, const char *val);
static void uset_hst_size(struct user_settings *s, const char *val);
@ -52,6 +53,7 @@ struct {
} user_settings_list[] = {
{ "autolog", uset_autolog },
{ "time", uset_time },
{ "timestamps", uset_timestamps },
{ "disable_alerts", uset_alerts },
{ "colour_theme", uset_colours },
{ "history_size", uset_hst_size },
@ -79,6 +81,14 @@ static void uset_time(struct user_settings *s, const char *val)
s->time = n == TIME_12 ? TIME_12 : TIME_24;
}
static void uset_timestamps(struct user_settings *s, const char *val)
{
int n = atoi(val);
/* default on if invalid value */
s->timestamps = n == TIMESTAMPS_OFF ? TIMESTAMPS_OFF : TIMESTAMPS_ON;
}
static void uset_alerts(struct user_settings *s, const char *val)
{
int n = atoi(val);
@ -155,6 +165,7 @@ static void set_default_settings(struct user_settings *s)
/* see settings_values enum in settings.h for defaults */
uset_autolog(s, "0");
uset_time(s, "24");
uset_timestamps(s, "1");
uset_alerts(s, "0");
uset_colours(s, "0");
uset_hst_size(s, "700");