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

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



Hi,

I have attached my relevant configs (and hopefully managed to anonymize
them enough). As you can see I use the 'utf7.py' module (placed in
~/.offlineimap/) to decode/encode between imap4-utf-7 and utf-8 on
system (if your filesystem uses a different encoding you might have
issues). Please don't use the configs verbatim, but rather as
inspiration: I might have cut out important parts. Some of this is
in the wiki.

Some of the folders are translated (bi-directional of course) in my
offlineimaprc, but if you check out my sources.yaml you will see that I
have specified which folders are related to special (deleted, starred,
inbox, etc) for some of the sources.

My translation setup in offlineimaprc for my first GMail account
corresponds to the default values the maildirroot source suggests. The
only relevant change in config.yaml is to set sync_back_to_maildir:
true.

The way I set up sup with maildirroot is:
$ sup-config

fill in, don't add any sources. If you have a working config.yaml, you
can use it.

add sources:
$ sup-add maildirroot:///home/gaute/.mail/imap_account

I edit ~/.sup/sources.yaml and enable:
- confirm_enable_experimental: true
- sync_back: true
- maildir_creation_allowed: true

and tweak the folder names if necessary.

Then if your index is empty (you _cannot_ merge an existing maildir
source by using the same source id) - I run sup-sync:
$ sup-sync -v

Note that sup-sync does not support the :updated flag (when a message
has moved on disk), for that you have to run regular Sup and do a poll.
sup-sync scans through and adds labels; you can also just start up sup
and see what happens, but that takes a longer time: you probably do not
need to enable the stuff in sources.yaml before after sup-sync if you
are nervous (I would be!). 

Some annoying issues:
- deleting a maildir is hard:
  * if you delete it remotely it will be recreated by offlineimap (i
    think)
  * you have to first remove all emails remotely, sync sup, to make sure
    labels are removed.
  * if you remove all messages from a label the maildir will be empty,
    to delete the maildir: sync, delete the maildir locally + delete it
    remotely; then re-sync.

    this is the behaviour of offlineimap, but I think it is hard to do
    it differently. this means that if you accidentally add a bogus
    label, it is a bit of a pain to get rid of the maildir.


- if a message is deleted from the inbox remotely (archived) it is not
  removed from the inbox view (or any thread index view it is visible
  in) before sup is restarted.

To test maildirroot:
checkout my branch; make the gem: $ rake gem and install it: $ gem
install pkg/sup-999.gem. If develop has changed you can try to merge it in
first.

Again; please make a backup copy of your .mail so that you can restore
it if it turns out maildirroot has been eating or multiplying emails :)

I probably don't have the time to difficult bugs, but I would be happy
to accept patches and I could also put this branch on official Sup if it
turns out to be worth something.


Cheers, Gaute

Attachment: offlineimaprc
Description: Binary data

Attachment: utf7.py
Description: application/python

---
- !supmua.org,2006-10-01/Redwood/MaildirRoot
  uri: maildirroot:/home/gaute/.mail/gaute.vetsj.com/
  usual: true
  archived: false
  id: 1
  labels: []
  sync_back: true
  confirm_enable_experimental: true
  maildir_creation_allowed: true
  inbox_folder: inbox
  sent_folder: sent
  drafts_folder: drafts
  spam_folder: spam
  trash_folder: trash
  archive_folder: archive
- !supmua.org,2006-10-01/Redwood/MaildirRoot
  uri: maildirroot:/home/gaute/.mail/vetsj.com/
  usual: true
  archived: false
  id: 2
  labels: []
  sync_back: true
  confirm_enable_experimental: true
  maildir_creation_allowed: true
  inbox_folder: inbox
  sent_folder: sent
  drafts_folder: drafts
  spam_folder: spam
  trash_folder: trash
  archive_folder: archive
- !supmua.org,2006-10-01/Redwood/MaildirRoot
  uri: maildirroot:/home/gaute/.mail/imap_1
  usual: true
  archived: false
  id: 3
  labels:
  - some_1 =

  sync_back: true
  confirm_enable_experimental: true
  maildir_creation_allowed: true
  inbox_folder: INBOX
  sent_folder: sent
  drafts_folder: drafts
  spam_folder: spam
  trash_folder: trash
  archive_folder: archive
- !supmua.org,2006-10-01/Redwood/MaildirRoot
  uri: maildirroot:/home/gaute/.mail/imap_2
  usual: true
  archived: false
  id: 4
  labels:
  - some_2 =

  sync_back: true
  confirm_enable_experimental: true
  maildir_creation_allowed: true
  inbox_folder: inbox
  sent_folder: Sent Items
  drafts_folder: Drafts
  spam_folder: Junk E-mail
  trash_folder: Deleted Items
  archive_folder: archive
- !supmua.org,2006-10-01/Redwood/SentLoader {}
[...]
:editor: vim -f -c 'set ft=3Dmail' '+/^\s*\n/' '+nohl'
:confirm_no_attachments: true
:thread_by_subject: false
:edit_signature: false
:ask_for_from: false
:ask_for_to: true
:ask_for_cc: false
:ask_for_bcc: false
:ask_for_subject: true
:account_selector: true
:confirm_top_posting: false
:jump_to_open_message: true
:discard_snippets_from_encrypted_messages: false
:load_more_threads_when_scrolling: true
:default_attachment_save_dir: ''
:sent_source: sup://sent
:archive_sent: true
:poll_interval: 300
:wrap_width: 0
:slip_rows: 0
:col_jump: 2
:stem_language: english
:sync_back_to_maildir: true

Attachment: signature.asc
Description: PGP signature