--- 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;