summaryrefslogtreecommitdiff
path: root/src/plugins
diff options
context:
space:
mode:
authorSébastien Helleu <flashcode@flashtux.org>2017-04-25 20:31:08 +0200
committerSébastien Helleu <flashcode@flashtux.org>2017-04-25 20:31:08 +0200
commita10b2bc36ae9ef154e213a06521fea3e84963885 (patch)
tree82c526a7c85e6ea8aab43e82ea3618013a5cdf45 /src/plugins
parent49cdbaab38bbd6e4d0340e2b77bcde10c6068e36 (diff)
downloadweechat-a10b2bc36ae9ef154e213a06521fea3e84963885.zip
buflist: add option buflist.format.nick_prefix
Diffstat (limited to 'src/plugins')
-rw-r--r--src/plugins/buflist/buflist-bar-item.c18
-rw-r--r--src/plugins/buflist/buflist-command.c8
-rw-r--r--src/plugins/buflist/buflist-config.c12
-rw-r--r--src/plugins/buflist/buflist-config.h1
4 files changed, 32 insertions, 7 deletions
diff --git a/src/plugins/buflist/buflist-bar-item.c b/src/plugins/buflist/buflist-bar-item.c
index 218b9bb6f..5220a23d5 100644
--- a/src/plugins/buflist/buflist-bar-item.c
+++ b/src/plugins/buflist/buflist-bar-item.c
@@ -54,7 +54,7 @@ buflist_bar_item_buflist_cb (const void *pointer, void *data,
struct t_gui_hotlist *ptr_hotlist;
char **buflist, *str_buflist, *condition;
char str_format_number[32], str_format_number_empty[32];
- char str_nick_prefix[32];
+ char str_nick_prefix[32], str_color_nick_prefix[32];
char str_number[32], *line, **hotlist, *str_hotlist;
char str_hotlist_count[32];
const char *ptr_format, *ptr_format_current, *ptr_format_indent;
@@ -172,6 +172,7 @@ buflist_bar_item_buflist_cb (const void *pointer, void *data,
/* nick prefix */
str_nick_prefix[0] = '\0';
+ str_color_nick_prefix[0] = '\0';
if (is_channel
&& weechat_config_boolean (buflist_config_look_nick_prefix))
{
@@ -190,12 +191,15 @@ buflist_bar_item_buflist_cb (const void *pointer, void *data,
ptr_buffer, ptr_gui_nick, "prefix");
if (ptr_nick_prefix && (ptr_nick_prefix[0] != ' '))
{
- snprintf (str_nick_prefix, sizeof (str_nick_prefix),
- "%s%s",
+ snprintf (str_color_nick_prefix,
+ sizeof (str_color_nick_prefix),
+ "%s",
weechat_color (
weechat_nicklist_nick_get_string (
ptr_buffer, ptr_gui_nick,
- "prefix_color")),
+ "prefix_color")));
+ snprintf (str_nick_prefix, sizeof (str_nick_prefix),
+ "%s",
ptr_nick_prefix);
}
}
@@ -203,6 +207,12 @@ buflist_bar_item_buflist_cb (const void *pointer, void *data,
}
weechat_hashtable_set (buflist_hashtable_extra_vars,
"nick_prefix", str_nick_prefix);
+ weechat_hashtable_set (buflist_hashtable_extra_vars,
+ "color_nick_prefix", str_color_nick_prefix);
+ weechat_hashtable_set (buflist_hashtable_extra_vars,
+ "format_nick_prefix",
+ weechat_config_string (
+ buflist_config_format_nick_prefix));
/* set extra variables */
weechat_hashtable_set (buflist_hashtable_extra_vars,
diff --git a/src/plugins/buflist/buflist-command.c b/src/plugins/buflist/buflist-command.c
index 606117331..342b84f4c 100644
--- a/src/plugins/buflist/buflist-command.c
+++ b/src/plugins/buflist/buflist-command.c
@@ -100,8 +100,12 @@ buflist_command_init ()
" - ${indent}: indentation for name (channel and private "
"buffers are indented) (evaluation of "
"option buflist.format.indent)\n"
- " - ${nick_prefix}: nick prefix for a channel (set only "
- "if the option buflist.look.nick_prefix is enabled)\n"
+ " - ${format_nick_prefix}: colored nick prefix for a channel "
+ "(evaluation of option buflist.format.nick_prefix)\n"
+ " - ${color_nick_prefix}: color of nick prefix for a channel "
+ "(set only if the option buflist.look.nick_prefix is enabled)\n"
+ " - ${nick_prefix}: nick prefix for a channel "
+ "(set only if the option buflist.look.nick_prefix is enabled)\n"
" - ${name}: the short name (if set), with a fallback on the "
"name\n"
" - ${color_hotlist}: the color depending on the highest "
diff --git a/src/plugins/buflist/buflist-config.c b/src/plugins/buflist/buflist-config.c
index 0ae5dbc0b..9398b4d0e 100644
--- a/src/plugins/buflist/buflist-config.c
+++ b/src/plugins/buflist/buflist-config.c
@@ -51,6 +51,7 @@ struct t_config_option *buflist_config_format_hotlist_level_none;
struct t_config_option *buflist_config_format_hotlist_separator;
struct t_config_option *buflist_config_format_indent;
struct t_config_option *buflist_config_format_lag;
+struct t_config_option *buflist_config_format_nick_prefix;
struct t_config_option *buflist_config_format_number;
struct t_hook **buflist_config_signals_refresh = NULL;
@@ -395,7 +396,7 @@ buflist_config_init ()
N_("format of each line with a buffer "
"(note: content is evaluated, see /help buflist)"),
NULL, 0, 0,
- "${format_number}${indent}${nick_prefix}${color_hotlist}${name}",
+ "${format_number}${indent}${format_nick_prefix}${color_hotlist}${name}",
NULL, 0,
NULL, NULL, NULL,
&buflist_config_change_buflist, NULL, NULL,
@@ -494,6 +495,15 @@ buflist_config_init ()
NULL, NULL, NULL,
&buflist_config_change_buflist, NULL, NULL,
NULL, NULL, NULL);
+ buflist_config_format_nick_prefix = weechat_config_new_option (
+ buflist_config_file, ptr_section,
+ "nick_prefix", "string",
+ N_("format for nick prefix on a channel "
+ "(note: content is evaluated, see /help buflist)"),
+ NULL, 0, 0, "${color_nick_prefix}${nick_prefix}", NULL, 0,
+ NULL, NULL, NULL,
+ &buflist_config_change_buflist, NULL, NULL,
+ NULL, NULL, NULL);
buflist_config_format_number = weechat_config_new_option (
buflist_config_file, ptr_section,
"number", "string",
diff --git a/src/plugins/buflist/buflist-config.h b/src/plugins/buflist/buflist-config.h
index 36935235b..f80524c32 100644
--- a/src/plugins/buflist/buflist-config.h
+++ b/src/plugins/buflist/buflist-config.h
@@ -49,6 +49,7 @@ extern struct t_config_option *buflist_config_format_hotlist_level_none;
extern struct t_config_option *buflist_config_format_hotlist_separator;
extern struct t_config_option *buflist_config_format_indent;
extern struct t_config_option *buflist_config_format_lag;
+extern struct t_config_option *buflist_config_format_nick_prefix;
extern struct t_config_option *buflist_config_format_number;
extern char **buflist_config_sort_fields;