summaryrefslogtreecommitdiff
path: root/src/plugins/buflist
diff options
context:
space:
mode:
authorSébastien Helleu <flashcode@flashtux.org>2017-03-18 15:19:29 +0100
committerSébastien Helleu <flashcode@flashtux.org>2017-03-25 14:19:48 +0100
commit7f69f88468ff0b4dd805122383e1de2e058605e9 (patch)
treeb02d3318a4ef30a62dc89b25b5f076034822bab7 /src/plugins/buflist
parent196319170043fddfd701c5f1014be1c058fc5597 (diff)
downloadweechat-7f69f88468ff0b4dd805122383e1de2e058605e9.zip
buflist: add option "buflist.format.lag" and variable "format_lag" for buffer line format
Diffstat (limited to 'src/plugins/buflist')
-rw-r--r--src/plugins/buflist/buflist-bar-item.c14
-rw-r--r--src/plugins/buflist/buflist-config.c11
-rw-r--r--src/plugins/buflist/buflist-config.h1
3 files changed, 26 insertions, 0 deletions
diff --git a/src/plugins/buflist/buflist-bar-item.c b/src/plugins/buflist/buflist-bar-item.c
index 9a4ab5045..ce8cc4a76 100644
--- a/src/plugins/buflist/buflist-bar-item.c
+++ b/src/plugins/buflist/buflist-bar-item.c
@@ -57,6 +57,7 @@ buflist_bar_item_buflist_cb (const void *pointer, void *data,
const char *hotlist_priority_none = "none";
const char *hotlist_priority[4] = { "low", "message", "private",
"highlight" };
+ const char *ptr_lag;
int i, length_max_number, current_buffer, number, prev_number, priority;
int rc;
@@ -166,6 +167,19 @@ buflist_bar_item_buflist_cb (const void *pointer, void *data,
"color_hotlist", ptr_hotlist_format);
weechat_hashtable_set (buflist_hashtable_extra_vars,
"hotlist_priority", ptr_hotlist_priority);
+ ptr_lag = weechat_buffer_get_string (ptr_buffer, "localvar_lag");
+ if (ptr_lag && ptr_lag[0])
+ {
+ weechat_hashtable_set (
+ buflist_hashtable_extra_vars,
+ "format_lag",
+ weechat_config_string (buflist_config_format_lag));
+ }
+ else
+ {
+ weechat_hashtable_set (buflist_hashtable_extra_vars,
+ "format_lag", "");
+ }
/* build string */
line = weechat_string_eval_expression (
diff --git a/src/plugins/buflist/buflist-config.c b/src/plugins/buflist/buflist-config.c
index 70bc30d21..65e518108 100644
--- a/src/plugins/buflist/buflist-config.c
+++ b/src/plugins/buflist/buflist-config.c
@@ -39,6 +39,7 @@ struct t_config_option *buflist_config_format_buffer;
struct t_config_option *buflist_config_format_buffer_current;
struct t_config_option *buflist_config_format_hotlist[4];
struct t_config_option *buflist_config_format_hotlist_none;
+struct t_config_option *buflist_config_format_lag;
char **buflist_config_sort_fields = NULL;
int buflist_config_sort_fields_count = 0;
@@ -212,6 +213,16 @@ buflist_config_init ()
NULL, NULL, NULL,
&buflist_config_change_buflist, NULL, NULL,
NULL, NULL, NULL);
+ buflist_config_format_lag = weechat_config_new_option (
+ buflist_config_file, ptr_section,
+ "lag", "string",
+ N_("format for lag on an irc server buffer"),
+ NULL, 0, 0,
+ " ${color:green}[${color:brown}${lag}${color:green}]",
+ NULL, 0,
+ NULL, NULL, NULL,
+ &buflist_config_change_buflist, NULL, NULL,
+ NULL, NULL, NULL);
return 1;
}
diff --git a/src/plugins/buflist/buflist-config.h b/src/plugins/buflist/buflist-config.h
index 61c9bf35a..584153d81 100644
--- a/src/plugins/buflist/buflist-config.h
+++ b/src/plugins/buflist/buflist-config.h
@@ -28,6 +28,7 @@ extern struct t_config_option *buflist_config_format_buffer;
extern struct t_config_option *buflist_config_format_buffer_current;
extern struct t_config_option *buflist_config_format_hotlist[4];
extern struct t_config_option *buflist_config_format_hotlist_none;
+extern struct t_config_option *buflist_config_format_lag;
extern char **buflist_config_sort_fields;
extern int buflist_config_sort_fields_count;