From 6bd96564168c66eda4d1b198e62c7bd20549205e Mon Sep 17 00:00:00 2001 From: TingPing Date: Sat, 9 Mar 2013 17:57:06 -0500 Subject: Add option to color nicknames in the userlist to match the chat --- src/common/cfgfiles.c | 1 + src/common/hexchat.h | 1 + src/common/text.c | 6 +++--- src/common/text.h | 1 + 4 files changed, 6 insertions(+), 3 deletions(-) (limited to 'src/common') diff --git a/src/common/cfgfiles.c b/src/common/cfgfiles.c index 9aac5a4f..243371b0 100644 --- a/src/common/cfgfiles.c +++ b/src/common/cfgfiles.c @@ -466,6 +466,7 @@ const struct prefs vars[] = {"gui_tray_minimize", P_OFFINT (hex_gui_tray_minimize), TYPE_BOOL}, {"gui_tray_quiet", P_OFFINT (hex_gui_tray_quiet), TYPE_BOOL}, {"gui_ulist_buttons", P_OFFINT (hex_gui_ulist_buttons), TYPE_BOOL}, + {"gui_ulist_color", P_OFFINT (hex_gui_ulist_color), TYPE_BOOL}, {"gui_ulist_count", P_OFFINT (hex_gui_ulist_count), TYPE_BOOL}, {"gui_ulist_doubleclick", P_OFFSET (hex_gui_ulist_doubleclick), TYPE_STR}, {"gui_ulist_hide", P_OFFINT (hex_gui_ulist_hide), TYPE_BOOL}, diff --git a/src/common/hexchat.h b/src/common/hexchat.h index dfd2fd5a..fad61938 100644 --- a/src/common/hexchat.h +++ b/src/common/hexchat.h @@ -158,6 +158,7 @@ struct hexchatprefs unsigned int hex_gui_tray_minimize; unsigned int hex_gui_tray_quiet; unsigned int hex_gui_ulist_buttons; + unsigned int hex_gui_ulist_color; unsigned int hex_gui_ulist_count; unsigned int hex_gui_ulist_hide; unsigned int hex_gui_ulist_icons; diff --git a/src/common/text.c b/src/common/text.c index 0bef377c..fdf08b90 100644 --- a/src/common/text.c +++ b/src/common/text.c @@ -2081,8 +2081,8 @@ pevt_build_string (const char *input, char **output, int *max_arg) static char rcolors[] = { 19, 20, 22, 24, 25, 26, 27, 28, 29 }; -static int -color_of (char *name) +int +text_color_of (char *name) { int i = 0, sum = 0; @@ -2105,7 +2105,7 @@ text_emit (int index, session *sess, char *a, char *b, char *c, char *d) if (prefs.hex_text_color_nicks && (index == XP_TE_CHANACTION || index == XP_TE_CHANMSG)) { - snprintf (tbuf, sizeof (tbuf), "\003%d%s", color_of (a), a); + snprintf (tbuf, sizeof (tbuf), "\003%d%s", text_color_of (a), a); a = tbuf; stripcolor_args &= ~ARG_FLAG(1); /* don't strip color from this argument */ } diff --git a/src/common/text.h b/src/common/text.h index ccbae785..e018c769 100644 --- a/src/common/text.h +++ b/src/common/text.h @@ -26,6 +26,7 @@ void pevent_save (char *fn); int pevt_build_string (const char *input, char **output, int *max_arg); int pevent_load (char *filename); void pevent_make_pntevts (void); +int text_color_of (char *name); void text_emit (int index, session *sess, char *a, char *b, char *c, char *d); int text_emit_by_name (char *name, session *sess, char *a, char *b, char *c, char *d); #ifdef WIN32 -- cgit 1.4.1