aboutsummaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorZoffix Znet <cpan@zoffix.com>2016-01-03 14:43:57 -0500
committerZoffix Znet <cpan@zoffix.com>2016-01-03 14:43:57 -0500
commit67a3cb36258637434e8b5639c80c4a2b3a5b4b8a (patch)
treeba502a7d0ff7c14909570785fb56f3a422cfd470 /lib
parent9fd5da692c91ce1faceef70344fc900689098d68 (diff)
Improve irc-to-me
Diffstat (limited to 'lib')
-rw-r--r--lib/IRC/Client.pm613
1 files changed, 10 insertions, 3 deletions
diff --git a/lib/IRC/Client.pm6 b/lib/IRC/Client.pm6
index 63a7e98..98c57ed 100644
--- a/lib/IRC/Client.pm6
+++ b/lib/IRC/Client.pm6
@@ -35,13 +35,20 @@ method handle-event ($e) {
and $e<params>[1] ~~ /:i ^ $nick <[,:]> \s+/
)
) {
- my @where = ($e<who><nick>, $e<who><nick>);
- @where[0] = $e<params>[0]
+ my %res = :where($e<who><nick> ),
+ :who( $e<who><nick> ),
+ :how( $e<command> ),
+ :what( $e<params>[1] );
+
+ %res<where> = $e<params>[0] # this message was said in the channel
unless ( $e<command> eq 'PRIVMSG' and $e<params>[0] eq $nick )
or ( $e<command> eq 'NOTICE' and $e<params>[0] eq $nick );
+ %res<what>.subst-mutate: /:i ^ $nick <[,:]> \s+/, ''
+ if %res<where> ~~ /^ <[#&]>/;
+
for @!plugs.grep(*.^can: 'irc-to-me') -> $p {
- my $res = $p.irc-to-me(self, $e, |@where);
+ my $res = $p.irc-to-me(self, $e, %res);
return unless $res === IRC_NOT_HANDLED;
}
}