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:
@@ -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;
|
||||
|
||||
@@ -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",
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user