summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--ChangeLog.asciidoc1
-rw-r--r--src/plugins/irc/irc-bar-item.c35
-rw-r--r--src/plugins/irc/irc-channel.c25
-rw-r--r--src/plugins/irc/irc-channel.h1
-rw-r--r--src/plugins/irc/irc-config.c14
5 files changed, 37 insertions, 39 deletions
diff --git a/ChangeLog.asciidoc b/ChangeLog.asciidoc
index c92abbb60..00c1135be 100644
--- a/ChangeLog.asciidoc
+++ b/ChangeLog.asciidoc
@@ -43,6 +43,7 @@ http://weechat.org/files/releasenotes/ReleaseNotes-devel.html[release notes]
weechat.look.buffer_time_format is not an empty string
* core: fix translation of message displayed after /upgrade
* api: fix crash when reading config options with NULL value (closes #238)
+* irc: remove IRC color codes from buffer title in channels (closes #237)
* irc: add tag "nick_xxx" in invite messages
* irc: fix completion of commands /msg, /notice and /query
* irc: fix translation of CTCP PING reply (closes #137)
diff --git a/src/plugins/irc/irc-bar-item.c b/src/plugins/irc/irc-bar-item.c
index 3ac0d466f..26cbbd3e9 100644
--- a/src/plugins/irc/irc-bar-item.c
+++ b/src/plugins/irc/irc-bar-item.c
@@ -88,39 +88,6 @@ irc_bar_item_away (void *data, struct t_gui_bar_item *item,
}
/*
- * Returns content of bar item "buffer_title": bar item with buffer title.
- */
-
-char *
-irc_bar_item_buffer_title (void *data, struct t_gui_bar_item *item,
- struct t_gui_window *window,
- struct t_gui_buffer *buffer,
- struct t_hashtable *extra_info)
-{
- const char *title;
- char *title_color;
-
- /* make C compiler happy */
- (void) data;
- (void) item;
- (void) window;
- (void) extra_info;
-
- if (!buffer)
- return NULL;
-
- title = weechat_buffer_get_string (buffer, "title");
- if (!title)
- return NULL;
-
- title_color = irc_color_decode (title,
- (weechat_config_boolean (irc_config_look_topic_strip_colors)) ?
- 0 : 1);
-
- return (title_color) ? title_color : strdup (title);
-}
-
-/*
* Returns content of bar item "buffer_plugin": bar item with buffer plugin.
*/
@@ -634,7 +601,6 @@ irc_bar_item_buffer_switch (void *data, const char *signal,
(void) signal_data;
weechat_bar_item_update ("away");
- weechat_bar_item_update ("buffer_title");
weechat_bar_item_update ("buffer_name");
weechat_bar_item_update ("buffer_short_name");
weechat_bar_item_update ("buffer_modes");
@@ -666,7 +632,6 @@ void
irc_bar_item_init ()
{
weechat_bar_item_new ("away", &irc_bar_item_away, NULL);
- weechat_bar_item_new ("buffer_title", &irc_bar_item_buffer_title, NULL);
weechat_bar_item_new ("buffer_plugin", &irc_bar_item_buffer_plugin, NULL);
weechat_bar_item_new ("buffer_name", &irc_bar_item_buffer_name, NULL);
weechat_bar_item_new ("buffer_short_name", &irc_bar_item_buffer_short_name, NULL);
diff --git a/src/plugins/irc/irc-channel.c b/src/plugins/irc/irc-channel.c
index 739e7cc80..ed6ffb848 100644
--- a/src/plugins/irc/irc-channel.c
+++ b/src/plugins/irc/irc-channel.c
@@ -389,6 +389,26 @@ irc_channel_add_nicklist_groups (struct t_irc_server *server,
}
/*
+ * Sets the buffer title with the channel topic.
+ */
+
+void
+irc_channel_set_buffer_title (struct t_irc_channel *channel)
+{
+ char *title_color;
+
+ if (channel->topic)
+ {
+ title_color = irc_color_decode (
+ channel->topic,
+ (weechat_config_boolean (irc_config_look_topic_strip_colors)) ? 0 : 1);
+ weechat_buffer_set (channel->buffer, "title", title_color);
+ }
+ else
+ weechat_buffer_set (channel->buffer, "title", "");
+}
+
+/*
* Sets topic for a channel.
*/
@@ -397,10 +417,9 @@ irc_channel_set_topic (struct t_irc_channel *channel, const char *topic)
{
if (channel->topic)
free (channel->topic);
-
channel->topic = (topic) ? strdup (topic) : NULL;
- weechat_buffer_set (channel->buffer, "title",
- (channel->topic) ? channel->topic : "");
+
+ irc_channel_set_buffer_title (channel);
}
/*
diff --git a/src/plugins/irc/irc-channel.h b/src/plugins/irc/irc-channel.h
index 65d319320..2d91e1907 100644
--- a/src/plugins/irc/irc-channel.h
+++ b/src/plugins/irc/irc-channel.h
@@ -85,6 +85,7 @@ extern struct t_irc_channel *irc_channel_new (struct t_irc_server *server,
int auto_switch);
extern void irc_channel_add_nicklist_groups (struct t_irc_server *server,
struct t_irc_channel *channel);
+extern void irc_channel_set_buffer_title (struct t_irc_channel *channel);
extern void irc_channel_set_topic (struct t_irc_channel *channel,
const char *topic);
extern void irc_channel_set_modes (struct t_irc_channel *channel,
diff --git a/src/plugins/irc/irc-config.c b/src/plugins/irc/irc-config.c
index d8b91abaf..177be4b6a 100644
--- a/src/plugins/irc/irc-config.c
+++ b/src/plugins/irc/irc-config.c
@@ -652,11 +652,23 @@ void
irc_config_change_look_topic_strip_colors (void *data,
struct t_config_option *option)
{
+ struct t_irc_server *ptr_server;
+ struct t_irc_channel *ptr_channel;
+
/* make C compiler happy */
(void) data;
(void) option;
- weechat_bar_item_update ("buffer_title");
+ for (ptr_server = irc_servers; ptr_server;
+ ptr_server = ptr_server->next_server)
+ {
+ for (ptr_channel = ptr_server->channels; ptr_channel;
+ ptr_channel = ptr_channel->next_channel)
+ {
+ if (ptr_channel->buffer)
+ irc_channel_set_buffer_title (ptr_channel);
+ }
+ }
}
/*