]> Sergey Matveev's repositories - public-inbox.git/commit
lei import: import IMAP flag changes from old messages
authorEric Wong <e@80x24.org>
Sun, 30 May 2021 11:45:44 +0000 (11:45 +0000)
committerEric Wong <e@80x24.org>
Sun, 30 May 2021 22:36:57 +0000 (22:36 +0000)
commit525d14996e820e7bf2b5e035cf5826b6530f6d92
tree89491a7ac57115e1e763d575771a05c24be57230
parent66b5829892cf0fcd5249e26be21d8b3f3ee35816
lei import: import IMAP flag changes from old messages

This makes "lei import" behavior with IMAP folders more
consistent with that with Maildir.

Opening IMAP folders read-write with "SELECT" (instead of
read-only with "EXAMINE") was necessary, since it lets an IMAP
server communicate to us as to whether or not it's worth
refetching IMAP flags of previously imported messages.

Fetching UID+FLAGS only is one of the fastest IMAP operations
with dovecot, our -imapd and presumably other common IMAP servers.
It is issued by common MUAs such as mutt after every SELECT.

Users may now rely on "lei import" exclusively to merge mail and
keywords into lei/store, and "lei export-kw" to propagate
keyword changes back to IMAP servers.

A sticks-and-stones workflow for personal mailboxes is currently:

lei import imaps://$MY_PERSONAL_INBOX
lei q --mua=$MUA -o /tmp/results SEARCH TERMS...
# do stuff from within $MUA to /tmp/results
lei import /tmp/results # read keyword changes from MUA
lei export-kw imaps://$MY_PERSONAL_INBOX
# repeat when new stuff shows up in personal inbox

The next goal is to automate repeated imports + export-kw
commands with with inotify and IMAP IDLE.
lib/PublicInbox/LeiImport.pm
lib/PublicInbox/LeiMailSync.pm
lib/PublicInbox/NetReader.pm