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

[sup-devel] Adding backward synchronization for Maildir sources



Sup guys,

I have been working on backward synchronization for Maildir sources
last week and I need your help to test and review the code.

I pushed my commits (based on the 'next' branch) to my repo which you
can find here [0] for the web interface and here [1] for the git
address.

The following is related to Maildir sources ONLY.

So what does work and what does not (if you don't want to read this,
scroll to the quick howto below):

- Sup will now stay synchronized with your remote sources by detecting
if a message has been remotely updated (ie: you change a flag from
another client), these updates will be applied to your local index and
your thread-view-mode buffers should be properly refreshed;

- When a message is remotely deleted, it should now disappear from
your index;

- There is a new configuration option called "sync_back_to_maildir"
which is false by default. When true, this option updates your actual
Maildir files when you change a label, this is done in real time
before being saved to xapian. So for instance if you use offlineimap
the changes should be synched back to your IMAP server by the next
poll in Sup (assuming that your before-poll hook runs offlineimap);

- I wrote a "sup-sync-back-maildir" script that will synchronize all
messages from your sources at once. This should be executed the first
time BEFORE any polling, otherwise your IMAP server will be synched to
your Sup index and if you did not used another client to mark your
emails as read etc. (like me) and to update your IMAP server then you
will lose all what you did in Sup (labels, etc.);

- I added two new hidden labels in Sup: 'replied' and 'forwarded',
they are automatically added when replying, forwarding or bouncing a
message, this is to bring a better Maildir support to Sup, this should
be invisible for users;

- However you will probably lose all your remote 'replied' and
'forwarded' flags after your first backward synchronization to Maildir
since Sup dropped these labels when it added your messages to xapian.

- Moving a message from a Maildir source to another is not (yet?)
supported.

So, you should now be able to use multiple clients to handle your
emails, for instance I can use gmail to mark messages as starred or
so, it will be reflected in Sup. In the same way, if I mark a message
as read in Sup it will appear as read in the gmail web interface.

I tested this code with my main account (2 GB and like 15 Maildir
sources) it works fine so far.

Be warned that it is highly experimental, but if you use offlineimap
it has a realdelete option so you *should* not lose any email, in the
worst case it might mess your flags/labels up.

I tested it only with offlineimap working with a gmail account.

Quick howto:

1. Close sup
2. Backup your emails and your xapian index or use another Sup session
3. Clone the branch [1]
4. IMPORTANT: run "bin/sup-sync-back-maildir" to synchronize the
   Maildirs you wish, check the help
5. Add ":sync_back_to_maildir: true" to your config.yaml
6. Run and use sup

Please test it and make reviews! :)

NOTE: if you want this to work, get sure that you are not calling
offlineimap with the '-q' option (as suggested in the wiki) otherwise
it will ignore the flag updates on IMAP server, so check your
before-poll hook.

[0] http://git.fensalir.fr/?p=dleone/sup.git
[1] $ git clone git://fensalir.fr/dleone/sup.git -b maildir-sync

--
Damien Leone <damien.leone@fensalir.fr>

Web: http://dleone.fensalir.fr/
GPG: 0x82EB4DDF

Attachment: signature.asc
Description: PGP signature

_______________________________________________
Sup-devel mailing list
Sup-devel@rubyforge.org
http://rubyforge.org/mailman/listinfo/sup-devel