summary refs log tree commit diff stats
path: root/src/common
diff options
context:
space:
mode:
authorBerke Viktor <bviktor@hexchat.org>2012-09-01 21:38:00 +0200
committerBerke Viktor <bviktor@hexchat.org>2012-09-01 21:38:00 +0200
commit4f887a1e536044cca9b4a865917ca56288032b07 (patch)
tree10c841790aa7bd5532743facd59afb203b9204aa /src/common
parentfb00928c9df3a8152113674f4b85ba0fdf1679c8 (diff)
Consolidate color stripping for messages, topic and scrollback
Diffstat (limited to 'src/common')
-rw-r--r--src/common/cfgfiles.c8
-rw-r--r--src/common/text.c14
-rw-r--r--src/common/xchat.h5
3 files changed, 15 insertions, 12 deletions
diff --git a/src/common/cfgfiles.c b/src/common/cfgfiles.c
index 06af6543..38abca71 100644
--- a/src/common/cfgfiles.c
+++ b/src/common/cfgfiles.c
@@ -597,7 +597,6 @@ const struct prefs vars[] = {
 	{"text_max_indent", P_OFFINT (max_auto_indent), TYPE_INT},
 	{"text_max_lines", P_OFFINT (max_lines), TYPE_INT},
 	{"text_replay", P_OFFINT (text_replay), TYPE_BOOL},
-	{"text_replay_strip_color", P_OFFINT (text_replay_strip_color), TYPE_BOOL},
 	{"text_search_case_match", P_OFFINT (text_search_case_match), TYPE_BOOL},
 	{"text_search_backward", P_OFFINT (text_search_backward), TYPE_BOOL},
 	{"text_search_highlight_all", P_OFFINT (text_search_highlight_all), TYPE_BOOL},
@@ -606,7 +605,9 @@ const struct prefs vars[] = {
 	{"text_show_marker", P_OFFINT (show_marker), TYPE_BOOL},
 	{"text_show_sep", P_OFFINT (show_separator), TYPE_BOOL},
 	{"text_spell_langs", P_OFFSET (spell_langs), TYPE_STR},
-	{"text_stripcolor", P_OFFINT (stripcolor), TYPE_BOOL},
+	{"text_stripcolor_msg", P_OFFINT (text_stripcolor_msg), TYPE_BOOL},
+	{"text_stripcolor_replay", P_OFFINT (text_stripcolor_replay), TYPE_BOOL},
+	{"text_stripcolor_topic", P_OFFINT (text_stripcolor_topic), TYPE_BOOL},
 	{"text_thin_sep", P_OFFINT (thin_separator), TYPE_BOOL},
 	{"text_tint_blue", P_OFFINT (tint_blue), TYPE_INT},
 	{"text_tint_green", P_OFFINT (tint_green), TYPE_INT},
@@ -689,7 +690,8 @@ load_config (void)
 	prefs.recon_delay = 10;
 	prefs.autocopy_text = 1;
 	prefs.text_replay = 1;
-	prefs.text_replay_strip_color = 1;
+	prefs.text_stripcolor_replay = 1;
+	prefs.text_stripcolor_topic = 1;
 	prefs.tabchannels = 1;
 	prefs.tab_layout = 2;	/* 0=Tabs 1=Reserved 2=Tree */
 	prefs.tab_sort = 1;
diff --git a/src/common/text.c b/src/common/text.c
index 7ec5d0ae..220fca1b 100644
--- a/src/common/text.c
+++ b/src/common/text.c
@@ -340,12 +340,12 @@ scrollback_load (session *sess)
 			text = strchr (buf + 3, ' ');
 			if (text)
 			{
-				if (prefs.text_replay_strip_color)
+				if (prefs.text_stripcolor_replay)
 				{
 					text = strip_color (text + 1, -1, STRIP_COLOR);
 				}
 				fe_print_text (sess, text, stamp);
-				if (prefs.text_replay_strip_color)
+				if (prefs.text_stripcolor_replay)
 				{
 					g_free (text);
 				}
@@ -381,21 +381,21 @@ scrollback_load (session *sess)
 			text = strchr (buf + 3, ' ');
 			if (text)
 			{
-				if (prefs.text_replay_strip_color)
+				if (prefs.text_stripcolor_replay)
 				{
 					text = strip_color (text + 1, -1, STRIP_COLOR);
 				}
 				cleaned_text = text_replace_non_bmp (text, -1, &cleaned_len);
 				if (cleaned_text != NULL)
 				{
-					if (prefs.text_replay_strip_color)
+					if (prefs.text_stripcolor_replay)
 					{
 						g_free (text);
 					}
 					text = cleaned_text;
 				}
 				fe_print_text (sess, text, stamp);
-				if (prefs.text_replay_strip_color)
+				if (prefs.text_stripcolor_replay)
 				{
 					g_free (text);
 				}
@@ -1799,7 +1799,7 @@ load_text_events ()
 
 /*
 	CL: format_event now handles filtering of arguments:
-	1) if prefs.stripcolor is set, filter all style control codes from arguments
+	1) if prefs.text_stripcolor_msg is set, filter all style control codes from arguments
 	2) always strip \010 (ATTR_HIDDEN) from arguments: it is only for use in the format string itself
 */
 #define ARG_FLAG(argn) (1 << (argn))
@@ -2095,7 +2095,7 @@ text_emit (int index, session *sess, char *a, char *b, char *c, char *d)
 {
 	char *word[PDIWORDS];
 	int i;
-	unsigned int stripcolor_args = (prefs.stripcolor ? 0xFFFFFFFF : 0);
+	unsigned int stripcolor_args = (prefs.text_stripcolor_msg ? 0xFFFFFFFF : 0);
 	char tbuf[NICKLEN + 4];
 
 	if (prefs.colorednicks && (index == XP_TE_CHANACTION || index == XP_TE_CHANMSG))
diff --git a/src/common/xchat.h b/src/common/xchat.h
index 66f43522..a5b854af 100644
--- a/src/common/xchat.h
+++ b/src/common/xchat.h
@@ -236,7 +236,9 @@ struct xchatprefs
 	unsigned int autoopendccrecvwindow;
 	unsigned int autoopendccchatwindow;
 	unsigned int transparent;
-	unsigned int stripcolor;
+	unsigned int text_stripcolor_msg;
+	unsigned int text_stripcolor_replay;
+	unsigned int text_stripcolor_topic;
 	unsigned int timestamp;
 	unsigned int fastdccsend;
 	unsigned int dcc_send_fillspaces;
@@ -286,7 +288,6 @@ struct xchatprefs
 	unsigned int windows_as_tabs;
 	unsigned int indent_nicks;
 	unsigned int text_replay;
-	unsigned int text_replay_strip_color;
 	unsigned int show_marker;
 	unsigned int show_separator;
 	unsigned int thin_separator;