summaryrefslogtreecommitdiff
path: root/src/core/wee-config.c
diff options
context:
space:
mode:
authorSimmo Saan <simmo.saan@gmail.com>2019-04-13 14:45:53 +0200
committerSébastien Helleu <flashcode@flashtux.org>2019-04-13 14:45:53 +0200
commit97e90469187d1a03d8abbb636f0c30f40d07c713 (patch)
treee6e3961dbb5f51a02c7674a0f45245897ed86375 /src/core/wee-config.c
parent63c992922cb386b203680b05d4f1d24ed3442bca (diff)
downloadweechat-97e90469187d1a03d8abbb636f0c30f40d07c713.zip
core: add option weechat.look.buffer_time_same (closes #1127)
Diffstat (limited to 'src/core/wee-config.c')
-rw-r--r--src/core/wee-config.c42
1 files changed, 42 insertions, 0 deletions
diff --git a/src/core/wee-config.c b/src/core/wee-config.c
index c11d8dbe1..f635b7cf2 100644
--- a/src/core/wee-config.c
+++ b/src/core/wee-config.c
@@ -98,6 +98,7 @@ struct t_config_option *config_look_buffer_search_force_default;
struct t_config_option *config_look_buffer_search_regex;
struct t_config_option *config_look_buffer_search_where;
struct t_config_option *config_look_buffer_time_format;
+struct t_config_option *config_look_buffer_time_same;
struct t_config_option *config_look_color_basic_force_bold;
struct t_config_option *config_look_color_inactive_buffer;
struct t_config_option *config_look_color_inactive_message;
@@ -319,6 +320,7 @@ char **config_nick_colors = NULL;
int config_num_nick_colors = 0;
struct t_hashtable *config_hashtable_nick_color_force = NULL;
char *config_item_time_evaluated = NULL;
+char *config_buffer_time_same_evaluated = NULL;
struct t_hashtable *config_hashtable_completion_partial_templates = NULL;
@@ -658,6 +660,27 @@ config_change_buffer_time_format (const void *pointer, void *data,
}
/*
+ * Callback for changes on option "weechat.look.buffer_time_same".
+ */
+
+void
+config_change_buffer_time_same (const void *pointer, void *data,
+ struct t_config_option *option)
+{
+ /* make C compiler happy */
+ (void) pointer;
+ (void) data;
+ (void) option;
+
+ if (config_buffer_time_same_evaluated)
+ free (config_buffer_time_same_evaluated);
+ config_buffer_time_same_evaluated = eval_expression (
+ CONFIG_STRING(config_look_buffer_time_same), NULL, NULL, NULL);
+
+ gui_window_ask_refresh (1);
+}
+
+/*
* Computes the "prefix_max_length" on all buffers.
*/
@@ -2664,6 +2687,19 @@ config_weechat_init_options ()
NULL, NULL, NULL,
&config_change_buffer_time_format, NULL, NULL,
NULL, NULL, NULL);
+ config_look_buffer_time_same = config_file_new_option (
+ weechat_config_file, ptr_section,
+ "buffer_time_same", "string",
+ /* TRANSLATORS: string "${color:xxx}" must NOT be translated */
+ N_("time displayed for a message with same time as previous message: "
+ "use a space \" \" to hide time, another string to display this "
+ "string instead of time, or an empty string to disable feature "
+ "(always display time) (note: content is evaluated, so you can use "
+ "colors with format \"${color:xxx}\", see /help eval)"),
+ NULL, 0, 0, "", NULL, 0,
+ NULL, NULL, NULL,
+ &config_change_buffer_time_same, NULL, NULL,
+ NULL, NULL, NULL);
config_look_color_basic_force_bold = config_file_new_option (
weechat_config_file, ptr_section,
"color_basic_force_bold", "boolean",
@@ -4694,6 +4730,12 @@ config_weechat_free ()
config_item_time_evaluated = NULL;
}
+ if (config_buffer_time_same_evaluated)
+ {
+ free (config_buffer_time_same_evaluated);
+ config_buffer_time_same_evaluated = NULL;
+ }
+
if (config_hashtable_completion_partial_templates)
{
hashtable_free (config_hashtable_completion_partial_templates);