summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorSebastien Helleu <flashcode@flashtux.org>2009-02-25 19:22:18 +0100
committerSebastien Helleu <flashcode@flashtux.org>2009-02-25 19:22:18 +0100
commit8f148ccfc7a9a7e54e47bdf23ab316c6159a7ea8 (patch)
tree886fc86b9689bbedc22579a4073cd52d3e2ecba3 /src
parent4772bd1865f7bdce4642d6f8559ab12fb7d0b3a5 (diff)
downloadweechat-8f148ccfc7a9a7e54e47bdf23ab316c6159a7ea8.zip
Add option "irc.look.topic_strip_colors" to strip topic colors in buffer's title bar (task #6030)
Diffstat (limited to 'src')
-rw-r--r--src/plugins/irc/irc-bar-item.c6
-rw-r--r--src/plugins/irc/irc-config.c25
-rw-r--r--src/plugins/irc/irc-config.h3
-rw-r--r--src/plugins/irc/irc-protocol.c4
4 files changed, 31 insertions, 7 deletions
diff --git a/src/plugins/irc/irc-bar-item.c b/src/plugins/irc/irc-bar-item.c
index 043b669d8..dcfeb0420 100644
--- a/src/plugins/irc/irc-bar-item.c
+++ b/src/plugins/irc/irc-bar-item.c
@@ -59,8 +59,10 @@ irc_bar_item_buffer_title (void *data, struct t_gui_bar_item *item,
if (!title)
return NULL;
- title_color = irc_color_decode (title, 1);
-
+ title_color = irc_color_decode (title,
+ (weechat_config_boolean (irc_config_look_topic_strip_colors)) ?
+ 0 : 1);
+
return (title_color) ? title_color : strdup (title);
}
diff --git a/src/plugins/irc/irc-config.c b/src/plugins/irc/irc-config.c
index 9be9faa5b..95040fd87 100644
--- a/src/plugins/irc/irc-config.c
+++ b/src/plugins/irc/irc-config.c
@@ -53,10 +53,11 @@ struct t_config_option *irc_config_look_display_channel_modes;
struct t_config_option *irc_config_look_display_nick_modes;
struct t_config_option *irc_config_look_hide_nickserv_pwd;
struct t_config_option *irc_config_look_highlight_tags;
+struct t_config_option *irc_config_look_notice_as_pv;
struct t_config_option *irc_config_look_show_away_once;
struct t_config_option *irc_config_look_smart_filter;
struct t_config_option *irc_config_look_smart_filter_delay;
-struct t_config_option *irc_config_look_notice_as_pv;
+struct t_config_option *irc_config_look_topic_strip_colors;
/* IRC config, color section */
@@ -237,6 +238,22 @@ irc_config_change_look_highlight_tags (void *data,
}
/*
+ * irc_config_change_look_topic_strip_colors: called when the "topic strip colors"
+ * option is changed
+ */
+
+void
+irc_config_change_look_topic_strip_colors (void *data,
+ struct t_config_option *option)
+{
+ /* make C compiler happy */
+ (void) data;
+ (void) option;
+
+ weechat_bar_item_update ("buffer_title");
+}
+
+/*
* irc_config_change_color_input_nick: called when the color of input nick is
* changed
*/
@@ -1096,6 +1113,12 @@ irc_config_init ()
"notice_as_pv", "boolean",
N_("display notices as private messages"),
NULL, 0, 0, "off", NULL, 0, NULL, NULL, NULL, NULL, NULL, NULL);
+ irc_config_look_topic_strip_colors = weechat_config_new_option (
+ irc_config_file, ptr_section,
+ "topic_strip_colors", "boolean",
+ N_("strip colors in topic (used only when displaying buffer title)"),
+ NULL, 0, 0, "off", NULL, 0, NULL, NULL,
+ &irc_config_change_look_topic_strip_colors, NULL, NULL, NULL);
/* color */
ptr_section = weechat_config_new_section (irc_config_file, "color",
diff --git a/src/plugins/irc/irc-config.h b/src/plugins/irc/irc-config.h
index 23dbcc98c..836c7f7f8 100644
--- a/src/plugins/irc/irc-config.h
+++ b/src/plugins/irc/irc-config.h
@@ -42,10 +42,11 @@ extern struct t_config_option *irc_config_look_display_channel_modes;
extern struct t_config_option *irc_config_look_display_nick_modes;
extern struct t_config_option *irc_config_look_hide_nickserv_pwd;
extern struct t_config_option *irc_config_look_highlight_tags;
+extern struct t_config_option *irc_config_look_notice_as_pv;
extern struct t_config_option *irc_config_look_show_away_once;
extern struct t_config_option *irc_config_look_smart_filter;
extern struct t_config_option *irc_config_look_smart_filter_delay;
-extern struct t_config_option *irc_config_look_notice_as_pv;
+extern struct t_config_option *irc_config_look_topic_strip_colors;
extern struct t_config_option *irc_config_color_message_join;
extern struct t_config_option *irc_config_color_message_quit;
diff --git a/src/plugins/irc/irc-protocol.c b/src/plugins/irc/irc-protocol.c
index 1fd892477..5d7982f97 100644
--- a/src/plugins/irc/irc-protocol.c
+++ b/src/plugins/irc/irc-protocol.c
@@ -348,9 +348,7 @@ irc_protocol_cmd_join (struct t_irc_server *server, const char *command,
/* remove topic and display channel creation date if joining new channel */
if (!ptr_channel->nicks)
{
- if (ptr_channel->topic)
- irc_channel_set_topic (ptr_channel, NULL);
-
+ irc_channel_set_topic (ptr_channel, NULL);
ptr_channel->display_creation_date = 1;
}