diff options
author | Sebastien Helleu <flashcode@flashtux.org> | 2008-10-19 13:33:40 +0200 |
---|---|---|
committer | Sebastien Helleu <flashcode@flashtux.org> | 2008-10-19 13:33:40 +0200 |
commit | 807895bd382ea988a3f0eb91d96b710f37c8c1a9 (patch) | |
tree | d829dc34639721eff5e9e15d791293954d7dc28f | |
parent | f850bdd5e9e7778fd406625851979ff50e1a3d5b (diff) | |
download | weechat-807895bd382ea988a3f0eb91d96b710f37c8c1a9.zip |
Add color decoding in title for IRC channels (task #6030)
-rw-r--r-- | ChangeLog | 1 | ||||
-rw-r--r-- | src/plugins/irc/irc-bar-item.c | 39 |
2 files changed, 40 insertions, 0 deletions
@@ -5,6 +5,7 @@ ChangeLog - 2008-10-19 Version 0.2.7 (under dev!): + * add color decoding in title for IRC channels (task #6030) * fix lock with SSL servers when connection fails, and when disconnecting during connection problem (bug #17584) * add new option scroll_page_percent to choose percent of height to scroll diff --git a/src/plugins/irc/irc-bar-item.c b/src/plugins/irc/irc-bar-item.c index c6d1f7500..a7e521c28 100644 --- a/src/plugins/irc/irc-bar-item.c +++ b/src/plugins/irc/irc-bar-item.c @@ -26,12 +26,50 @@ #include "../weechat-plugin.h" #include "irc.h" #include "irc-buffer.h" +#include "irc-color.h" #include "irc-config.h" #include "irc-server.h" #include "irc-channel.h" /* + * irc_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, + int max_width, int max_height) +{ + struct t_gui_buffer *buffer; + char *title, *title_color; + + /* make C compiler happy */ + (void) data; + (void) item; + (void) max_width; + (void) max_height; + + if (!window) + window = weechat_current_window; + + buffer = weechat_window_get_pointer (window, "buffer"); + + if (buffer) + { + title = weechat_buffer_get_string (buffer, "title"); + if (!title) + return NULL; + + title_color = irc_color_decode (title, 1); + + return (title_color) ? title_color : strdup (title); + } + + return NULL; +} + +/* * irc_bar_item_buffer_name: bar item with buffer name */ @@ -261,6 +299,7 @@ irc_bar_item_input_prompt (void *data, struct t_gui_bar_item *item, void irc_bar_item_init () { + weechat_bar_item_new ("buffer_title", &irc_bar_item_buffer_title, NULL); weechat_bar_item_new ("buffer_name", &irc_bar_item_buffer_name, NULL); weechat_bar_item_new ("lag", &irc_bar_item_lag, NULL); weechat_bar_item_new ("input_prompt", &irc_bar_item_input_prompt, NULL); |