mirror of
https://github.com/weechat/weechat.git
synced 2026-07-04 16:53:14 +02:00
Replace the 10 nick color options and number of nick colors by a single option "weechat.color.chat_nick_colors" (comma separated list of colors)
This commit is contained in:
+8
-67
@@ -78,7 +78,6 @@ struct t_config_option *config_startup_display_version;
|
||||
struct t_config_option *config_look_align_end_of_lines;
|
||||
struct t_config_option *config_look_buffer_notify_default;
|
||||
struct t_config_option *config_look_buffer_time_format;
|
||||
struct t_config_option *config_look_color_nicks_number;
|
||||
struct t_config_option *config_look_color_real_white;
|
||||
struct t_config_option *config_look_command_chars;
|
||||
struct t_config_option *config_look_confirm_quit;
|
||||
@@ -138,9 +137,9 @@ struct t_config_option *config_color_chat_buffer;
|
||||
struct t_config_option *config_color_chat_server;
|
||||
struct t_config_option *config_color_chat_channel;
|
||||
struct t_config_option *config_color_chat_nick;
|
||||
struct t_config_option *config_color_chat_nick_colors;
|
||||
struct t_config_option *config_color_chat_nick_self;
|
||||
struct t_config_option *config_color_chat_nick_other;
|
||||
struct t_config_option *config_color_chat_nick_colors[GUI_COLOR_NICK_NUMBER];
|
||||
struct t_config_option *config_color_chat_host;
|
||||
struct t_config_option *config_color_chat_delimiters;
|
||||
struct t_config_option *config_color_chat_highlight;
|
||||
@@ -1456,11 +1455,6 @@ config_weechat_init_options ()
|
||||
"\"${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,
|
||||
"color_nicks_number", "integer",
|
||||
N_("number of colors to use for nicks colors"),
|
||||
NULL, 1, 10, "10", NULL, 0, NULL, NULL, NULL, NULL, NULL, NULL);
|
||||
config_look_color_real_white = config_file_new_option (
|
||||
weechat_config_file, ptr_section,
|
||||
"color_real_white", "boolean",
|
||||
@@ -1869,6 +1863,13 @@ config_weechat_init_options ()
|
||||
N_("text color for nicks in chat window"),
|
||||
NULL, GUI_COLOR_CHAT_NICK, 0, "lightcyan", NULL, 0,
|
||||
NULL, NULL, &config_change_color, NULL, NULL, NULL);
|
||||
config_color_chat_nick_colors = config_file_new_option (
|
||||
weechat_config_file, ptr_section,
|
||||
"chat_nick_colors", "string",
|
||||
N_("text color for nicks (comma separated list of colors)"),
|
||||
NULL, 0, 0, "cyan,magenta,green,brown,lightblue,default,lightcyan,"
|
||||
"lightmagenta,lightgreen,blue", NULL, 0,
|
||||
NULL, NULL, NULL, NULL, NULL, NULL);
|
||||
config_color_chat_nick_self = config_file_new_option (
|
||||
weechat_config_file, ptr_section,
|
||||
"chat_nick_self", "color",
|
||||
@@ -1881,66 +1882,6 @@ config_weechat_init_options ()
|
||||
N_("text color for other nick in private buffer"),
|
||||
NULL, GUI_COLOR_CHAT_NICK_OTHER, 0, "cyan", NULL, 0,
|
||||
NULL, NULL, &config_change_color, NULL, NULL, NULL);
|
||||
config_color_chat_nick_colors[0] = config_file_new_option (
|
||||
weechat_config_file, ptr_section,
|
||||
"chat_nick_color01", "color",
|
||||
N_("text color #1 for nick"),
|
||||
NULL, GUI_COLOR_CHAT_NICK1, 0, "cyan", NULL, 0,
|
||||
NULL, NULL, &config_change_color, NULL, NULL, NULL);
|
||||
config_color_chat_nick_colors[1] = config_file_new_option (
|
||||
weechat_config_file, ptr_section,
|
||||
"chat_nick_color02", "color",
|
||||
N_("text color #2 for nick"),
|
||||
NULL, GUI_COLOR_CHAT_NICK2, 0, "magenta", NULL, 0,
|
||||
NULL, NULL, &config_change_color, NULL, NULL, NULL);
|
||||
config_color_chat_nick_colors[2] = config_file_new_option (
|
||||
weechat_config_file, ptr_section,
|
||||
"chat_nick_color03", "color",
|
||||
N_("text color #3 for nick"),
|
||||
NULL, GUI_COLOR_CHAT_NICK3, 0, "green", NULL, 0,
|
||||
NULL, NULL, &config_change_color, NULL, NULL, NULL);
|
||||
config_color_chat_nick_colors[3] = config_file_new_option (
|
||||
weechat_config_file, ptr_section,
|
||||
"chat_nick_color04", "color",
|
||||
N_("text color #4 for nick"),
|
||||
NULL, GUI_COLOR_CHAT_NICK4, 0, "brown", NULL, 0,
|
||||
NULL, NULL, &config_change_color, NULL, NULL, NULL);
|
||||
config_color_chat_nick_colors[4] = config_file_new_option (
|
||||
weechat_config_file, ptr_section,
|
||||
"chat_nick_color05", "color",
|
||||
N_("text color #5 for nick"),
|
||||
NULL, GUI_COLOR_CHAT_NICK5, 0, "lightblue", NULL, 0,
|
||||
NULL, NULL, &config_change_color, NULL, NULL, NULL);
|
||||
config_color_chat_nick_colors[5] = config_file_new_option (
|
||||
weechat_config_file, ptr_section,
|
||||
"chat_nick_color06", "color",
|
||||
N_("text color #6 for nick"),
|
||||
NULL, GUI_COLOR_CHAT_NICK6, 0, "default", NULL, 0,
|
||||
NULL, NULL, &config_change_color, NULL, NULL, NULL);
|
||||
config_color_chat_nick_colors[6] = config_file_new_option (
|
||||
weechat_config_file, ptr_section,
|
||||
"chat_nick_color07", "color",
|
||||
N_("text color #7 for nick"),
|
||||
NULL, GUI_COLOR_CHAT_NICK7, 0, "lightcyan", NULL, 0,
|
||||
NULL, NULL, &config_change_color, NULL, NULL, NULL);
|
||||
config_color_chat_nick_colors[7] = config_file_new_option (
|
||||
weechat_config_file, ptr_section,
|
||||
"chat_nick_color08", "color",
|
||||
N_("text color #8 for nick"),
|
||||
NULL, GUI_COLOR_CHAT_NICK8, 0, "lightmagenta", NULL, 0,
|
||||
NULL, NULL, &config_change_color, NULL, NULL, NULL);
|
||||
config_color_chat_nick_colors[8] = config_file_new_option (
|
||||
weechat_config_file, ptr_section,
|
||||
"chat_nick_color09", "color",
|
||||
N_("text color #9 for nick"),
|
||||
NULL, GUI_COLOR_CHAT_NICK9, 0, "lightgreen", NULL, 0,
|
||||
NULL, NULL, &config_change_color, NULL, NULL, NULL);
|
||||
config_color_chat_nick_colors[9] = config_file_new_option (
|
||||
weechat_config_file, ptr_section,
|
||||
"chat_nick_color10", "color",
|
||||
N_("text color #10 for nick"),
|
||||
NULL, GUI_COLOR_CHAT_NICK10, 0, "blue", NULL, 0,
|
||||
NULL, NULL, &config_change_color, NULL, NULL, NULL);
|
||||
config_color_chat_host = config_file_new_option (
|
||||
weechat_config_file, ptr_section,
|
||||
"chat_host", "color",
|
||||
|
||||
@@ -109,7 +109,6 @@ extern struct t_config_option *config_look_buffer_notify_default;
|
||||
extern struct t_config_option *config_look_buffer_time_format;
|
||||
extern struct t_config_option *config_look_command_chars;
|
||||
extern struct t_config_option *config_look_confirm_quit;
|
||||
extern struct t_config_option *config_look_color_nicks_number;
|
||||
extern struct t_config_option *config_look_color_real_white;
|
||||
extern struct t_config_option *config_look_day_change;
|
||||
extern struct t_config_option *config_look_day_change_time_format;
|
||||
@@ -165,9 +164,9 @@ extern struct t_config_option *config_color_chat_buffer;
|
||||
extern struct t_config_option *config_color_chat_server;
|
||||
extern struct t_config_option *config_color_chat_channel;
|
||||
extern struct t_config_option *config_color_chat_nick;
|
||||
extern struct t_config_option *config_color_chat_nick_colors;
|
||||
extern struct t_config_option *config_color_chat_nick_self;
|
||||
extern struct t_config_option *config_color_chat_nick_other;
|
||||
extern struct t_config_option *config_color_chat_nick_colors[];
|
||||
extern struct t_config_option *config_color_chat_host;
|
||||
extern struct t_config_option *config_color_chat_delimiters;
|
||||
extern struct t_config_option *config_color_chat_highlight;
|
||||
|
||||
@@ -225,6 +225,11 @@ gui_color_get_name (int num_color)
|
||||
void
|
||||
gui_color_build (int number, int foreground, int background)
|
||||
{
|
||||
if (foreground < 0)
|
||||
foreground = 0;
|
||||
if (background < 0)
|
||||
background = 0;
|
||||
|
||||
if (!gui_color[number])
|
||||
{
|
||||
gui_color[number] = malloc (sizeof (*gui_color[number]));
|
||||
@@ -370,8 +375,6 @@ gui_color_init_pairs ()
|
||||
void
|
||||
gui_color_init_weechat ()
|
||||
{
|
||||
int i;
|
||||
|
||||
gui_color_build (GUI_COLOR_SEPARATOR, CONFIG_COLOR(config_color_separator), CONFIG_COLOR(config_color_chat_bg));
|
||||
|
||||
gui_color_build (GUI_COLOR_CHAT, CONFIG_COLOR(config_color_chat), CONFIG_COLOR(config_color_chat_bg));
|
||||
@@ -390,10 +393,6 @@ gui_color_init_weechat ()
|
||||
gui_color_build (GUI_COLOR_CHAT_NICK, CONFIG_COLOR(config_color_chat_nick), CONFIG_COLOR(config_color_chat_bg));
|
||||
gui_color_build (GUI_COLOR_CHAT_NICK_SELF, CONFIG_COLOR(config_color_chat_nick_self), CONFIG_COLOR(config_color_chat_bg));
|
||||
gui_color_build (GUI_COLOR_CHAT_NICK_OTHER, CONFIG_COLOR(config_color_chat_nick_other), CONFIG_COLOR(config_color_chat_bg));
|
||||
for (i = 0; i < GUI_COLOR_NICK_NUMBER; i++)
|
||||
{
|
||||
gui_color_build (GUI_COLOR_CHAT_NICK1 + i, CONFIG_COLOR(config_color_chat_nick_colors[i]), CONFIG_COLOR(config_color_chat_bg));
|
||||
}
|
||||
gui_color_build (GUI_COLOR_CHAT_HOST, CONFIG_COLOR(config_color_chat_host), CONFIG_COLOR(config_color_chat_bg));
|
||||
gui_color_build (GUI_COLOR_CHAT_DELIMITERS, CONFIG_COLOR(config_color_chat_delimiters), CONFIG_COLOR(config_color_chat_bg));
|
||||
gui_color_build (GUI_COLOR_CHAT_HIGHLIGHT, CONFIG_COLOR(config_color_chat_highlight), CONFIG_COLOR(config_color_chat_highlight_bg));
|
||||
@@ -401,6 +400,23 @@ gui_color_init_weechat ()
|
||||
gui_color_build (GUI_COLOR_CHAT_TEXT_FOUND, CONFIG_COLOR(config_color_chat_text_found), CONFIG_COLOR(config_color_chat_text_found_bg));
|
||||
gui_color_build (GUI_COLOR_CHAT_VALUE, CONFIG_COLOR(config_color_chat_value), CONFIG_COLOR(config_color_chat_bg));
|
||||
gui_color_build (GUI_COLOR_CHAT_PREFIX_BUFFER, CONFIG_COLOR(config_color_chat_prefix_buffer), CONFIG_COLOR(config_color_chat_bg));
|
||||
|
||||
/*
|
||||
* define old nick colors for compatibility on /upgrade with previous
|
||||
* versions: these colors have been removed in version 0.3.4 and replaced
|
||||
* by new option "weechat.color.chat_nick_colors", which is a list of
|
||||
* colors (without limit on number of colors)
|
||||
*/
|
||||
gui_color_build (GUI_COLOR_CHAT_NICK1_OBSOLETE, gui_color_search ("cyan"), CONFIG_COLOR(config_color_chat_bg));
|
||||
gui_color_build (GUI_COLOR_CHAT_NICK2_OBSOLETE, gui_color_search ("magenta"), CONFIG_COLOR(config_color_chat_bg));
|
||||
gui_color_build (GUI_COLOR_CHAT_NICK3_OBSOLETE, gui_color_search ("green"), CONFIG_COLOR(config_color_chat_bg));
|
||||
gui_color_build (GUI_COLOR_CHAT_NICK4_OBSOLETE, gui_color_search ("brown"), CONFIG_COLOR(config_color_chat_bg));
|
||||
gui_color_build (GUI_COLOR_CHAT_NICK5_OBSOLETE, gui_color_search ("lightblue"), CONFIG_COLOR(config_color_chat_bg));
|
||||
gui_color_build (GUI_COLOR_CHAT_NICK6_OBSOLETE, gui_color_search ("default"), CONFIG_COLOR(config_color_chat_bg));
|
||||
gui_color_build (GUI_COLOR_CHAT_NICK7_OBSOLETE, gui_color_search ("lightcyan"), CONFIG_COLOR(config_color_chat_bg));
|
||||
gui_color_build (GUI_COLOR_CHAT_NICK8_OBSOLETE, gui_color_search ("lightmagenta"), CONFIG_COLOR(config_color_chat_bg));
|
||||
gui_color_build (GUI_COLOR_CHAT_NICK9_OBSOLETE, gui_color_search ("lightgreen"), CONFIG_COLOR(config_color_chat_bg));
|
||||
gui_color_build (GUI_COLOR_CHAT_NICK10_OBSOLETE, gui_color_search ("blue"), CONFIG_COLOR(config_color_chat_bg));
|
||||
}
|
||||
|
||||
/*
|
||||
|
||||
+14
-12
@@ -20,8 +20,6 @@
|
||||
#ifndef __WEECHAT_GUI_COLOR_H
|
||||
#define __WEECHAT_GUI_COLOR_H 1
|
||||
|
||||
#define GUI_COLOR_NICK_NUMBER 10
|
||||
|
||||
enum t_gui_color_enum
|
||||
{
|
||||
GUI_COLOR_SEPARATOR = 0,
|
||||
@@ -42,16 +40,20 @@ enum t_gui_color_enum
|
||||
GUI_COLOR_CHAT_NICK,
|
||||
GUI_COLOR_CHAT_NICK_SELF,
|
||||
GUI_COLOR_CHAT_NICK_OTHER,
|
||||
GUI_COLOR_CHAT_NICK1,
|
||||
GUI_COLOR_CHAT_NICK2,
|
||||
GUI_COLOR_CHAT_NICK3,
|
||||
GUI_COLOR_CHAT_NICK4,
|
||||
GUI_COLOR_CHAT_NICK5,
|
||||
GUI_COLOR_CHAT_NICK6,
|
||||
GUI_COLOR_CHAT_NICK7,
|
||||
GUI_COLOR_CHAT_NICK8,
|
||||
GUI_COLOR_CHAT_NICK9,
|
||||
GUI_COLOR_CHAT_NICK10,
|
||||
/*
|
||||
* following obsolete colors are kept here for compatibility
|
||||
* with WeeChat <= 0.3.3
|
||||
*/
|
||||
GUI_COLOR_CHAT_NICK1_OBSOLETE, /* not used any more since WeeChat 0.3.4 */
|
||||
GUI_COLOR_CHAT_NICK2_OBSOLETE, /* not used any more since WeeChat 0.3.4 */
|
||||
GUI_COLOR_CHAT_NICK3_OBSOLETE, /* not used any more since WeeChat 0.3.4 */
|
||||
GUI_COLOR_CHAT_NICK4_OBSOLETE, /* not used any more since WeeChat 0.3.4 */
|
||||
GUI_COLOR_CHAT_NICK5_OBSOLETE, /* not used any more since WeeChat 0.3.4 */
|
||||
GUI_COLOR_CHAT_NICK6_OBSOLETE, /* not used any more since WeeChat 0.3.4 */
|
||||
GUI_COLOR_CHAT_NICK7_OBSOLETE, /* not used any more since WeeChat 0.3.4 */
|
||||
GUI_COLOR_CHAT_NICK8_OBSOLETE, /* not used any more since WeeChat 0.3.4 */
|
||||
GUI_COLOR_CHAT_NICK9_OBSOLETE, /* not used any more since WeeChat 0.3.4 */
|
||||
GUI_COLOR_CHAT_NICK10_OBSOLETE, /* not used any more since WeeChat 0.3.4 */
|
||||
GUI_COLOR_CHAT_HOST,
|
||||
GUI_COLOR_CHAT_DELIMITERS,
|
||||
GUI_COLOR_CHAT_HIGHLIGHT,
|
||||
|
||||
@@ -68,13 +68,12 @@ demo_printf_command_cb (void *data, struct t_gui_buffer *buffer, int argc,
|
||||
_("%sdemo message with error prefix"),
|
||||
weechat_prefix ("error"));
|
||||
weechat_printf (buffer,
|
||||
_("colors: %s buffer %s nick1 %s nick2 %s nick3 "
|
||||
"%s nick4"),
|
||||
"%s: %s chat_buffer %s chat_server "
|
||||
"%s chat_host",
|
||||
_("colors"),
|
||||
weechat_color ("chat_buffer"),
|
||||
weechat_color ("chat_nick_color1"),
|
||||
weechat_color ("chat_nick_color2"),
|
||||
weechat_color ("chat_nick_color3"),
|
||||
weechat_color ("chat_nick_color4"));
|
||||
weechat_color ("chat_server"),
|
||||
weechat_color ("chat_host"));
|
||||
}
|
||||
|
||||
return WEECHAT_RC_OK;
|
||||
|
||||
@@ -126,7 +126,9 @@ struct t_config_option *irc_config_network_send_unknown_commands;
|
||||
|
||||
struct t_config_option *irc_config_server_default[IRC_SERVER_NUM_OPTIONS];
|
||||
|
||||
struct t_hook *hook_config_color_nicks_number = NULL;
|
||||
struct t_hook *irc_config_hook_config_nick_colors = NULL;
|
||||
char **irc_config_nick_colors = NULL;
|
||||
int irc_config_num_nick_colors = 0;
|
||||
struct t_hashtable *irc_config_hashtable_nick_color_force = NULL;
|
||||
|
||||
int irc_config_write_temp_servers = 0;
|
||||
@@ -187,20 +189,41 @@ irc_config_compute_nick_colors ()
|
||||
}
|
||||
|
||||
/*
|
||||
* irc_config_change_look_color_nicks_number: called when the
|
||||
* "weechat.look.color_nicks_number"
|
||||
* option is changed
|
||||
* irc_config_set_nick_colors: set nick colors using option
|
||||
* "weechat.color.chat_nick_colors"
|
||||
*/
|
||||
|
||||
void
|
||||
irc_config_set_nick_colors ()
|
||||
{
|
||||
if (irc_config_nick_colors)
|
||||
{
|
||||
weechat_string_free_split (irc_config_nick_colors);
|
||||
irc_config_nick_colors = NULL;
|
||||
irc_config_num_nick_colors = 0;
|
||||
}
|
||||
|
||||
irc_config_nick_colors =
|
||||
weechat_string_split (weechat_config_string (weechat_config_get ("weechat.color.chat_nick_colors")),
|
||||
",", 0, 0,
|
||||
&irc_config_num_nick_colors);
|
||||
}
|
||||
|
||||
/*
|
||||
* irc_config_change_nick_colors_cb: callback called when option
|
||||
* "weechat.color.chat_nick_colors" is changed
|
||||
*/
|
||||
|
||||
int
|
||||
irc_config_change_look_color_nicks_number (void *data, const char *option,
|
||||
const char *value)
|
||||
irc_config_change_nick_colors_cb (void *data, const char *option,
|
||||
const char *value)
|
||||
{
|
||||
/* make C compiler happy */
|
||||
(void) data;
|
||||
(void) option;
|
||||
(void) value;
|
||||
|
||||
irc_config_set_nick_colors ();
|
||||
irc_config_compute_nick_colors ();
|
||||
|
||||
return WEECHAT_RC_OK;
|
||||
@@ -2254,8 +2277,8 @@ irc_config_init ()
|
||||
}
|
||||
irc_config_section_server = ptr_section;
|
||||
|
||||
hook_config_color_nicks_number = weechat_hook_config ("weechat.look.color_nicks_number",
|
||||
&irc_config_change_look_color_nicks_number, NULL);
|
||||
irc_config_hook_config_nick_colors = weechat_hook_config ("weechat.color.chat_nick_colors",
|
||||
&irc_config_change_nick_colors_cb, NULL);
|
||||
|
||||
return 1;
|
||||
}
|
||||
@@ -2299,13 +2322,19 @@ void
|
||||
irc_config_free ()
|
||||
{
|
||||
weechat_config_free (irc_config_file);
|
||||
|
||||
if (hook_config_color_nicks_number)
|
||||
|
||||
if (irc_config_hook_config_nick_colors)
|
||||
{
|
||||
weechat_unhook (hook_config_color_nicks_number);
|
||||
hook_config_color_nicks_number = NULL;
|
||||
weechat_unhook (irc_config_hook_config_nick_colors);
|
||||
irc_config_hook_config_nick_colors = NULL;
|
||||
}
|
||||
|
||||
if (irc_config_nick_colors)
|
||||
{
|
||||
weechat_string_free_split (irc_config_nick_colors);
|
||||
irc_config_nick_colors = NULL;
|
||||
irc_config_num_nick_colors = 0;
|
||||
}
|
||||
|
||||
if (irc_config_hashtable_nick_color_force)
|
||||
{
|
||||
weechat_hashtable_free (irc_config_hashtable_nick_color_force);
|
||||
|
||||
@@ -145,8 +145,12 @@ extern struct t_config_option *irc_config_network_send_unknown_commands;
|
||||
|
||||
extern struct t_config_option *irc_config_server_default[];
|
||||
|
||||
extern char **irc_config_nick_colors;
|
||||
extern int irc_config_num_nick_colors;
|
||||
|
||||
extern struct t_hashtable *irc_config_hashtable_nick_color_force;
|
||||
|
||||
extern void irc_config_set_nick_colors ();
|
||||
extern void irc_config_server_change_cb (void *data,
|
||||
struct t_config_option *option);
|
||||
struct t_config_option *irc_config_server_new_option (struct t_config_file *config_file,
|
||||
|
||||
+25
-10
@@ -141,6 +141,12 @@ irc_nick_hash_color (const char *nickname)
|
||||
int color;
|
||||
const char *ptr_nick;
|
||||
|
||||
if (!irc_config_nick_colors)
|
||||
irc_config_set_nick_colors ();
|
||||
|
||||
if (irc_config_num_nick_colors == 0)
|
||||
return 0;
|
||||
|
||||
color = 0;
|
||||
ptr_nick = nickname;
|
||||
while (ptr_nick && ptr_nick[0])
|
||||
@@ -148,8 +154,8 @@ irc_nick_hash_color (const char *nickname)
|
||||
color += weechat_utf8_char_int (ptr_nick);
|
||||
ptr_nick = weechat_utf8_next_char (ptr_nick);
|
||||
}
|
||||
return (color %
|
||||
weechat_config_integer (weechat_config_get ("weechat.look.color_nicks_number")));
|
||||
|
||||
return (color % irc_config_num_nick_colors);
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -161,9 +167,15 @@ const char *
|
||||
irc_nick_find_color (const char *nickname)
|
||||
{
|
||||
int color;
|
||||
char *nickname2, color_name[64];
|
||||
char *nickname2;
|
||||
const char *forced_color;
|
||||
|
||||
if (!irc_config_nick_colors)
|
||||
irc_config_set_nick_colors ();
|
||||
|
||||
if (irc_config_num_nick_colors == 0)
|
||||
return weechat_color ("default");
|
||||
|
||||
nickname2 = irc_nick_strdup_for_color (nickname);
|
||||
|
||||
/* look if color is forced */
|
||||
@@ -186,9 +198,7 @@ irc_nick_find_color (const char *nickname)
|
||||
free (nickname2);
|
||||
|
||||
/* return color */
|
||||
snprintf (color_name, sizeof (color_name),
|
||||
"chat_nick_color%02d", color + 1);
|
||||
return weechat_color (color_name);
|
||||
return weechat_color (irc_config_nick_colors[color]);
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -200,8 +210,15 @@ const char *
|
||||
irc_nick_find_color_name (const char *nickname)
|
||||
{
|
||||
int color;
|
||||
char *nickname2, color_name[128];
|
||||
char *nickname2;
|
||||
const char *forced_color;
|
||||
static char *default_color = "default";
|
||||
|
||||
if (!irc_config_nick_colors)
|
||||
irc_config_set_nick_colors ();
|
||||
|
||||
if (irc_config_num_nick_colors == 0)
|
||||
return default_color;
|
||||
|
||||
nickname2 = irc_nick_strdup_for_color (nickname);
|
||||
|
||||
@@ -221,9 +238,7 @@ irc_nick_find_color_name (const char *nickname)
|
||||
free (nickname2);
|
||||
|
||||
/* return color name */
|
||||
snprintf (color_name, sizeof (color_name),
|
||||
"weechat.color.chat_nick_color%02d", color + 1);
|
||||
return weechat_config_color (weechat_config_get (color_name));
|
||||
return irc_config_nick_colors[color];
|
||||
}
|
||||
|
||||
/*
|
||||
|
||||
@@ -46,6 +46,8 @@ struct t_irc_nick
|
||||
extern int irc_nick_valid (struct t_irc_channel *channel,
|
||||
struct t_irc_nick *nick);
|
||||
extern int irc_nick_is_nick (const char *string);
|
||||
extern int irc_nick_config_colors_cb (void *data, const char *option,
|
||||
const char *value);
|
||||
extern const char *irc_nick_find_color (const char *nickname);
|
||||
extern const char *irc_nick_find_color_name (const char *nickname);
|
||||
extern int irc_nick_is_op (struct t_irc_server *server,
|
||||
|
||||
Reference in New Issue
Block a user