From 3b40dfa4a2dcb643aadafffdff3410b95a695417 Mon Sep 17 00:00:00 2001 From: Marius Gavrilescu Date: Sun, 30 Aug 2015 00:28:12 +0300 Subject: [PATCH] Allow ! before seen --- lib/POE/Component/IRC/Plugin/Seen.pm | 4 ++-- t/POE-Component-IRC-Plugin-Seen.t | 6 +++--- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/lib/POE/Component/IRC/Plugin/Seen.pm b/lib/POE/Component/IRC/Plugin/Seen.pm index 86a0984..cc2f76d 100644 --- a/lib/POE/Component/IRC/Plugin/Seen.pm +++ b/lib/POE/Component/IRC/Plugin/Seen.pm @@ -60,7 +60,7 @@ sub S_public { my $nick = parse_user $$rfullname; my $mynick = $irc->nick_name; - seen $self, $irc, $1, $$rchannels->[0], $nick if $$rmessage =~ /^(?:$mynick [,:])?\s*seen\s+([^ ]+)/x; + seen $self, $irc, $1, $$rchannels->[0], $nick if $$rmessage =~ /^(?:$mynick [,:])?\s*!?seen\s+([^ ]+)/x; log_event $self, $nick => "on $$rchannels->[0] saying $$rmessage" } @@ -83,7 +83,7 @@ sub S_msg { my ($self, $irc, $rfullname, $rtargets, $rmessage) = @_; my $nick = parse_user $$rfullname; - seen $self, $irc, $$rmessage, $$rtargets->[0], $nick if $$rmessage =~ /^seen\s+([^ ]+)/ + seen $self, $irc, $$rmessage, $$rtargets->[0], $nick if $$rmessage =~ /^\s*!?seen\s+([^ ]+)/ } 1; diff --git a/t/POE-Component-IRC-Plugin-Seen.t b/t/POE-Component-IRC-Plugin-Seen.t index 5d97e32..fdf55ae 100644 --- a/t/POE-Component-IRC-Plugin-Seen.t +++ b/t/POE-Component-IRC-Plugin-Seen.t @@ -28,16 +28,16 @@ sub runtest{ } runtest 'something', undef, 'initialize'; -runtest 'bot: seen mgv', 'I last saw mgv now on #chan saying something', 'public'; +runtest 'seen mgv', 'I last saw mgv now on #chan saying something', 'public'; $self->S_ctcp_action($mockirc, $rmgv, \$channels, \'sleeping'); -runtest 'bot: seen mgv', 'I last saw mgv now on #chan doing: * sleeping', 'ctcp_action'; +runtest '!seen mgv', 'I last saw mgv now on #chan doing: * sleeping', 'ctcp_action'; $self->S_join($mockirc, $rmgv, \'#chan'); runtest 'bot: seen mgv', 'I last saw mgv now joining #chan', 'join'; $self->S_part($mockirc, $rmgv, \'#chan', \''); -runtest 'bot: seen mgv', 'I last saw mgv now parting #chan', 'part without message'; +runtest 'bot: !seen mgv', 'I last saw mgv now parting #chan', 'part without message'; $self->S_part($mockirc, $rmgv, \'#chan', \'buh-bye'); runtest 'bot: seen mgv', "I last saw mgv now parting #chan with message 'buh-bye'", 'part with message'; -- 2.39.2