1
0
mirror of https://github.com/weechat/weechat.git synced 2026-06-27 21:36:37 +02:00

irc: compute color in case insensitive way (closes #194)

Reintroduce infos "irc_nick_color" and "irc_nick_color_name" (that were
marked deprecated since version 1.5).

A server name is added in the two infos and is optional, for backward
compatibility.
This commit is contained in:
Sébastien Helleu
2023-08-24 09:05:35 +02:00
parent c2426e88c9
commit 6aa66b5363
23 changed files with 777 additions and 365 deletions
+13 -8
View File
@@ -2310,8 +2310,8 @@ IRC_PROTOCOL_CALLBACK(nick)
{
if (weechat_config_boolean (irc_config_look_color_pv_nick_like_channel))
{
old_color = irc_nick_find_color (nick);
new_color = irc_nick_find_color (params[0]);
old_color = irc_nick_find_color (server, nick);
new_color = irc_nick_find_color (server, params[0]);
}
else
{
@@ -3190,6 +3190,7 @@ IRC_PROTOCOL_CALLBACK(privmsg)
else
{
color = irc_nick_find_color_name (
server,
(ptr_nick) ? ptr_nick->name : nick);
str_color = irc_color_for_tags (color);
if (color)
@@ -3297,7 +3298,7 @@ IRC_PROTOCOL_CALLBACK(privmsg)
{
if (weechat_config_boolean (irc_config_look_color_pv_nick_like_channel))
{
color = irc_nick_find_color_name (nick);
color = irc_nick_find_color_name (server, nick);
str_color = irc_color_for_tags (color);
if (color)
free (color);
@@ -3336,7 +3337,9 @@ IRC_PROTOCOL_CALLBACK(privmsg)
irc_nick_as_prefix (
server, NULL, nick,
(nick_is_me) ?
IRC_COLOR_CHAT_NICK_SELF : irc_nick_color_for_pv (ptr_channel, nick)),
IRC_COLOR_CHAT_NICK_SELF : irc_nick_color_for_pv (server,
ptr_channel,
nick)),
(msg_args2) ? msg_args2 : msg_args);
if (msg_args2)
free (msg_args2);
@@ -3429,7 +3432,8 @@ IRC_PROTOCOL_CALLBACK(quit)
_("%s%s%s%s%s%s%s%s%s%s has quit %s(%s%s%s)"),
weechat_prefix ("quit"),
(ptr_channel->type == IRC_CHANNEL_TYPE_PRIVATE) ?
irc_nick_color_for_pv (ptr_channel, nick) : irc_nick_color_for_msg (server, 1, ptr_nick, nick),
irc_nick_color_for_pv (server, ptr_channel, nick) :
irc_nick_color_for_msg (server, 1, ptr_nick, nick),
nick,
IRC_COLOR_CHAT_DELIMITERS,
(display_host) ? " (" : "",
@@ -3463,7 +3467,8 @@ IRC_PROTOCOL_CALLBACK(quit)
_("%s%s%s%s%s%s%s%s%s%s has quit"),
weechat_prefix ("quit"),
(ptr_channel->type == IRC_CHANNEL_TYPE_PRIVATE) ?
irc_nick_color_for_pv (ptr_channel, nick) : irc_nick_color_for_msg (server, 1, ptr_nick, nick),
irc_nick_color_for_pv (server, ptr_channel, nick) :
irc_nick_color_for_msg (server, 1, ptr_nick, nick),
nick,
IRC_COLOR_CHAT_DELIMITERS,
(display_host) ? " (" : "",
@@ -6292,7 +6297,7 @@ IRC_PROTOCOL_CALLBACK(353)
}
else
{
color = irc_nick_find_color (nickname);
color = irc_nick_find_color (server, nickname);
weechat_string_dyn_concat (str_nicks, color, -1);
if (color)
free (color);
@@ -6551,7 +6556,7 @@ IRC_PROTOCOL_CALLBACK(366)
}
else
{
color = irc_nick_find_color (nickname);
color = irc_nick_find_color (server, nickname);
weechat_string_dyn_concat (str_nicks, color, -1);
if (color)
free (color);