aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorZoffix Znet <cpan@zoffix.com>2016-08-07 18:39:37 -0400
committerZoffix Znet <cpan@zoffix.com>2016-08-07 18:39:37 -0400
commitdd4390ce747b2aa4e5e1b3c7bea3640b4abea271 (patch)
tree3d503edab07a5b765c4f8d956b320ab875aa8d3d
parent0e7c7f8d9da5806ece7b14734a402721127ffbc8 (diff)
Make addressed regex more restrictive
Fixes #21
-rw-r--r--Changes3
-rw-r--r--docs/02-event-reference.md5
-rw-r--r--lib/IRC/Client.pm62
3 files changed, 7 insertions, 3 deletions
diff --git a/Changes b/Changes
index 13db293..e2915a7 100644
--- a/Changes
+++ b/Changes
@@ -1,5 +1,8 @@
Revision history for IRC::Client
+3.005001 2016-08-07
+ - Make addressed regex more restrictive (#21)
+
3.004004 2016-08-03
- Implement .match method on Privmsg/Notice message objects
diff --git a/docs/02-event-reference.md b/docs/02-event-reference.md
index 3e43ca0..cb3de1d 100644
--- a/docs/02-event-reference.md
+++ b/docs/02-event-reference.md
@@ -83,8 +83,9 @@ irc-addressed ▶ irc-to-me ▶ irc-notice-channel ▶ irc-notice ▶
This event chain is triggered when the client is addressed in a channel either
via a `PRIVMSG` or `NOTICE` IRC message. 'Addressed' means the message line
-starts with the current nickname of the client, followed by single whitespace character, `;`, or `,` characters, followed by any number of whitespace; or
-in regex terms, matches `/^ $nick <[,:\s]> \s* /`. This prefix portion will be
+starts with the current nickname of the client, followed by `;` or `,`
+characters, followed by any number of whitespace; or
+in regex terms, matches `/^ $nick <[,:]> \s* /`. This prefix portion will be
**stripped** from the actual message.
Possible message objects received by event handler:
diff --git a/lib/IRC/Client.pm6 b/lib/IRC/Client.pm6
index 486bfcd..7dbadf9 100644
--- a/lib/IRC/Client.pm6
+++ b/lib/IRC/Client.pm6
@@ -235,7 +235,7 @@ method !handle-event ($e) {
given $event-name {
when 'irc-privmsg-channel' | 'irc-notice-channel' {
my $nick = $s.current-nick;
- if $e.text.subst-mutate: /^ $nick <[,:\s]> \s* /, '' {
+ if $e.text.subst-mutate: /^ $nick <[,:]> \s* /, '' {
take 'irc-addressed', ('irc-to-me' if $s.is-connected);
}
elsif $e.text ~~ / << $nick >> / and $s.is-connected {