summaryrefslogtreecommitdiff
path: root/src/plugins
diff options
context:
space:
mode:
authorSebastien Helleu <flashcode@flashtux.org>2010-04-20 22:19:43 +0200
committerSebastien Helleu <flashcode@flashtux.org>2010-04-20 22:19:43 +0200
commit9cbcc24d4c19c6a37b0f0c7948955ec4f0cd73be (patch)
tree823130a84def56758981f788d0dace07f2753e3f /src/plugins
parentb06c02f199ad5d3356d5b9504c9acd5c4b513e1f (diff)
downloadweechat-9cbcc24d4c19c6a37b0f0c7948955ec4f0cd73be.zip
Add new option irc.color.item_buffer_name_ssl (task #10339)
Diffstat (limited to 'src/plugins')
-rw-r--r--src/plugins/irc/irc-bar-item.c8
-rw-r--r--src/plugins/irc/irc-color.h32
-rw-r--r--src/plugins/irc/irc-config.c17
-rw-r--r--src/plugins/irc/irc-config.h1
-rw-r--r--src/plugins/irc/irc-display.c1
-rw-r--r--src/plugins/irc/irc-nick.c1
-rw-r--r--src/plugins/irc/irc.h29
7 files changed, 51 insertions, 38 deletions
diff --git a/src/plugins/irc/irc-bar-item.c b/src/plugins/irc/irc-bar-item.c
index 647973617..c791e674a 100644
--- a/src/plugins/irc/irc-bar-item.c
+++ b/src/plugins/irc/irc-bar-item.c
@@ -206,7 +206,7 @@ irc_bar_item_buffer_name (void *data, struct t_gui_bar_item *item,
snprintf (buf_name, sizeof (buf_name), "%s%s[%s%s%s]",
_("server"),
IRC_COLOR_BAR_DELIM,
- IRC_COLOR_STATUS_NAME,
+ (server && server->ssl_connected) ? IRC_COLOR_STATUS_NAME_SSL : IRC_COLOR_STATUS_NAME,
server->name,
IRC_COLOR_BAR_DELIM);
}
@@ -220,11 +220,11 @@ irc_bar_item_buffer_name (void *data, struct t_gui_bar_item *item,
"%s%s%s%s%s%s%s%s%s%s",
(part_from_channel) ? IRC_COLOR_BAR_DELIM : "",
(part_from_channel) ? "(" : "",
- IRC_COLOR_STATUS_NAME,
+ (server && server->ssl_connected) ? IRC_COLOR_STATUS_NAME_SSL : IRC_COLOR_STATUS_NAME,
(display_server) ? server->name : "",
(display_server) ? IRC_COLOR_BAR_DELIM : "",
(display_server) ? "/" : "",
- IRC_COLOR_STATUS_NAME,
+ (server && server->ssl_connected) ? IRC_COLOR_STATUS_NAME_SSL : IRC_COLOR_STATUS_NAME,
channel->name,
(part_from_channel) ? IRC_COLOR_BAR_DELIM : "",
(part_from_channel) ? ")" : "");
@@ -267,7 +267,7 @@ irc_bar_item_buffer_name (void *data, struct t_gui_bar_item *item,
}
snprintf (buf, sizeof (buf), "%s%s%s",
- IRC_COLOR_STATUS_NAME,
+ (server && server->ssl_connected) ? IRC_COLOR_STATUS_NAME_SSL : IRC_COLOR_STATUS_NAME,
buf_name,
modes);
return strdup (buf);
diff --git a/src/plugins/irc/irc-color.h b/src/plugins/irc/irc-color.h
index bf81f820a..6e32b9f25 100644
--- a/src/plugins/irc/irc-color.h
+++ b/src/plugins/irc/irc-color.h
@@ -55,6 +55,38 @@
#define IRC_COLOR_UNDERLINE_CHAR '\x1F'
#define IRC_COLOR_UNDERLINE_STR "\x1F"
+/* macros for WeeChat core and IRC colors */
+
+#define IRC_COLOR_CHAT weechat_color("chat")
+#define IRC_COLOR_CHAT_CHANNEL weechat_color("chat_channel")
+#define IRC_COLOR_CHAT_DELIMITERS weechat_color("chat_delimiters")
+#define IRC_COLOR_CHAT_HOST weechat_color("chat_host")
+#define IRC_COLOR_CHAT_NICK weechat_color("chat_nick")
+#define IRC_COLOR_CHAT_NICK_SELF weechat_color("chat_nick_self")
+#define IRC_COLOR_CHAT_NICK_OTHER weechat_color("chat_nick_other")
+#define IRC_COLOR_CHAT_SERVER weechat_color("chat_server")
+#define IRC_COLOR_CHAT_VALUE weechat_color("chat_value")
+#define IRC_COLOR_NICKLIST_PREFIX1 weechat_color("nicklist_prefix1")
+#define IRC_COLOR_NICKLIST_PREFIX2 weechat_color("nicklist_prefix2")
+#define IRC_COLOR_NICKLIST_PREFIX3 weechat_color("nicklist_prefix3")
+#define IRC_COLOR_NICKLIST_PREFIX4 weechat_color("nicklist_prefix4")
+#define IRC_COLOR_NICKLIST_PREFIX5 weechat_color("nicklist_prefix5")
+#define IRC_COLOR_BAR_FG weechat_color("bar_fg")
+#define IRC_COLOR_BAR_BG weechat_color("bar_bg")
+#define IRC_COLOR_BAR_DELIM weechat_color("bar_delim")
+#define IRC_COLOR_STATUS_NUMBER weechat_color(weechat_config_string(weechat_config_get("weechat.color.status_number")))
+#define IRC_COLOR_STATUS_NAME weechat_color(weechat_config_string(weechat_config_get("weechat.color.status_name")))
+#define IRC_COLOR_STATUS_NAME_SSL weechat_color(weechat_config_string(irc_config_color_item_buffer_name_ssl))
+#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_NOTICE weechat_color(weechat_config_string(irc_config_color_notice))
+#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_NICK_IN_SERVER_MESSAGE(nick) \
+ ((nick && weechat_config_boolean(irc_config_look_color_nicks_in_server_messages)) ? \
+ nick->color : IRC_COLOR_CHAT_NICK)
+
extern char *irc_color_decode (const char *string, int keep_colors);
extern char *irc_color_decode_for_user_entry (const char *string);
extern char *irc_color_encode (const char *string, int keep_colors);
diff --git a/src/plugins/irc/irc-config.c b/src/plugins/irc/irc-config.c
index ab3e7e01d..b7c1d3d7d 100644
--- a/src/plugins/irc/irc-config.c
+++ b/src/plugins/irc/irc-config.c
@@ -87,6 +87,7 @@ struct t_config_option *irc_config_color_notice;
struct t_config_option *irc_config_color_input_nick;
struct t_config_option *irc_config_color_item_away;
struct t_config_option *irc_config_color_item_channel_modes;
+struct t_config_option *irc_config_color_item_buffer_name_ssl;
/* IRC config, network section */
@@ -389,13 +390,13 @@ irc_config_change_color_item_away (void *data,
}
/*
- * irc_config_change_color_item_channel_modes: called when the color of channel
- * modes is changed
+ * irc_config_change_color_item_buffer_name: called when the color of buffer
+ * name is changed
*/
void
-irc_config_change_color_item_channel_modes (void *data,
- struct t_config_option *option)
+irc_config_change_color_item_buffer_name (void *data,
+ struct t_config_option *option)
{
/* make C compiler happy */
(void) data;
@@ -1634,7 +1635,13 @@ irc_config_init ()
"item_channel_modes", "color",
N_("color for channel modes, near channel name"),
NULL, -1, 0, "default", NULL, 0, NULL, NULL,
- &irc_config_change_color_item_channel_modes, NULL, NULL, NULL);
+ &irc_config_change_color_item_buffer_name, NULL, NULL, NULL);
+ irc_config_color_item_buffer_name_ssl = weechat_config_new_option (
+ irc_config_file, ptr_section,
+ "item_buffer_name_ssl", "color",
+ N_("color for buffer name when connected using SSL to server"),
+ NULL, -1, 0, "lightgreen", NULL, 0, NULL, NULL,
+ &irc_config_change_color_item_buffer_name, NULL, NULL, NULL);
/* network */
ptr_section = weechat_config_new_section (irc_config_file, "network",
diff --git a/src/plugins/irc/irc-config.h b/src/plugins/irc/irc-config.h
index 381e54cbc..02b2ed4b0 100644
--- a/src/plugins/irc/irc-config.h
+++ b/src/plugins/irc/irc-config.h
@@ -105,6 +105,7 @@ extern struct t_config_option *irc_config_color_notice;
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_color_item_channel_modes;
+extern struct t_config_option *irc_config_color_item_buffer_name_ssl;
extern struct t_config_option *irc_config_network_connection_timeout;
extern struct t_config_option *irc_config_network_default_msg_part;
diff --git a/src/plugins/irc/irc-display.c b/src/plugins/irc/irc-display.c
index ca22b97c3..ba8346999 100644
--- a/src/plugins/irc/irc-display.c
+++ b/src/plugins/irc/irc-display.c
@@ -29,6 +29,7 @@
#include "../weechat-plugin.h"
#include "irc.h"
#include "irc-channel.h"
+#include "irc-color.h"
#include "irc-command.h"
#include "irc-config.h"
#include "irc-nick.h"
diff --git a/src/plugins/irc/irc-nick.c b/src/plugins/irc/irc-nick.c
index d2c77814b..6d0d3c47f 100644
--- a/src/plugins/irc/irc-nick.c
+++ b/src/plugins/irc/irc-nick.c
@@ -29,6 +29,7 @@
#include "../weechat-plugin.h"
#include "irc.h"
#include "irc-nick.h"
+#include "irc-color.h"
#include "irc-config.h"
#include "irc-server.h"
#include "irc-channel.h"
diff --git a/src/plugins/irc/irc.h b/src/plugins/irc/irc.h
index a9f43aedc..ed591ef06 100644
--- a/src/plugins/irc/irc.h
+++ b/src/plugins/irc/irc.h
@@ -23,35 +23,6 @@
#define weechat_plugin weechat_irc_plugin
#define IRC_PLUGIN_NAME "irc"
-#define IRC_COLOR_CHAT weechat_color("chat")
-#define IRC_COLOR_CHAT_CHANNEL weechat_color("chat_channel")
-#define IRC_COLOR_CHAT_DELIMITERS weechat_color("chat_delimiters")
-#define IRC_COLOR_CHAT_HOST weechat_color("chat_host")
-#define IRC_COLOR_CHAT_NICK weechat_color("chat_nick")
-#define IRC_COLOR_CHAT_NICK_SELF weechat_color("chat_nick_self")
-#define IRC_COLOR_CHAT_NICK_OTHER weechat_color("chat_nick_other")
-#define IRC_COLOR_CHAT_SERVER weechat_color("chat_server")
-#define IRC_COLOR_CHAT_VALUE weechat_color("chat_value")
-#define IRC_COLOR_NICKLIST_PREFIX1 weechat_color("nicklist_prefix1")
-#define IRC_COLOR_NICKLIST_PREFIX2 weechat_color("nicklist_prefix2")
-#define IRC_COLOR_NICKLIST_PREFIX3 weechat_color("nicklist_prefix3")
-#define IRC_COLOR_NICKLIST_PREFIX4 weechat_color("nicklist_prefix4")
-#define IRC_COLOR_NICKLIST_PREFIX5 weechat_color("nicklist_prefix5")
-#define IRC_COLOR_BAR_FG weechat_color("bar_fg")
-#define IRC_COLOR_BAR_BG weechat_color("bar_bg")
-#define IRC_COLOR_BAR_DELIM weechat_color("bar_delim")
-#define IRC_COLOR_STATUS_NUMBER weechat_color(weechat_config_string(weechat_config_get("weechat.color.status_number")))
-#define IRC_COLOR_STATUS_NAME weechat_color(weechat_config_string(weechat_config_get("weechat.color.status_name")))
-#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_NOTICE weechat_color(weechat_config_string(irc_config_color_notice))
-#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_NICK_IN_SERVER_MESSAGE(nick) \
- ((nick && weechat_config_boolean(irc_config_look_color_nicks_in_server_messages)) ? \
- nick->color : IRC_COLOR_CHAT_NICK)
-
extern struct t_weechat_plugin *weechat_irc_plugin;
extern struct t_hook *irc_hook_timer_check_away;