From 5297c4345c839a28ffc054cafec1fb939253fcf7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Helleu?= Date: Sat, 22 Nov 2025 10:31:57 +0100 Subject: [PATCH] irc: fix colors in MODE message (issue #2286) --- CHANGELOG.md | 2 +- src/plugins/irc/irc-protocol.c | 2 +- tests/unit/plugins/irc/test-irc-protocol.cpp | 10 ++++++++++ 3 files changed, 12 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 1a2caf701..de61bed40 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -11,7 +11,7 @@ SPDX-License-Identifier: GPL-3.0-or-later ### Fixed - api: fix file descriptor leak in hook_url when a timeout occurs or if the hook is removed during the transfer ([#2284](https://github.com/weechat/weechat/issues/2284)) -- irc: fix colors in ban mask (message 367) and quiet mask (message 728) ([#2286](https://github.com/weechat/weechat/issues/2286)) +- irc: fix colors in messages 367 (ban mask), 728 (quiet mask) and MODE ([#2286](https://github.com/weechat/weechat/issues/2286)) ## Version 4.7.1 (2025-08-16) diff --git a/src/plugins/irc/irc-protocol.c b/src/plugins/irc/irc-protocol.c index ea114cf79..10b49830a 100644 --- a/src/plugins/irc/irc-protocol.c +++ b/src/plugins/irc/irc-protocol.c @@ -2195,7 +2195,7 @@ IRC_PROTOCOL_CALLBACK(mode) IRC_COLOR_RESET, ctxt->params[1], /* mode */ (modes_args && modes_args[0]) ? " " : "", - (modes_args && modes_args[0]) ? modes_args : "", + (modes_args && modes_args[0]) ? IRC_COLOR_MSG(modes_args) : "", IRC_COLOR_CHAT_DELIMITERS, IRC_COLOR_RESET, irc_nick_color_for_msg (ctxt->server, 1, ptr_nick, ctxt->nick), diff --git a/tests/unit/plugins/irc/test-irc-protocol.cpp b/tests/unit/plugins/irc/test-irc-protocol.cpp index fdfa88823..0f0c7b4e7 100644 --- a/tests/unit/plugins/irc/test-irc-protocol.cpp +++ b/tests/unit/plugins/irc/test-irc-protocol.cpp @@ -2316,6 +2316,16 @@ TEST(IrcProtocolWithServer, mode) "irc_mode,nick_admin,host_user@host,log3"); STRCMP_EQUAL(NULL, ptr_channel->modes); + /* ban added on channel */ + RECV(":admin!user@host MODE #test +b bob!user_\00304red@host_\00304red"); + CHECK_CHAN("--", "Mode #test [+b bob!user_red@host_red] by admin", + "irc_mode,nick_admin,host_user@host,log3"); + + /* ban removed from channel */ + RECV(":admin!user@host MODE #test -b bob!user_\00304red@host_\00304red"); + CHECK_CHAN("--", "Mode #test [-b bob!user_red@host_red] by admin", + "irc_mode,nick_admin,host_user@host,log3"); + /* nick mode '@' on channel #test */ RECV(":admin!user@host MODE #test +o alice "); CHECK_CHAN("--", "Mode #test [+o alice] by admin",