1
0
mirror of https://github.com/weechat/weechat.git synced 2026-06-25 04:16:38 +02:00

irc: hide password in messages to nickserv with cap echo-message enabled (issue #139)

This commit is contained in:
Sébastien Helleu
2023-05-29 09:49:41 +02:00
parent ea38779c85
commit 031bcf5ff2
2 changed files with 15 additions and 2 deletions
+6 -2
View File
@@ -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;
@@ -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: ",