From dcb8fcb6ed415f0c936093cbc80ecf9396485a9a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Helleu?= Date: Sun, 12 May 2024 09:45:53 +0200 Subject: [PATCH] irc: rename option irc.color.item_channel_modes to weechat.color.status_modes --- ChangeLog.adoc | 1 + ReleaseNotes.adoc | 6 ++++++ src/core/core-config.c | 9 +++++++++ src/core/core-config.h | 1 + src/gui/gui-bar-item.c | 11 +++++++++-- src/plugins/irc/irc-channel.c | 18 +++++------------- src/plugins/irc/irc-color.h | 1 - src/plugins/irc/irc-config.c | 9 --------- src/plugins/irc/irc-config.h | 1 - 9 files changed, 31 insertions(+), 26 deletions(-) diff --git a/ChangeLog.adoc b/ChangeLog.adoc index 4f47f434d..40b573829 100644 --- a/ChangeLog.adoc +++ b/ChangeLog.adoc @@ -43,6 +43,7 @@ New features:: * api: add support of specifier `%!` for timestamp in function util_strftimeval * api: add support of base64url in encode/decode functions * fset: add option `-import` in command `/fset` + * irc: rename option irc.color.item_channel_modes to weechat.color.status_modes * irc: add option `-all` in command `/allchan`, do not execute command on parted channels by default (issue #2085) * irc: add server option "autojoin_delay" (delay before autojoin), use option "command_delay" before execution of the command (issue #862) * relay: add "api" protocol (HTTP REST API), add option relay.look.display_clients, change option type relay.look.auto_open_buffer to string, rename option relay.weechat.commands to relay.network.commands, add option relay.network.time_window (issue #2066) diff --git a/ReleaseNotes.adoc b/ReleaseNotes.adoc index 51cc454a3..57246de99 100644 --- a/ReleaseNotes.adoc +++ b/ReleaseNotes.adoc @@ -14,6 +14,12 @@ For a complete list of changes, please look at ChangeLog. [[v4.3.0]] == Version 4.3.0 (under dev) +[[v4.3.0_irc_color_channel_modes]] +=== Color of IRC channel modes + +The option `irc.color.item_channel_modes` has been moved to core and renamed to +`weechat.color.status_modes`. + [[v4.3.0_signal_buffer_line_added]] === Signal "buffer_line_added" diff --git a/src/core/core-config.c b/src/core/core-config.c index 73f9bb542..9258ab0ee 100644 --- a/src/core/core-config.c +++ b/src/core/core-config.c @@ -285,6 +285,7 @@ struct t_config_option *config_color_status_data_msg = NULL; struct t_config_option *config_color_status_data_other = NULL; struct t_config_option *config_color_status_data_private = NULL; struct t_config_option *config_color_status_filter = NULL; +struct t_config_option *config_color_status_modes = NULL; struct t_config_option *config_color_status_more = NULL; struct t_config_option *config_color_status_mouse = NULL; struct t_config_option *config_color_status_name = NULL; @@ -4881,6 +4882,14 @@ config_weechat_init_options () NULL, NULL, NULL, &config_change_color, NULL, NULL, NULL, NULL, NULL); + config_color_status_modes = config_file_new_option ( + weechat_config_file, weechat_config_section_color, + "status_modes", "color", + N_("text color for buffer modes in status bar"), + NULL, -1, 0, "default", NULL, 0, + NULL, NULL, NULL, + &config_change_color, NULL, NULL, + NULL, NULL, NULL); config_color_status_more = config_file_new_option ( weechat_config_file, weechat_config_section_color, "status_more", "color", diff --git a/src/core/core-config.h b/src/core/core-config.h index 95d4881cd..2c7226bf2 100644 --- a/src/core/core-config.h +++ b/src/core/core-config.h @@ -337,6 +337,7 @@ extern struct t_config_option *config_color_status_data_msg; extern struct t_config_option *config_color_status_data_other; extern struct t_config_option *config_color_status_data_private; extern struct t_config_option *config_color_status_filter; +extern struct t_config_option *config_color_status_modes; extern struct t_config_option *config_color_status_more; extern struct t_config_option *config_color_status_mouse; extern struct t_config_option *config_color_status_name; diff --git a/src/gui/gui-bar-item.c b/src/gui/gui-bar-item.c index 3b6ded033..e53fa4c7d 100644 --- a/src/gui/gui-bar-item.c +++ b/src/gui/gui-bar-item.c @@ -1296,6 +1296,8 @@ gui_bar_item_buffer_modes_cb (const void *pointer, void *data, struct t_gui_buffer *buffer, struct t_hashtable *extra_info) { + char *modes; + /* make C compiler happy */ (void) pointer; (void) data; @@ -1303,10 +1305,15 @@ gui_bar_item_buffer_modes_cb (const void *pointer, void *data, (void) window; (void) extra_info; - if (!buffer) + if (!buffer || !buffer->modes) return NULL; - return (buffer->modes) ? strdup (buffer->modes) : NULL; + string_asprintf ( + &modes, + "%s%s", + gui_color_get_custom (gui_color_get_name (CONFIG_COLOR(config_color_status_modes))), + buffer->modes); + return modes; } /* diff --git a/src/plugins/irc/irc-channel.c b/src/plugins/irc/irc-channel.c index b97d7fbba..65ccbcc5f 100644 --- a/src/plugins/irc/irc-channel.c +++ b/src/plugins/irc/irc-channel.c @@ -578,7 +578,7 @@ void irc_channel_set_buffer_modes (struct t_irc_server *server, struct t_irc_channel *channel) { - char *modes, *modes_without_args; + char *modes_without_args; const char *pos_space; if (!server || !channel || !channel->buffer) @@ -599,18 +599,10 @@ irc_channel_set_buffer_modes (struct t_irc_server *server, channel->modes, pos_space - channel->modes); } } - if (weechat_asprintf ( - &modes, "%s%s", - IRC_COLOR_ITEM_CHANNEL_MODES, - (modes_without_args) ? modes_without_args : channel->modes) >= 0) - { - weechat_buffer_set (channel->buffer, "modes", modes); - free (modes); - } - else - { - weechat_buffer_set (channel->buffer, "modes", ""); - } + weechat_buffer_set ( + channel->buffer, + "modes", + (modes_without_args) ? modes_without_args : channel->modes); free (modes_without_args); } else diff --git a/src/plugins/irc/irc-color.h b/src/plugins/irc/irc-color.h index 3f6592c61..b236355ac 100644 --- a/src/plugins/irc/irc-color.h +++ b/src/plugins/irc/irc-color.h @@ -97,7 +97,6 @@ #define IRC_COLOR_TOPIC_NEW weechat_color(weechat_config_string(irc_config_color_topic_new)) #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_ITEM_CHANNEL_MODES weechat_color(weechat_config_string(irc_config_color_item_channel_modes)) #define IRC_COLOR_ITEM_LAG_COUNTING weechat_color(weechat_config_string(irc_config_color_item_lag_counting)) #define IRC_COLOR_ITEM_LAG_FINISHED weechat_color(weechat_config_string(irc_config_color_item_lag_finished)) #define IRC_COLOR_ITEM_NICK_MODES weechat_color(weechat_config_string(irc_config_color_item_nick_modes)) diff --git a/src/plugins/irc/irc-config.c b/src/plugins/irc/irc-config.c index aff6e27a8..f10278aad 100644 --- a/src/plugins/irc/irc-config.c +++ b/src/plugins/irc/irc-config.c @@ -135,7 +135,6 @@ struct t_config_option *irc_config_look_topic_strip_colors = NULL; /* IRC config, color section */ struct t_config_option *irc_config_color_input_nick = NULL; -struct t_config_option *irc_config_color_item_channel_modes = NULL; struct t_config_option *irc_config_color_item_lag_counting = NULL; struct t_config_option *irc_config_color_item_lag_finished = NULL; struct t_config_option *irc_config_color_item_nick_modes = NULL; @@ -3727,14 +3726,6 @@ irc_config_init () NULL, NULL, NULL, &irc_config_change_buffer_input_prompt, NULL, NULL, NULL, NULL, NULL); - irc_config_color_item_channel_modes = weechat_config_new_option ( - irc_config_file, irc_config_section_color, - "item_channel_modes", "color", - N_("color for channel modes, near channel name"), - NULL, -1, 0, "default", NULL, 0, - NULL, NULL, NULL, - &irc_config_change_buffer_modes, NULL, NULL, - NULL, NULL, NULL); irc_config_color_item_lag_counting = weechat_config_new_option ( irc_config_file, irc_config_section_color, "item_lag_counting", "color", diff --git a/src/plugins/irc/irc-config.h b/src/plugins/irc/irc-config.h index eb905becd..9a216593c 100644 --- a/src/plugins/irc/irc-config.h +++ b/src/plugins/irc/irc-config.h @@ -168,7 +168,6 @@ extern struct t_config_option *irc_config_look_temporary_servers; extern struct t_config_option *irc_config_look_topic_strip_colors; extern struct t_config_option *irc_config_color_input_nick; -extern struct t_config_option *irc_config_color_item_channel_modes; extern struct t_config_option *irc_config_color_item_lag_counting; extern struct t_config_option *irc_config_color_item_lag_finished; extern struct t_config_option *irc_config_color_item_nick_modes;