diff options
Diffstat (limited to 'lib/MaildirIndexer/Email.pm6')
-rw-r--r-- | lib/MaildirIndexer/Email.pm6 | 17 |
1 files changed, 12 insertions, 5 deletions
diff --git a/lib/MaildirIndexer/Email.pm6 b/lib/MaildirIndexer/Email.pm6 index f3c04dd..0614c71 100644 --- a/lib/MaildirIndexer/Email.pm6 +++ b/lib/MaildirIndexer/Email.pm6 @@ -1,5 +1,6 @@ use v6.d.PREVIEW; unit class MaildirIndexer::Email; +use MaildirIndexer::LogTimelineSchema; has IO $.path; has %!headers; @@ -17,8 +18,11 @@ method refs(--> Iterable) { multi split-refs(Any --> Iterable) { return () } multi split-refs(Str:D $str --> Iterable) { - return $/<refs>».Str if $str ~~ m{'<' $<refs> = (<-[<>]>+)+ % [ '>' .*? '<' ] '>' }; - return (); + my @result; + MaildirIndexer::LogTimelineSchema::Parse::Header.log: { + @result = $/<refs>».Str if $str ~~ m{'<' $<refs> = (<-[<>]>+)+ % [ '>' .*? '<' ] '>' }; + } + return @result; } method addresses (--> Iterable) { @@ -54,8 +58,11 @@ my grammar Address { multi sub extract-addresses(Any --> Iterable) { return () } multi sub extract-addresses(Str:D $str --> Iterable) { - with Address.parse($str) { - return $_<addr>».Str; + my @result; + MaildirIndexer::LogTimelineSchema::Parse::Header.log: { + with Address.parse($str) { + @result = $_<addr>».Str; + } } - return (); + return @result; } |