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

Fix color string returned by API function color() for some WeeChat color options

This commit is contained in:
Sebastien Helleu
2010-01-01 12:29:14 +01:00
parent 90884e6b9e
commit 6cc9ce8777
3 changed files with 19 additions and 12 deletions
+13 -6
View File
@@ -43,12 +43,12 @@ struct t_gui_color *gui_color[GUI_COLOR_NUM_COLORS]; /* GUI colors */
/*
* gui_color_search_config_int: search a color with configuration option name
* return color found (number >= 0), -1 if not found
* gui_color_search_config: search a color with configuration option name
* return color string, NULL if not found
*/
int
gui_color_search_config_int (const char *color_name)
const char *
gui_color_search_config (const char *color_name)
{
struct t_config_section *ptr_section;
struct t_config_option *ptr_option;
@@ -63,13 +63,20 @@ gui_color_search_config_int (const char *color_name)
ptr_option = ptr_option->next_option)
{
if (string_strcasecmp (ptr_option->name, color_name) == 0)
return ptr_option->min;
{
if (ptr_option->min < 0)
{
return gui_color_get_custom (
gui_color_get_name (CONFIG_COLOR(ptr_option)));
}
return GUI_COLOR(ptr_option->min);
}
}
}
}
/* color not found */
return -1;
return NULL;
}
/*
+1 -1
View File
@@ -126,7 +126,7 @@ extern struct t_gui_color *gui_color[];
/* color functions */
extern int gui_color_search_config_int (const char *color_name);
extern const char *gui_color_search_config (const char *color_name);
extern const char *gui_color_get_custom (const char *color_name);
extern char *gui_color_decode (const char *string, const char *replacement);
extern void gui_color_free (struct t_gui_color *color);