1
0
mirror of https://github.com/weechat/weechat.git synced 2026-07-01 23:36:37 +02:00

Add color for bar item "away" (irc.color.item_away)

This commit is contained in:
Sebastien Helleu
2009-05-28 16:36:24 +02:00
parent 0e040e8301
commit 27d1ba5093
14 changed files with 86 additions and 10 deletions
+13 -1
View File
@@ -42,6 +42,8 @@ irc_bar_item_away (void *data, struct t_gui_bar_item *item,
{
struct t_gui_buffer *buffer;
struct t_irc_server *server;
char *buf;
int length;
/* make C compiler happy */
(void) data;
@@ -54,7 +56,17 @@ irc_bar_item_away (void *data, struct t_gui_bar_item *item,
irc_buffer_get_server_channel (buffer, &server, NULL);
if (server && server->is_away)
return strdup (_("away"));
{
length = strlen (_("away") + 64 + 1);
buf = malloc (length);
if (buf)
{
snprintf (buf, length, "%s%s",
IRC_COLOR_ITEM_AWAY,
_("away"));
return buf;
}
}
}
return NULL;
+23
View File
@@ -66,6 +66,7 @@ struct t_config_option *irc_config_look_topic_strip_colors;
struct t_config_option *irc_config_color_message_join;
struct t_config_option *irc_config_color_message_quit;
struct t_config_option *irc_config_color_input_nick;
struct t_config_option *irc_config_color_item_away;
/* IRC config, network section */
@@ -271,6 +272,22 @@ irc_config_change_color_input_nick (void *data,
weechat_bar_item_update ("input_prompt");
}
/*
* irc_config_change_color_item_away: called when the color of away item is
* changed
*/
void
irc_config_change_color_item_away (void *data,
struct t_config_option *option)
{
/* make C compiler happy */
(void) data;
(void) option;
weechat_bar_item_update ("away");
}
/*
* irc_config_change_network_away_check: called when away check is changed
*/
@@ -1167,6 +1184,12 @@ irc_config_init ()
N_("color for nick in input bar"),
NULL, -1, 0, "lightcyan", NULL, 0, NULL, NULL,
&irc_config_change_color_input_nick, NULL, NULL, NULL);
irc_config_color_item_away = weechat_config_new_option (
irc_config_file, ptr_section,
"item_away", "color",
N_("color for away item"),
NULL, -1, 0, "yellow", NULL, 0, NULL, NULL,
&irc_config_change_color_item_away, NULL, NULL, NULL);
/* network */
ptr_section = weechat_config_new_section (irc_config_file, "network",
+1
View File
@@ -62,6 +62,7 @@ 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;
extern struct t_config_option *irc_config_color_input_nick;
extern struct t_config_option *irc_config_color_item_away;
extern struct t_config_option *irc_config_network_default_msg_part;
extern struct t_config_option *irc_config_network_default_msg_quit;
+1
View File
@@ -63,6 +63,7 @@
#define IRC_COLOR_MESSAGE_JOIN weechat_color(weechat_config_string(irc_config_color_message_join))
#define IRC_COLOR_MESSAGE_QUIT weechat_color(weechat_config_string(irc_config_color_message_quit))
#define IRC_COLOR_INPUT_NICK weechat_color(weechat_config_string(irc_config_color_input_nick))
#define IRC_COLOR_ITEM_AWAY weechat_color(weechat_config_string(irc_config_color_item_away))
#define IRC_COLOR_NICK_IN_SERVER_MESSAGE(nick) \
((nick && weechat_config_boolean(irc_config_look_color_nicks_in_server_messages)) ? \
nick->color : IRC_COLOR_CHAT_NICK)