Skip to content

Commit

Permalink
core: add option weechat.color.status_name_insecure (issue #1920)
Browse files Browse the repository at this point in the history
Default value of option weechat.color.status_name_tls is set to white instead
of lightgreen.

Now all servers/channels connected with TLS are white, and those without TLS
are lightmagenta.
  • Loading branch information
flashcode committed Apr 26, 2023
1 parent e8c48c0 commit 6f0440e
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 6 deletions.
14 changes: 12 additions & 2 deletions src/core/wee-config.c
Expand Up @@ -282,6 +282,7 @@ struct t_config_option *config_color_status_filter = 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;
struct t_config_option *config_color_status_name_insecure = NULL;
struct t_config_option *config_color_status_name_tls = NULL;
struct t_config_option *config_color_status_nicklist_count = NULL;
struct t_config_option *config_color_status_number = NULL;
Expand Down Expand Up @@ -4547,12 +4548,21 @@ config_weechat_init_options ()
NULL, NULL, NULL,
&config_change_color, NULL, NULL,
NULL, NULL, NULL);
config_color_status_name_insecure = config_file_new_option (
weechat_config_file, weechat_config_section_color,
"status_name_insecure", "color",
N_("text color for current buffer name in status bar, if data are "
"exchanged and not secured with a protocol like TLS"),
NULL, -1, 0, "lightmagenta", NULL, 0,
NULL, NULL, NULL,
&config_change_color, NULL, NULL,
NULL, NULL, NULL);
config_color_status_name_tls = config_file_new_option (
weechat_config_file, weechat_config_section_color,
"status_name_tls", "color",
N_("text color for current buffer name in status bar, if data are "
"secured with a protocol like TLS"),
NULL, -1, 0, "lightgreen", NULL, 0,
"exchanged and secured with a protocol like TLS"),
NULL, -1, 0, "white", NULL, 0,
NULL, NULL, NULL,
&config_change_color, NULL, NULL,
NULL, NULL, NULL);
Expand Down
8 changes: 4 additions & 4 deletions src/plugins/irc/irc-bar-item.c
Expand Up @@ -137,7 +137,7 @@ irc_bar_item_buffer_name_content (struct t_gui_buffer *buffer, int short_name)
snprintf (buf_name, sizeof (buf_name), "%s%s[%s%s%s]",
_("server"),
IRC_COLOR_BAR_DELIM,
(server && server->tls_connected) ? IRC_COLOR_STATUS_NAME_TLS : IRC_COLOR_STATUS_NAME,
(server && server->tls_connected) ? IRC_COLOR_STATUS_NAME_TLS : IRC_COLOR_STATUS_NAME_INSECURE,
server->name,
IRC_COLOR_BAR_DELIM);
}
Expand All @@ -151,11 +151,11 @@ irc_bar_item_buffer_name_content (struct t_gui_buffer *buffer, int short_name)
"%s%s%s%s%s%s%s%s%s%s",
(part_from_channel) ? IRC_COLOR_BAR_DELIM : "",
(part_from_channel) ? "(" : "",
(server && server->tls_connected) ? IRC_COLOR_STATUS_NAME_TLS : IRC_COLOR_STATUS_NAME,
(server && server->tls_connected) ? IRC_COLOR_STATUS_NAME_TLS : IRC_COLOR_STATUS_NAME_INSECURE,
(server && display_server) ? server->name : "",
(server && display_server) ? IRC_COLOR_BAR_DELIM : "",
(server && display_server) ? "/" : "",
(server && server->tls_connected) ? IRC_COLOR_STATUS_NAME_TLS : IRC_COLOR_STATUS_NAME,
(server && server->tls_connected) ? IRC_COLOR_STATUS_NAME_TLS : IRC_COLOR_STATUS_NAME_INSECURE,
(short_name) ? weechat_buffer_get_string (buffer, "short_name") : channel->name,
(part_from_channel) ? IRC_COLOR_BAR_DELIM : "",
(part_from_channel) ? ")" : "");
Expand Down Expand Up @@ -190,7 +190,7 @@ irc_bar_item_buffer_name_content (struct t_gui_buffer *buffer, int short_name)

snprintf (buf, sizeof (buf),
"%s%s",
(server && server->tls_connected) ? IRC_COLOR_STATUS_NAME_TLS : IRC_COLOR_STATUS_NAME,
(server && server->tls_connected) ? IRC_COLOR_STATUS_NAME_TLS : IRC_COLOR_STATUS_NAME_INSECURE,
buf_name);

return strdup (buf);
Expand Down
1 change: 1 addition & 0 deletions src/plugins/irc/irc-color.h
Expand Up @@ -82,6 +82,7 @@
#define IRC_COLOR_NOTICE weechat_color(weechat_config_string(irc_config_color_notice))
#define IRC_COLOR_STATUS_NUMBER weechat_color("status_number")
#define IRC_COLOR_STATUS_NAME weechat_color("status_name")
#define IRC_COLOR_STATUS_NAME_INSECURE weechat_color("status_name_insecure")
#define IRC_COLOR_STATUS_NAME_TLS weechat_color("status_name_tls")
#define IRC_COLOR_MESSAGE_JOIN weechat_color(weechat_config_string(irc_config_color_message_join))
#define IRC_COLOR_MESSAGE_ACCOUNT weechat_color(weechat_config_string(irc_config_color_message_account))
Expand Down

0 comments on commit 6f0440e

Please sign in to comment.