diff options
author | Eric Wong <e@80x24.org> | 2021-03-16 07:43:44 +0600 |
---|---|---|
committer | Eric Wong <e@80x24.org> | 2021-03-16 06:32:06 -0400 |
commit | 327a4c0a44ab301922a2b2829d423d2e9fc18faf (patch) | |
tree | 1f59a48cac66b5bbb71191bc533eb3e701825b0d /lib/PublicInbox/MboxReader.pm | |
parent | 1b19e689f0b76290a437dd614da8685574e72b73 (diff) | |
download | public-inbox-327a4c0a44ab301922a2b2829d423d2e9fc18faf.tar.gz |
MboxReader is a more appropriate place for it than LeiStore.
Diffstat (limited to 'lib/PublicInbox/MboxReader.pm')
-rw-r--r-- | lib/PublicInbox/MboxReader.pm | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/lib/PublicInbox/MboxReader.pm b/lib/PublicInbox/MboxReader.pm index df7c78fa..f93c2ec6 100644 --- a/lib/PublicInbox/MboxReader.pm +++ b/lib/PublicInbox/MboxReader.pm @@ -11,6 +11,18 @@ $Data::Dumper::Useqq = 1; # should've been the default, for bad data my $from_strict = qr/^From \S+ +\S+ \S+ +\S+ [^\n:]+:[^\n:]+:[^\n:]+ [^\n:]+\n/sm; +# cf: https://doc.dovecot.org/configuration_manual/mail_location/mbox/ +my %status2kw = (F => 'flagged', A => 'answered', R => 'seen', T => 'draft'); +# O (old/non-recent), and D (deleted) aren't in JMAP, +# so probably won't be supported by us. +sub mbox_keywords { + my $eml = $_[-1]; + my $s = "@{[$eml->header_raw('X-Status'),$eml->header_raw('Status')]}"; + my %kw; + $s =~ s/([FART])/$kw{$status2kw{$1}} = 1/sge; + [ sort(keys %kw) ]; +} + sub _mbox_from { my ($mbfh, $from_re, $eml_cb, @arg) = @_; my $buf = ''; |