1
0
mirror of https://github.com/weechat/weechat.git synced 2026-07-04 08:43:13 +02:00

buflist: add option buflist.format.nick_prefix

This commit is contained in:
Sébastien Helleu
2017-04-25 20:31:08 +02:00
parent 49cdbaab38
commit a10b2bc36a
17 changed files with 190 additions and 22 deletions
+14 -4
View File
@@ -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,
+6 -2
View File
@@ -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 "
+11 -1
View File
@@ -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",
+1
View File
@@ -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;