summaryrefslogtreecommitdiff
path: root/src/plugins/irc
diff options
context:
space:
mode:
authorSébastien Helleu <flashcode@flashtux.org>2023-09-14 11:10:17 +0200
committerSébastien Helleu <flashcode@flashtux.org>2023-09-14 11:10:17 +0200
commit4c3ab508c728c486306e21ed08ab98bc06e3aa95 (patch)
treee7979272ccc03912e00a03bdc1ba929798d5da0c /src/plugins/irc
parent747d6122bcb3af6f0302022c7acace6b8108614b (diff)
downloadweechat-4c3ab508c728c486306e21ed08ab98bc06e3aa95.zip
irc: don't open a new private buffer on `/msg` command when capability echo-message is enabled (closes #2016)
Diffstat (limited to 'src/plugins/irc')
-rw-r--r--src/plugins/irc/irc-protocol.c49
1 files changed, 33 insertions, 16 deletions
diff --git a/src/plugins/irc/irc-protocol.c b/src/plugins/irc/irc-protocol.c
index 5ebdbf375..4d1c1e41c 100644
--- a/src/plugins/irc/irc-protocol.c
+++ b/src/plugins/irc/irc-protocol.c
@@ -3264,7 +3264,7 @@ IRC_PROTOCOL_CALLBACK(privmsg)
if (strcmp (ptr_channel->name, remote_nick) != 0)
irc_channel_pv_rename (server, ptr_channel, remote_nick);
}
- else
+ else if (!nick_is_me)
{
ptr_channel = irc_channel_new (server,
IRC_CHANNEL_TYPE_PRIVATE,
@@ -3280,7 +3280,8 @@ IRC_PROTOCOL_CALLBACK(privmsg)
}
}
- if (weechat_config_boolean (irc_config_look_typing_status_nicks))
+ if (ptr_channel
+ && weechat_config_boolean (irc_config_look_typing_status_nicks))
{
irc_typing_channel_set_nick (ptr_channel, nick,
IRC_CHANNEL_TYPING_STATE_OFF);
@@ -3294,7 +3295,8 @@ IRC_PROTOCOL_CALLBACK(privmsg)
}
else
{
- irc_channel_set_topic (ptr_channel, address);
+ if (ptr_channel)
+ irc_channel_set_topic (ptr_channel, address);
if (weechat_config_boolean (irc_config_look_color_pv_nick_like_channel))
{
color = irc_nick_find_color_name (server, nick);
@@ -3328,22 +3330,37 @@ IRC_PROTOCOL_CALLBACK(privmsg)
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,
- irc_protocol_tags (server, command, tags, str_tags, nick, address),
- "%s%s",
- irc_nick_as_prefix (
- server, NULL, nick,
- (nick_is_me) ?
- IRC_COLOR_CHAT_NICK_SELF : irc_nick_color_for_pv (server,
- ptr_channel,
- nick)),
- (msg_args2) ? msg_args2 : msg_args);
+ if (nick_is_me && !ptr_channel)
+ {
+ irc_input_user_message_display (
+ server,
+ date,
+ remote_nick,
+ address,
+ "privmsg",
+ NULL, /* ctcp_type */
+ (msg_args2) ? msg_args2 : msg_args,
+ 1); /* decode_colors */
+ }
+ else
+ {
+ weechat_printf_date_tags (
+ (ptr_channel) ? ptr_channel->buffer : server->buffer,
+ date,
+ irc_protocol_tags (server, command, tags, str_tags, nick, address),
+ "%s%s",
+ irc_nick_as_prefix (
+ server, NULL, nick,
+ (nick_is_me) ?
+ IRC_COLOR_CHAT_NICK_SELF : irc_nick_color_for_pv (server,
+ ptr_channel,
+ nick)),
+ (msg_args2) ? msg_args2 : msg_args);
+ }
if (msg_args2)
free (msg_args2);
- if (ptr_channel->has_quit_server)
+ if (ptr_channel && ptr_channel->has_quit_server)
ptr_channel->has_quit_server = 0;
(void) weechat_hook_signal_send ("irc_pv",