1
0
mirror of https://github.com/weechat/weechat.git synced 2026-07-03 00:03:12 +02:00

irc: fix display of reply for CTCP request received on a channel when capability echo-message is enabled

This commit is contained in:
Sébastien Helleu
2024-04-06 22:44:04 +02:00
parent 2c3c9a3ee7
commit 40bfded594
5 changed files with 213 additions and 80 deletions
+30 -25
View File
@@ -2538,10 +2538,24 @@ IRC_PROTOCOL_CALLBACK(notice)
weechat_hashtable_set (ctxt->server->echo_msg_recv,
ctxt->irc_message, &time_now);
}
if (!cap_echo_message || !msg_already_received)
if (!cap_echo_message || !ctxt->nick_is_me)
{
irc_ctcp_display_reply_from_nick (ctxt, pos_args);
}
else
{
if (msg_already_received)
{
irc_ctcp_display_reply_from_nick (ctxt, pos_args);
}
else
{
irc_ctcp_display_reply_to_nick (
ctxt,
(ctxt->nick_is_me) ? pos_target : ctxt->nick,
pos_args);
}
}
if (msg_already_received)
weechat_hashtable_remove (ctxt->server->echo_msg_recv, ctxt->irc_message);
}
@@ -3033,36 +3047,27 @@ irc_protocol_privmsg_display_ctcp_send (struct t_irc_protocol_ctxt *ctxt,
const char *target,
const char *arguments)
{
const char *pos_space, *pos_end;
char *ctcp_type, *ctcp_args;
if (!arguments || !arguments[0])
return;
pos_end = strrchr (arguments + 1, '\01');
if (!pos_end)
return;
irc_ctcp_parse_type_arguments (arguments, &ctcp_type, &ctcp_args);
pos_space = strchr (arguments + 1, ' ');
ctcp_type = weechat_strndup (
arguments + 1,
(pos_space) ?
pos_space - arguments - 1 : pos_end - arguments - 1);
ctcp_args = (pos_space) ?
weechat_strndup (pos_space + 1, pos_end - pos_space - 1) : NULL;
irc_input_user_message_display (
ctxt->server,
ctxt->date,
ctxt->date_usec,
ctxt->tags,
target,
ctxt->address,
"privmsg",
ctcp_type,
ctcp_args,
0); /* decode_colors */
if (ctcp_type)
{
irc_input_user_message_display (
ctxt->server,
ctxt->date,
ctxt->date_usec,
ctxt->tags,
target,
ctxt->address,
"privmsg",
ctcp_type,
ctcp_args,
0); /* decode_colors */
}
if (ctcp_type)
free (ctcp_type);