summaryrefslogtreecommitdiff
path: root/lib/MaildirIndexer/Email.pm6
diff options
context:
space:
mode:
authordakkar <dakkar@thenautilus.net>2019-12-27 17:18:10 +0000
committerdakkar <dakkar@thenautilus.net>2019-12-27 17:18:10 +0000
commit42d176c71218f2daac666ce3f254356b8798dc68 (patch)
tree1438f8562c04328fd04e1d09bea8b23df9cf0340 /lib/MaildirIndexer/Email.pm6
parenttypes in Store (diff)
downloadMaildirIndexer-42d176c71218f2daac666ce3f254356b8798dc68.tar.gz
MaildirIndexer-42d176c71218f2daac666ce3f254356b8798dc68.tar.bz2
MaildirIndexer-42d176c71218f2daac666ce3f254356b8798dc68.zip
Log::Timeline
apparently reading from the socket is the slowest bit
Diffstat (limited to 'lib/MaildirIndexer/Email.pm6')
-rw-r--r--lib/MaildirIndexer/Email.pm617
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;
}