From 2c542acdd8410eab33cfc9b5942d515e0630ecf7 Mon Sep 17 00:00:00 2001 From: Tobias Boege Date: Fri, 12 Apr 2019 16:43:01 +0200 Subject: Fix irc-addressed false positives Commit 3e585499 replaced a `subst-mutate` with a `.= subst` as a result of a v6.d deprecation. The surrounding code relied on the return value being falsy when no substitution took place. This was true for `subst-mutate` but isn't for `subst` which always returns the resulting string. In this case, this caused every PRIVMSG to fire an `irc-addressed` event. This is fixed by using s///, which mutates but returns the Match (or Nil). --- lib/IRC/Client.pm6 | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/lib/IRC/Client.pm6 b/lib/IRC/Client.pm6 index cd2348e..73f0dd9 100644 --- a/lib/IRC/Client.pm6 +++ b/lib/IRC/Client.pm6 @@ -245,9 +245,7 @@ method !handle-event ($e) { when 'irc-privmsg-channel' | 'irc-notice-channel' { my $nick = $s.current-nick; my @aliases = $s.alias; - if $e.text .= subst: - /^ [ $nick | @aliases ] <[,:]> \s* /, '' - { + if $e.text ~~ s/^ [ $nick | @aliases ] <[,:]> \s*// { take 'irc-addressed', ('irc-to-me' if $s.is-connected); } elsif $e.text ~~ / << [ $nick | @aliases ] >> / -- cgit v1.1