summaryrefslogtreecommitdiff
path: root/src/core
diff options
context:
space:
mode:
authorSebastien Helleu <flashcode@flashtux.org>2010-12-07 19:43:19 +0100
committerSebastien Helleu <flashcode@flashtux.org>2010-12-07 19:43:19 +0100
commitb6662ee3cf9f3401e8af58fb14d0b33a88906b67 (patch)
tree1764b7811ecfd75556832391db8e9dd9abf18391 /src/core
parentf7d719f8fdda73c9ef4ea1aa020e1767585c78a8 (diff)
downloadweechat-b6662ee3cf9f3401e8af58fb14d0b33a88906b67.zip
Add color support in option weechat.look.buffer_time_format
Diffstat (limited to 'src/core')
-rw-r--r--src/core/wee-config.c6
-rw-r--r--src/core/wee-util.c21
-rw-r--r--src/core/wee-util.h1
3 files changed, 4 insertions, 24 deletions
diff --git a/src/core/wee-config.c b/src/core/wee-config.c
index 07865c785..e101fbd04 100644
--- a/src/core/wee-config.c
+++ b/src/core/wee-config.c
@@ -280,7 +280,7 @@ config_change_buffer_time_format (void *data, struct t_config_option *option)
(void) data;
(void) option;
- gui_chat_time_length = util_get_time_length (CONFIG_STRING(config_look_buffer_time_format));
+ gui_chat_time_length = gui_chat_get_time_length ();
gui_chat_change_time_format ();
if (gui_ok)
gui_window_ask_refresh (1);
@@ -1327,7 +1327,9 @@ config_weechat_init_options ()
weechat_config_file, ptr_section,
"buffer_time_format", "string",
N_("time format for each line displayed in buffers (see man strftime "
- "for date/time specifiers)"),
+ "for date/time specifiers), colors are allowed with format "
+ "\"${color}\", for example french time: "
+ "\"${lightblue}%H${white}%M${lightred}%S\""),
NULL, 0, 0, "%H:%M:%S", NULL, 0, NULL, NULL, &config_change_buffer_time_format, NULL, NULL, NULL);
config_look_color_nicks_number = config_file_new_option (
weechat_config_file, ptr_section,
diff --git a/src/core/wee-util.c b/src/core/wee-util.c
index 8d8fe4429..a1eaf29fa 100644
--- a/src/core/wee-util.c
+++ b/src/core/wee-util.c
@@ -106,27 +106,6 @@ util_timeval_add (struct timeval *tv, long interval)
}
/*
- * util_get_time_length: calculates time length with a time format
- */
-
-int
-util_get_time_length (const char *time_format)
-{
- time_t date;
- struct tm *local_time;
- char text_time[1024];
-
- if (!time_format || !time_format[0])
- return 0;
-
- date = time (NULL);
- local_time = localtime (&date);
- strftime (text_time, sizeof (text_time),
- time_format, local_time);
- return strlen (text_time);
-}
-
-/*
* util_get_time_string: converts date to a string, using format of option
* weechat.look.time_format (can be localized)
*/
diff --git a/src/core/wee-util.h b/src/core/wee-util.h
index 497e43aa2..9f87f1c52 100644
--- a/src/core/wee-util.h
+++ b/src/core/wee-util.h
@@ -23,7 +23,6 @@
extern int util_timeval_cmp (struct timeval *tv1, struct timeval *tv2);
extern long util_timeval_diff (struct timeval *tv1, struct timeval *tv2);
extern void util_timeval_add (struct timeval *tv, long interval);
-extern int util_get_time_length (const char *time_format);
extern char *util_get_time_string (const time_t *date);
extern void util_catch_signal (int signum, void (*handler)(int));
extern int util_mkdir_home (const char *directory, int mode);