char * twc_bar_item_buffer_plugin(void *data, struct t_gui_bar_item *item, struct t_gui_window *window, struct t_gui_buffer *buffer, struct t_hashtable *extra_info) { struct t_twc_profile *profile = twc_profile_search_buffer(buffer); char string[256]; const char *plugin_name = weechat_plugin_get_name(weechat_plugin); if (!profile) return strdup(plugin_name); const char *profile_name = profile->name; snprintf(string, sizeof(string), "%s%s/%s%s%s/%s%s", plugin_name, weechat_color("bar_delim"), weechat_color("bar_fg"), profile_name, weechat_color("bar_delim"), weechat_color("bar_fg"), profile->tox_online ? "online" : "offline"); return strdup(string); }
char * irc_bar_item_buffer_plugin (void *data, struct t_gui_bar_item *item, struct t_gui_window *window, struct t_gui_buffer *buffer, struct t_hashtable *extra_info) { char buf[512]; struct t_weechat_plugin *ptr_plugin; const char *name; 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; ptr_plugin = weechat_buffer_get_pointer (buffer, "plugin"); name = weechat_plugin_get_name (ptr_plugin); if (ptr_plugin == weechat_irc_plugin) { irc_buffer_get_server_and_channel (buffer, &server, &channel); if (server && channel && (weechat_config_integer (irc_config_look_item_display_server) == IRC_CONFIG_LOOK_ITEM_DISPLAY_SERVER_PLUGIN)) { snprintf (buf, sizeof (buf), "%s%s/%s%s", name, IRC_COLOR_BAR_DELIM, IRC_COLOR_BAR_FG, server->name); } else { snprintf (buf, sizeof (buf), "%s", name); } } else { snprintf (buf, sizeof (buf), "%s", name); } return strdup (buf); }