diff options
author | Tobias Boege <tobs@taboege.de> | 2019-04-12 16:43:01 +0200 |
---|---|---|
committer | Tobias Boege <tobs@taboege.de> | 2019-04-12 16:43:01 +0200 |
commit | 2c542acdd8410eab33cfc9b5942d515e0630ecf7 (patch) | |
tree | a730e6c4e8189f3adfc46f078cc7ef6116fdf57a /lib | |
parent | 590379beaaf8fbf525c9f14d0f34116ed20f6ea3 (diff) |
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).
Diffstat (limited to 'lib')
-rw-r--r-- | lib/IRC/Client.pm6 | 4 |
1 files changed, 1 insertions, 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 ] >> / |