diff options
Diffstat (limited to 'src/plugins')
-rw-r--r-- | src/plugins/irc/irc-bar-item.c | 57 | ||||
-rw-r--r-- | src/plugins/irc/irc-config.c | 1 | ||||
-rw-r--r-- | src/plugins/irc/irc-server.c | 1 |
3 files changed, 47 insertions, 12 deletions
diff --git a/src/plugins/irc/irc-bar-item.c b/src/plugins/irc/irc-bar-item.c index 0e84023f8..6a6f22cf5 100644 --- a/src/plugins/irc/irc-bar-item.c +++ b/src/plugins/irc/irc-bar-item.c @@ -176,10 +176,7 @@ irc_bar_item_buffer_plugin (void *data, struct t_gui_bar_item *item, */ char * -irc_bar_item_buffer_name (void *data, struct t_gui_bar_item *item, - struct t_gui_window *window, - struct t_gui_buffer *buffer, - struct t_hashtable *extra_info) +irc_bar_item_buffer_name_content (struct t_gui_buffer *buffer, int short_name) { char buf[512], buf_name[256], modes[128]; const char *name; @@ -187,12 +184,6 @@ irc_bar_item_buffer_name (void *data, struct t_gui_bar_item *item, struct t_irc_server *server; struct t_irc_channel *channel; - /* make C compiler happy */ - (void) data; - (void) item; - (void) window; - (void) extra_info; - if (!buffer) return NULL; @@ -228,7 +219,7 @@ irc_bar_item_buffer_name (void *data, struct t_gui_bar_item *item, (server && display_server) ? IRC_COLOR_BAR_DELIM : "", (server && display_server) ? "/" : "", (server && server->ssl_connected) ? IRC_COLOR_STATUS_NAME_SSL : IRC_COLOR_STATUS_NAME, - channel->name, + (short_name) ? weechat_buffer_get_string (buffer, "short_name") : channel->name, (part_from_channel) ? IRC_COLOR_BAR_DELIM : "", (part_from_channel) ? ")" : ""); } @@ -236,7 +227,8 @@ irc_bar_item_buffer_name (void *data, struct t_gui_bar_item *item, } else { - name = weechat_buffer_get_string (buffer, "name"); + name = weechat_buffer_get_string (buffer, + (short_name) ? "short_name" : "name"); if (name) snprintf (buf_name, sizeof (buf_name), "%s", name); } @@ -250,6 +242,45 @@ irc_bar_item_buffer_name (void *data, struct t_gui_bar_item *item, } /* + * Returns content of bar item "buffer_name": bar item with buffer name. + */ + +char * +irc_bar_item_buffer_name (void *data, struct t_gui_bar_item *item, + struct t_gui_window *window, + struct t_gui_buffer *buffer, + struct t_hashtable *extra_info) +{ + /* make C compiler happy */ + (void) data; + (void) item; + (void) window; + (void) extra_info; + + return irc_bar_item_buffer_name_content (buffer, 0); +} + +/* + * Returns content of bar item "buffer_short_name": bar item with buffer short + * name. + */ + +char * +irc_bar_item_buffer_short_name (void *data, struct t_gui_bar_item *item, + struct t_gui_window *window, + struct t_gui_buffer *buffer, + struct t_hashtable *extra_info) +{ + /* make C compiler happy */ + (void) data; + (void) item; + (void) window; + (void) extra_info; + + return irc_bar_item_buffer_name_content (buffer, 1); +} + +/* * Returns content of bar item "buffer_modes": bar item with buffer modes. */ @@ -605,6 +636,7 @@ irc_bar_item_buffer_switch (void *data, const char *signal, 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"); weechat_bar_item_update ("irc_channel"); weechat_bar_item_update ("lag"); @@ -625,6 +657,7 @@ irc_bar_item_init () 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); weechat_bar_item_new ("buffer_modes", &irc_bar_item_buffer_modes, NULL); weechat_bar_item_new ("irc_channel", &irc_bar_item_channel, NULL); weechat_bar_item_new ("lag", &irc_bar_item_lag, NULL); diff --git a/src/plugins/irc/irc-config.c b/src/plugins/irc/irc-config.c index 5329063e1..19c835876 100644 --- a/src/plugins/irc/irc-config.c +++ b/src/plugins/irc/irc-config.c @@ -610,6 +610,7 @@ irc_config_change_look_item_display_server (void *data, weechat_bar_item_update ("buffer_plugin"); weechat_bar_item_update ("buffer_name"); + weechat_bar_item_update ("buffer_short_name"); } /* diff --git a/src/plugins/irc/irc-server.c b/src/plugins/irc/irc-server.c index f94a7c01b..ab6ef9703 100644 --- a/src/plugins/irc/irc-server.c +++ b/src/plugins/irc/irc-server.c @@ -4047,6 +4047,7 @@ irc_server_connect (struct t_irc_server *server) } weechat_bar_item_update ("buffer_name"); + weechat_bar_item_update ("buffer_short_name"); irc_server_set_index_current_address (server, server->index_current_address); |