diff options
author | Sébastien Helleu <flashcode@flashtux.org> | 2021-08-01 10:30:06 +0200 |
---|---|---|
committer | Sébastien Helleu <flashcode@flashtux.org> | 2021-08-01 10:30:06 +0200 |
commit | 72a9b87c1c0ecdc5c951a2e9e4d76c729a22e138 (patch) | |
tree | f339534342d2f919452c2f8406a30dd15d22834d /src/plugins/irc | |
parent | 88d59de94009510012df9a3e03996e6ee8d6997c (diff) | |
download | weechat-72a9b87c1c0ecdc5c951a2e9e4d76c729a22e138.zip |
irc: display a different message for setname applied on self and other nicks (closes #1676)
Diffstat (limited to 'src/plugins/irc')
-rw-r--r-- | src/plugins/irc/irc-protocol.c | 33 |
1 files changed, 26 insertions, 7 deletions
diff --git a/src/plugins/irc/irc-protocol.c b/src/plugins/irc/irc-protocol.c index 99ba1435d..366ee8b1c 100644 --- a/src/plugins/irc/irc-protocol.c +++ b/src/plugins/irc/irc-protocol.c @@ -2903,12 +2903,15 @@ IRC_PROTOCOL_CALLBACK(quit) IRC_PROTOCOL_CALLBACK(setname) { + int local_setname; struct t_irc_channel *ptr_channel; struct t_irc_nick *ptr_nick; char *pos_realname, *realname_color; IRC_PROTOCOL_MIN_ARGS(3); + local_setname = (irc_server_strcasecmp (server, nick, server->nick) == 0); + pos_realname = (argv_eol[2][0] == ':') ? argv_eol[2] + 1 : argv_eol[2]; if (weechat_hashtable_has_key (server->cap_list, "setname")) @@ -2931,13 +2934,29 @@ IRC_PROTOCOL_CALLBACK(setname) realname_color = irc_color_decode ( pos_realname, weechat_config_boolean (irc_config_network_colors_receive)); - weechat_printf_date_tags ( - irc_msgbuffer_get_target_buffer (server, NULL, command, NULL, NULL), - date, - irc_protocol_tags (command, NULL, NULL, NULL), - _("%sReal name set to: %s"), - weechat_prefix ("network"), - (realname_color) ? realname_color : ""); + if (local_setname) + { + weechat_printf_date_tags ( + irc_msgbuffer_get_target_buffer (server, NULL, command, NULL, NULL), + date, + irc_protocol_tags (command, NULL, NULL, NULL), + _("%sYour real name has been set to \"%s\""), + weechat_prefix ("network"), + (realname_color) ? realname_color : ""); + } + else + { + weechat_printf_date_tags ( + irc_msgbuffer_get_target_buffer (server, NULL, command, NULL, NULL), + date, + irc_protocol_tags (command, NULL, NULL, NULL), + _("%sReal name of %s%s%s has been set to \"%s\""), + weechat_prefix ("network"), + irc_nick_color_for_msg (server, 1, NULL, nick), + nick, + IRC_COLOR_RESET, + (realname_color) ? realname_color : ""); + } if (realname_color) free (realname_color); } |