[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

A maildir root source: syncing labels with maildirs (imap folders)



Hi fellow suppers,

for a while I have been using a 'maildir-root' source that I created.
It is based on the maildir-syncback code, but goes further: you only
specify a root folder with maildirs to the source, then each sub folder
(maildirsub) is mapped to a label. Some of the labels are special: like
deleted, inbox and archive (the special-label to maildirsub mapping can
be specified in the source configuration).

This means that a sup label corresponds to maildir inside the
maildir-root and the behavior works like this:

  - (remote to local) if a message is found in a maildirsub that label is added to it.
  - (remote to local) if a message is removed from a maildirsub that
    label is removed (unless it has just been moved).
  - (local to remote) if you add a label the message is written to that
    maildirsub (of all the maildir-roots the message belongs to)
  - (local to remote) if you remove a label from a message the message is deleted
    from that maildirsub. if it is deleted from all maildirsubs it is
    copied to the archive maildirsub.
  - (local to remote) if you archive a message it is removed from the
    inbox maildirsub, if it doesn't belong to any other
    labels/maildirsubs it is copied to archive.
  - (local to remote / remote to local) the same flag features as
    maildir-syncback (done on all copies in all maildirsubs)
  - (local to remote) if you add a label to a message and the message
    belongs to a maildir-root where no corresponding maildirsub exists a
    maildir will be created for it.

I have been using it for 4-5 months now and it is getting fairly stable.
It works fairly well on gmail (label sync), but I am also using it on
regular IMAP servers (here it might, in the future, be useful to always keep a copy in
archive).

If you are interested in trying this please have a look at:
https://github.com/gauteh/sup/blob/maildir-root/lib/sup/maildirroot.rb

or my branch: https://github.com/gauteh/sup/tree/maildir-root, but please
be careful.

I am using this with offlineimap and utf-7-imap to utf-8 conversion. It
is probably necessary to do a full sync every time to make sure things
stay in sync. Remember that it is technically possible to still do
changes to the maildir while offlineimap is syncing, I haven't had any
problems with this (except read flag), but it is potentially a little
careless.


Cheers, Gaute

Attachment: signature.asc
Description: PGP signature