From cf505b850bb02e7b691fbd5f48618d66fe55bc0a Mon Sep 17 00:00:00 2001 From: TingPing Date: Thu, 6 Jun 2013 17:47:01 -0400 Subject: Add chanopt for stripping colors --- src/common/chanopt.c | 2 ++ src/common/hexchat.c | 1 + src/common/hexchat.h | 1 + src/common/text.c | 2 +- src/fe-gtk/maingui.c | 3 +++ 5 files changed, 8 insertions(+), 1 deletion(-) diff --git a/src/common/chanopt.c b/src/common/chanopt.c index 65c27d58..9e841cb6 100644 --- a/src/common/chanopt.c +++ b/src/common/chanopt.c @@ -65,6 +65,7 @@ static const channel_options chanopt[] = {"text_hidejoinpart", "CONFMODE", S_F(text_hidejoinpart)}, {"text_logging", NULL, S_F(text_logging)}, {"text_scrollback", NULL, S_F(text_scrollback)}, + {"text_strip", NULL, S_F(text_strip)}, }; #undef S_F @@ -179,6 +180,7 @@ typedef struct guint8 text_hidejoinpart; guint8 text_logging; guint8 text_scrollback; + guint8 text_strip; char *network; char *channel; diff --git a/src/common/hexchat.c b/src/common/hexchat.c index 65999794..fb9dde5c 100644 --- a/src/common/hexchat.c +++ b/src/common/hexchat.c @@ -465,6 +465,7 @@ session_new (server *serv, char *from, int type, int focus) sess->text_hidejoinpart = SET_DEFAULT; sess->text_logging = SET_DEFAULT; sess->text_scrollback = SET_DEFAULT; + sess->text_strip = SET_DEFAULT; sess->lastact_idx = LACT_NONE; diff --git a/src/common/hexchat.h b/src/common/hexchat.h index 5fdbfc45..1a759f14 100644 --- a/src/common/hexchat.h +++ b/src/common/hexchat.h @@ -398,6 +398,7 @@ typedef struct session guint8 text_hidejoinpart; guint8 text_logging; guint8 text_scrollback; + guint8 text_strip; struct server *server; void *usertree_alpha; /* pure alphabetical tree */ diff --git a/src/common/text.c b/src/common/text.c index 98ddd775..3d1c9280 100644 --- a/src/common/text.c +++ b/src/common/text.c @@ -2043,7 +2043,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.hex_text_stripcolor_msg ? 0xFFFFFFFF : 0); + unsigned int stripcolor_args = (chanopt_is_set (prefs.hex_text_stripcolor_msg, sess->text_strip) ? 0xFFFFFFFF : 0); char tbuf[NICKLEN + 4]; if (prefs.hex_text_color_nicks && (index == XP_TE_CHANACTION || index == XP_TE_CHANMSG)) diff --git a/src/fe-gtk/maingui.c b/src/fe-gtk/maingui.c index 2fe5d12c..f049d2a6 100644 --- a/src/fe-gtk/maingui.c +++ b/src/fe-gtk/maingui.c @@ -1561,7 +1561,10 @@ mg_create_perchannelmenu (session *sess, GtkWidget *menu) mg_perchan_menu_item (_("_Log to Disk"), submenu, &sess->text_logging, prefs.hex_irc_logging); mg_perchan_menu_item (_("_Reload Scrollback"), submenu, &sess->text_scrollback, prefs.hex_text_replay); if (sess->type == SESS_CHANNEL) + { + mg_perchan_menu_item (_("Strip _Colors"), submenu, &sess->text_strip, prefs.hex_text_stripcolor_msg); mg_perchan_menu_item (_("_Hide Join/Part Messages"), submenu, &sess->text_hidejoinpart, prefs.hex_irc_conf_mode); + } } static void -- cgit 1.4.1