From ef68312393ced25f5e0099099c93590bcddca5be Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Helleu?= Date: Tue, 18 Jul 2023 18:48:48 +0200 Subject: [PATCH] irc: fix display of self CTCP message containing bold attribute (issue #1981) --- ChangeLog.adoc | 5 ++++ src/plugins/irc/irc-protocol.c | 2 +- tests/unit/plugins/irc/test-irc-protocol.cpp | 28 ++++++++++---------- 3 files changed, 20 insertions(+), 15 deletions(-) diff --git a/ChangeLog.adoc b/ChangeLog.adoc index 6aa6fe3e4..7f112e881 100644 --- a/ChangeLog.adoc +++ b/ChangeLog.adoc @@ -10,6 +10,11 @@ This document lists all the changes for each version. + For a list of important changes that require manual actions, please look at release notes. +[[v4.0.3]] +== Version 4.0.3 (under dev) + + * irc: fix display of self CTCP message containing bold attribute (issue #1981) + [[v4.0.2]] == Version 4.0.2 (2023-07-12) diff --git a/src/plugins/irc/irc-protocol.c b/src/plugins/irc/irc-protocol.c index ad13d08c2..34850ed36 100644 --- a/src/plugins/irc/irc-protocol.c +++ b/src/plugins/irc/irc-protocol.c @@ -2995,7 +2995,7 @@ irc_protocol_privmsg_display_ctcp_send (struct t_irc_server *server, if (!arguments || !arguments[0]) return; - pos_end = strchr (arguments + 1, '\01'); + pos_end = strrchr (arguments + 1, '\01'); if (!pos_end) return; diff --git a/tests/unit/plugins/irc/test-irc-protocol.cpp b/tests/unit/plugins/irc/test-irc-protocol.cpp index 0a685c9aa..69b5ada29 100644 --- a/tests/unit/plugins/irc/test-irc-protocol.cpp +++ b/tests/unit/plugins/irc/test-irc-protocol.cpp @@ -2423,7 +2423,7 @@ TEST(IrcProtocolWithServer, notice) /* * notice to channel/user from self nick - * (case of bouncer of if echo-message capability is enabled) + * (case of bouncer or if echo-message capability is enabled) */ RECV(":alice!user@host NOTICE #test :a notice "); CHECK_CHAN("--", "Notice(alice) -> #test: a notice ", @@ -2440,7 +2440,7 @@ TEST(IrcProtocolWithServer, notice) /* * notice to ops of channel from self nick - * (case of bouncer of if echo-message capability is enabled) + * (case of bouncer or if echo-message capability is enabled) */ RECV(":alice!user@host NOTICE @#test :a notice "); CHECK_CHAN("--", "Notice(alice) -> @#test: a notice ", @@ -2449,7 +2449,7 @@ TEST(IrcProtocolWithServer, notice) /* * notice from self nick - * (case of bouncer of if echo-message capability is enabled) + * (case of bouncer or if echo-message capability is enabled) */ RECV(":alice!user@host NOTICE alice :a notice "); CHECK_SRV("--", "Notice -> alice: a notice ", @@ -2743,7 +2743,7 @@ TEST(IrcProtocolWithServer, privmsg) /* * message to channel/user from self nick - * (case of bouncer of if echo-message capability is enabled) + * (case of bouncer or if echo-message capability is enabled) */ RECV(":alice!user@host PRIVMSG #test :this is the message "); CHECK_CHAN("alice", "this is the message ", @@ -2757,7 +2757,7 @@ TEST(IrcProtocolWithServer, privmsg) /* * message to ops of channel from self nick - * (case of bouncer of if echo-message capability is enabled) + * (case of bouncer or if echo-message capability is enabled) */ RECV(":alice!user@host PRIVMSG @#test :this is the message "); CHECK_CHAN("--", "Msg(alice) -> @#test: this is the message ", @@ -2766,7 +2766,7 @@ TEST(IrcProtocolWithServer, privmsg) /* * message from self nick in private - * (case of bouncer of if echo-message capability is enabled) + * (case of bouncer or if echo-message capability is enabled) */ RECV(":alice!user@host PRIVMSG alice :this is the message "); CHECK_PV("alice", "alice", "this is the message ", @@ -2775,7 +2775,7 @@ TEST(IrcProtocolWithServer, privmsg) /* * message from self nick in private, with password hidden (nickserv) - * (case of bouncer of if echo-message capability is enabled) + * (case of bouncer or if echo-message capability is enabled) */ RECV(":alice!user@host PRIVMSG nickserv :identify secret"); CHECK_PV("nickserv", "alice", "identify ******", @@ -2865,8 +2865,8 @@ TEST(IrcProtocolWithServer, privmsg) CHECK_CHAN(" *", "bob", "irc_privmsg,irc_action,notify_message,nick_bob," "host_user@host,log1"); - RECV(":bob!user@host PRIVMSG #test :\01ACTION is testing\01"); - CHECK_CHAN(" *", "bob is testing", + RECV(":bob!user@host PRIVMSG #test :\01ACTION is testing with \02bold\02\01"); + CHECK_CHAN(" *", "bob is testing with bold", "irc_privmsg,irc_action,notify_message,nick_bob," "host_user@host,log1"); RECV(":bob!user@host PRIVMSG #test :\01VERSION\01"); @@ -2884,7 +2884,7 @@ TEST(IrcProtocolWithServer, privmsg) /* * valid CTCP to channel from self nick - * (case of bouncer of if echo-message capability is enabled) + * (case of bouncer or if echo-message capability is enabled) */ RECV(":alice!user@host PRIVMSG #test :\01VERSION\01"); CHECK_CHAN("--", "CTCP query to #test: VERSION", @@ -2894,14 +2894,14 @@ TEST(IrcProtocolWithServer, privmsg) CHECK_CHAN(" *", "alice", "irc_privmsg,irc_action,self_msg,notify_none,no_highlight," "nick_alice,host_user@host,log1"); - RECV(":alice!user@host PRIVMSG #test :\01ACTION is testing\01"); - CHECK_CHAN(" *", "alice is testing", + RECV(":alice!user@host PRIVMSG #test :\01ACTION is testing with \02bold\02\01"); + CHECK_CHAN(" *", "alice is testing with bold", "irc_privmsg,irc_action,self_msg,notify_none,no_highlight," "nick_alice,host_user@host,log1"); /* * valid CTCP to ops of channel from self nick - * (case of bouncer of if echo-message capability is enabled) + * (case of bouncer or if echo-message capability is enabled) */ RECV(":alice!user@host PRIVMSG @#test :\01ACTION\01"); CHECK_CHAN("--", "Action -> @#test: alice", @@ -2948,7 +2948,7 @@ TEST(IrcProtocolWithServer, privmsg) /* * valid CTCP to channel from self nick - * (case of bouncer of if echo-message capability is enabled) + * (case of bouncer or if echo-message capability is enabled) */ RECV(":alice!user@host PRIVMSG alice :\01CLIENTINFO\01"); if (i == 0)