diff --git a/src/plugins/irc/irc-protocol.c b/src/plugins/irc/irc-protocol.c index 951239815..b818f176a 100644 --- a/src/plugins/irc/irc-protocol.c +++ b/src/plugins/irc/irc-protocol.c @@ -3014,7 +3014,7 @@ irc_protocol_privmsg_display_ctcp_send (struct t_irc_server *server, IRC_PROTOCOL_CALLBACK(privmsg) { - char *msg_args, str_tags[1024], *str_color, *color; + char *msg_args, *msg_args2, str_tags[1024], *str_color, *color; const char *pos_target, *remote_nick, *pv_tags; int status_msg, is_channel, nick_is_me; struct t_irc_channel *ptr_channel; @@ -3249,6 +3249,8 @@ IRC_PROTOCOL_CALLBACK(privmsg) } if (str_color) free (str_color); + msg_args2 = (nick_is_me) ? + irc_message_hide_password (server, remote_nick, msg_args) : NULL; weechat_printf_date_tags ( ptr_channel->buffer, date, @@ -3258,7 +3260,9 @@ IRC_PROTOCOL_CALLBACK(privmsg) server, NULL, nick, (nick_is_me) ? IRC_COLOR_CHAT_NICK_SELF : irc_nick_color_for_pv (ptr_channel, nick)), - msg_args); + (msg_args2) ? msg_args2 : msg_args); + if (msg_args2) + free (msg_args2); if (ptr_channel->has_quit_server) ptr_channel->has_quit_server = 0; diff --git a/tests/unit/plugins/irc/test-irc-protocol.cpp b/tests/unit/plugins/irc/test-irc-protocol.cpp index 11ade2058..34aa242ff 100644 --- a/tests/unit/plugins/irc/test-irc-protocol.cpp +++ b/tests/unit/plugins/irc/test-irc-protocol.cpp @@ -2744,6 +2744,15 @@ TEST(IrcProtocolWithServer, privmsg) "irc_privmsg,self_msg,notify_none,no_highlight," "prefix_nick_white,nick_alice,host_user@host,log1"); + /* + * message from self nick in private, with password hidden (nickserv) + * (case of bouncer of if echo-message capability is enabled) + */ + RECV(":alice!user@host PRIVMSG nickserv :identify secret"); + CHECK_PV("nickserv", "alice", "identify ******", + "irc_privmsg,self_msg,notify_none,no_highlight," + "prefix_nick_white,nick_alice,host_user@host,log1"); + /* broken CTCP to channel */ RECV(":bob!user@host PRIVMSG #test :\01"); CHECK_CHAN("--", "Unknown CTCP requested by bob: ",