# HG changeset patch # User Michal 'vorner' Vaner # Date 1188293098 -7200 # Node ID 33cb828282d5ca8a4c423287543cfe37de3a1fad # Parent 86caabe72f3aff0e8f40dafe1c9a7c2c2f62a384 Fix recognizing of bright colors diff -r 86caabe72f3a -r 33cb828282d5 mcabber/src/screen.c --- a/mcabber/src/screen.c Tue Aug 28 10:52:15 2007 +0200 +++ b/mcabber/src/screen.c Tue Aug 28 11:24:58 2007 +0200 @@ -241,6 +241,22 @@ return -1; } +static int get_user_color(const char *color) +{ + bool isbright = false; + int cl; + if (!strncmp(color, "bright", 6)) { + isbright = true; + color += 6; + } + cl = color_to_color_fg(FindColorInternal(color)); + if (cl < 0) + return cl; + if (isbright) + cl += COLOR_BLACK_BOLD_FG - COLOR_BLACK_FG; + return cl; +} + static void ensure_string_htable(GHashTable **table, GDestroyNotify value_destroy_func) { @@ -302,7 +318,7 @@ g_free(mnick); need_update = true; } else { - int cl = color_to_color_fg(FindColorInternal(color)); + int cl = get_user_color(color); if (cl < 0) { scr_LogPrint(LPRINT_NORMAL, "No such color name"); g_free(snick); @@ -373,15 +389,7 @@ return FALSE; } } else { - bool isbright = false; - int cl; - if (!strncmp(color, "bright", 6)) { - isbright = true; - color += 6; - } - cl = color_to_color_fg(FindColorInternal(color)); - if (isbright) - cl += COLOR_BLACK_BOLD_FG - COLOR_BLACK_FG; + int cl = get_user_color(color); if (cl < 0 ) { scr_LogPrint(LPRINT_NORMAL, "No such color name"); return FALSE;