summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/plugins/irc/irc-color.c14
-rw-r--r--src/plugins/irc/irc-color.h1
-rw-r--r--src/plugins/irc/irc-input.c10
-rw-r--r--src/plugins/irc/irc-protocol.c34
4 files changed, 48 insertions, 11 deletions
diff --git a/src/plugins/irc/irc-color.c b/src/plugins/irc/irc-color.c
index 96e88986b..369324156 100644
--- a/src/plugins/irc/irc-color.c
+++ b/src/plugins/irc/irc-color.c
@@ -403,3 +403,17 @@ irc_color_modifier_cb (void *data, const char *modifier,
/* unknown modifier */
return NULL;
}
+
+/*
+ * irc_color_for_tags: return color name for tags (replace "," by ":")
+ * Note: result must be freed after use
+ */
+
+char *
+irc_color_for_tags (const char *color)
+{
+ if (!color)
+ return NULL;
+
+ return weechat_string_replace (color, ",", ":");
+}
diff --git a/src/plugins/irc/irc-color.h b/src/plugins/irc/irc-color.h
index 14bdad9fc..1a9040133 100644
--- a/src/plugins/irc/irc-color.h
+++ b/src/plugins/irc/irc-color.h
@@ -96,5 +96,6 @@ extern char *irc_color_encode (const char *string, int keep_colors);
extern char *irc_color_modifier_cb (void *data, const char *modifier,
const char *modifier_data,
const char *string);
+extern char *irc_color_for_tags (const char *color);
#endif /* __WEECHAT_IRC_COLOR_H */
diff --git a/src/plugins/irc/irc-input.c b/src/plugins/irc/irc-input.c
index c8e74c916..1c745d756 100644
--- a/src/plugins/irc/irc-input.c
+++ b/src/plugins/irc/irc-input.c
@@ -45,7 +45,7 @@ void
irc_input_user_message_display (struct t_gui_buffer *buffer, const char *text)
{
struct t_irc_nick *ptr_nick;
- char *text_decoded;
+ char *text_decoded, str_tags[256], *str_color;
text_decoded = irc_color_decode (text,
weechat_config_boolean (irc_config_network_colors_send));
@@ -61,9 +61,15 @@ irc_input_user_message_display (struct t_gui_buffer *buffer, const char *text)
ptr_server->nick);
}
+ str_color = irc_color_for_tags (weechat_config_color (weechat_config_get ("weechat.color.chat_nick_self")));
+ snprintf (str_tags, sizeof (str_tags),
+ "notify_none,no_highlight,prefix_nick_%s",
+ (str_color) ? str_color : "default");
+ if (str_color)
+ free (str_color);
weechat_printf_tags (buffer,
irc_protocol_tags ("privmsg",
- "notify_none,no_highlight",
+ str_tags,
(ptr_nick) ? ptr_nick->name : ptr_server->nick),
"%s%s",
irc_nick_as_prefix (ptr_server,
diff --git a/src/plugins/irc/irc-protocol.c b/src/plugins/irc/irc-protocol.c
index f572b5b78..c117d90eb 100644
--- a/src/plugins/irc/irc-protocol.c
+++ b/src/plugins/irc/irc-protocol.c
@@ -1468,7 +1468,7 @@ IRC_PROTOCOL_CALLBACK(pong)
IRC_PROTOCOL_CALLBACK(privmsg)
{
- char *pos_args, *pos_target;
+ char *pos_args, *pos_target, str_tags[256], *str_color;
const char *remote_nick;
int msg_op, msg_voice, is_channel, nick_is_me;
struct t_irc_channel *ptr_channel;
@@ -1559,10 +1559,14 @@ IRC_PROTOCOL_CALLBACK(privmsg)
else
{
/* standard message (to "#channel") */
+ str_color = irc_color_for_tags (irc_nick_find_color_name ((ptr_nick) ? ptr_nick->name : nick));
+ snprintf (str_tags, sizeof (str_tags),
+ "notify_message,prefix_nick_%s",
+ (str_color) ? str_color : "default");
+ if (str_color)
+ free (str_color);
weechat_printf_tags (ptr_channel->buffer,
- irc_protocol_tags (command,
- "notify_message",
- nick),
+ irc_protocol_tags (command, str_tags, nick),
"%s%s",
irc_nick_as_prefix (server, ptr_nick,
(ptr_nick) ? NULL : nick,
@@ -1615,12 +1619,24 @@ IRC_PROTOCOL_CALLBACK(privmsg)
}
irc_channel_set_topic (ptr_channel, address);
+ if (nick_is_me)
+ str_color = irc_color_for_tags (weechat_config_color (weechat_config_get ("weechat.color.chat_nick_self")));
+ else
+ {
+ if (weechat_config_boolean (irc_config_look_color_pv_nick_like_channel))
+ str_color = irc_color_for_tags (irc_nick_find_color_name (nick));
+ else
+ str_color = irc_color_for_tags (weechat_config_color (weechat_config_get ("weechat.color.chat_nick_other")));
+ }
+ snprintf (str_tags, sizeof (str_tags),
+ (nick_is_me) ?
+ "notify_none,no_highlight,prefix_nick_%s" :
+ "notify_private,prefix_nick_%s",
+ (str_color) ? str_color : "default");
+ if (str_color)
+ free (str_color);
weechat_printf_tags (ptr_channel->buffer,
- irc_protocol_tags (command,
- (nick_is_me) ?
- "notify_none,no_highlight" :
- "notify_private",
- nick),
+ irc_protocol_tags (command, str_tags, nick),
"%s%s",
irc_nick_as_prefix (server, NULL, nick,
(nick_is_me) ?