1
0
mirror of https://github.com/weechat/weechat.git synced 2026-07-10 01:05:42 +02:00

irc: compute hash to find nick color for nick in server message when nick is not in nicklist

This commit is contained in:
Sebastien Helleu
2012-03-06 18:03:03 +01:00
parent 0552bdefa0
commit fe3bdb5f52
6 changed files with 49 additions and 24 deletions
+2
View File
@@ -11,6 +11,8 @@ Version 0.3.8 (under dev!)
weechat.look.paste_bracketed (task #11316)
* core: fix display of wide chars on last column of chat area (patch #7733)
* api: add list "gui_buffer_last_displayed" in hdata "buffer"
* irc: compute hash to find nick color for nick in server message when nick
is not in nicklist
* irc: add support of "external" SASL mechanism (task #11864)
* irc: close server buffer when server is deleted
* irc: add search for lower case nicks in option irc.look.nick_color_force
+1 -1
View File
@@ -778,7 +778,7 @@ irc_channel_display_nick_back_in_pv (struct t_irc_server *server,
weechat_printf (ptr_channel->buffer,
_("%s%s%s %s(%s%s%s)%s is back on server"),
weechat_prefix ("join"),
IRC_COLOR_NICK_IN_SERVER_MESSAGE(nick),
irc_nick_color_for_server_message (nick, nickname),
(nick) ? nick->name : nickname,
IRC_COLOR_CHAT_DELIMITERS,
IRC_COLOR_CHAT_HOST,
-3
View File
@@ -89,9 +89,6 @@
#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_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);
+24
View File
@@ -134,6 +134,8 @@ irc_nick_strdup_for_color (const char *nickname)
/*
* irc_nick_hash_color: hash a nickname to find color
* return a number which is the index of color in the
* nicks colors of option weechat.color.chat_nick_colors
*/
int
@@ -162,6 +164,7 @@ irc_nick_hash_color (const char *nickname)
/*
* irc_nick_get_forced_color: get forced color for a nick
* (NULL if no color is forced for nick)
* return name of color (example: "green")
*/
const char *
@@ -193,6 +196,7 @@ irc_nick_get_forced_color (const char *nickname)
/*
* irc_nick_find_color: find a color code for a nick
* (according to nick letters)
* return a WeeChat color code
*/
const char *
@@ -231,6 +235,7 @@ irc_nick_find_color (const char *nickname)
/*
* irc_nick_find_color_name: find a color name for a nick
* (according to nick letters)
* return name of color (example: "green")
*/
const char *
@@ -931,6 +936,25 @@ irc_nick_as_prefix (struct t_irc_server *server, struct t_irc_nick *nick,
return result;
}
/*
* irc_nick_color_for_server_message: return WeeChat color code for a nick
* (used in a server message)
*/
const char *
irc_nick_color_for_server_message (struct t_irc_nick *nick,
const char *nickname)
{
if (weechat_config_boolean(irc_config_look_color_nicks_in_server_messages))
{
if (nick)
return nick->color;
if (nickname)
return irc_nick_find_color (nickname);
}
return IRC_COLOR_CHAT_NICK;
}
/*
* irc_nick_color_for_pv: return string with color of nick for private
*/
+2
View File
@@ -89,6 +89,8 @@ extern char *irc_nick_as_prefix (struct t_irc_server *server,
struct t_irc_nick *nick,
const char *nickname,
const char *force_color);
extern const char *irc_nick_color_for_server_message (struct t_irc_nick *nick,
const char *nickname);
extern const char * irc_nick_color_for_pv (struct t_irc_channel *channel,
const char *nickname);
extern struct t_hdata *irc_nick_hdata_nick_cb (void *data,
File diff suppressed because it is too large Load Diff