From 7cd8312bf93724cce6af9c318f727a373bfcf4f6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Helleu?= Date: Wed, 19 Jun 2024 20:52:02 +0200 Subject: [PATCH] irc: fix property "short_name" of channel buffer when the joined channel has a different case than the `/join` command --- CHANGELOG.md | 1 + src/plugins/irc/irc-channel.c | 8 ++++++-- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index dc532451e..2ce53e178 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -29,6 +29,7 @@ ### Fixed - irc, xfer: fix display of input prompt in IRC private buffers and DCC chat buffers ([#2128](https://github.com/weechat/weechat/issues/2128)) +- irc: fix property "short_name" of channel buffer when the joined channel has a different case than the `/join` command - irc: close /list buffer when the server buffer is closed ([#2121](https://github.com/weechat/weechat/issues/2121)) - irc: clear /list buffer when disconnecting from server ([#2133](https://github.com/weechat/weechat/issues/2133)) - irc: display an explicit message on /list buffer when the list of channels is empty ([#2133](https://github.com/weechat/weechat/issues/2133)) diff --git a/src/plugins/irc/irc-channel.c b/src/plugins/irc/irc-channel.c index a102977be..3a8778f31 100644 --- a/src/plugins/irc/irc-channel.c +++ b/src/plugins/irc/irc-channel.c @@ -189,6 +189,7 @@ irc_channel_create_buffer (struct t_irc_server *server, struct t_hashtable *buffer_props; int buffer_created, current_buffer_number, buffer_position; int autojoin_join, manual_join, noswitch; + const char *ptr_short_name; char str_number[32], *channel_name_lower, *buffer_name, *prompt; buffer_created = 0; @@ -217,7 +218,6 @@ irc_channel_create_buffer (struct t_irc_server *server, NULL, NULL); if (buffer_props) { - weechat_hashtable_set (buffer_props, "short_name", channel_name); weechat_hashtable_set ( buffer_props, "input_multiline", @@ -225,6 +225,7 @@ irc_channel_create_buffer (struct t_irc_server *server, && weechat_hashtable_has_key (server->cap_list, "draft/multiline")) ? "1" : "0"); weechat_hashtable_set (buffer_props, "name", buffer_name); + weechat_hashtable_set (buffer_props, "short_name", channel_name); weechat_hashtable_set ( buffer_props, "localvar_set_type", @@ -251,7 +252,10 @@ irc_channel_create_buffer (struct t_irc_server *server, { if (!irc_upgrading) weechat_nicklist_remove_all (ptr_buffer); - weechat_hashtable_remove (buffer_props, "short_name"); + /* change short_name only if it's the same or with different case */ + ptr_short_name = weechat_buffer_get_string (ptr_buffer, "short_name"); + if (irc_server_strcasecmp (server, ptr_short_name, channel_name) != 0) + weechat_hashtable_remove (buffer_props, "short_name"); weechat_hashtable_map (buffer_props, &irc_channel_apply_props, ptr_buffer); } else