blob: 0cd5bd7eb742edab2517193a2a77c45065ff7632 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
|
use v6.d.PREVIEW; unit class MaildirIndexer::Email; has IO $!path; has %!headers; has $!body; method BUILD(:%!headers,:$!body,:$!path = IO) { } method message-id { split-refs(%!headers<message-id>)[0] // '' } method refs { return ( |split-refs(%!headers<in-reply-to>), |split-refs(%!headers<references>).reverse, ); } multi split-refs(Any) { return (); } multi split-refs(Str:D $str) { return $/<refs>».Str if $str ~~ m{'<' $<refs> = (<-[<>]>+)+ % [ '>' .*? '<' ] '>' }; return (); }
|