diff options
Diffstat (limited to 'lib/MaildirIndexer/Index/ByRef.rakumod')
-rw-r--r-- | lib/MaildirIndexer/Index/ByRef.rakumod | 11 |
1 files changed, 5 insertions, 6 deletions
diff --git a/lib/MaildirIndexer/Index/ByRef.rakumod b/lib/MaildirIndexer/Index/ByRef.rakumod index 6e5b7f5..3a5ebdb 100644 --- a/lib/MaildirIndexer/Index/ByRef.rakumod +++ b/lib/MaildirIndexer/Index/ByRef.rakumod @@ -13,7 +13,7 @@ method dump() { } method add-mail(MaildirIndexer::Email:D $email, Str:D $mailbox --> Nil) { - MaildirIndexer::LogTimelineSchema::Index::Add.log: :class('ByRef'),:$mailbox, -> { + MaildirIndexer::LogTimelineSchema::Index::Add.log: :class('ByRef'),:$mailbox, { # ignore adding the same file twice, files in maildirs are # immutable return if %!id-for-file{ $email.path }:exists; @@ -26,7 +26,7 @@ method add-mail(MaildirIndexer::Email:D $email, Str:D $mailbox --> Nil) { } method del-path(IO:D $file, Str:D $mailbox --> Nil) { - MaildirIndexer::LogTimelineSchema::Index::Rm.log: :class('ByRef'),:$mailbox, -> { + MaildirIndexer::LogTimelineSchema::Index::Rm.log: :class('ByRef'),:$mailbox, { my $id = %!id-for-file{ $file.path }:delete or return; with %!mailboxes-for-id{ $id } -> $boxes { $boxes{$mailbox}:delete; @@ -36,11 +36,10 @@ method del-path(IO:D $file, Str:D $mailbox --> Nil) { } method mailbox-for-email(MaildirIndexer::Email:D $email --> Str) { - my Str $result; - MaildirIndexer::LogTimelineSchema::Index::Find.log: :class('ByRef'), -> { + MaildirIndexer::LogTimelineSchema::Index::Find.log: :class('ByRef'), { for |$email.refs() -> $ref { - with %!mailboxes-for-id{$ref} { $result = .keys.sort.[0] } + with %!mailboxes-for-id{$ref} { return .keys.sort.[0] } } + return Nil; } - return $result; } |