storing and synchronizing labels
petr.mvd at gmail.com
Wed Jul 31 20:06:32 BST 2013
I want to reorganize the way I use my email and offlineimap+sup seem to
be the best way to go. The most important problems I see are:
- I want to read the same email account from multiple computers and
cache messages locally. For this
- I want to keep sup labels synchronized to my gmail account.
Moreover, the current practice of viewing Gmail labels as folders, then
downloading folders separately locally, and then configuring sup to
convert folders into labels, seem quite awkward and error prone,
especially at the sup side. Just looking at
https://github.com/sup-heliotrope/sup/wiki/Offlineimap feels that there
should be a simpler way. (And I'm not talking about downloading messages
with multiple labels multiple times.)
I did some research in the past few days and I feel that the cleanest
solution would be to patch offlineimap and sup to store be able to store
(and to sync) labels to a folder, together with the status of messages.
Then I'd just fetch Gmail's "All messages" folder together with the
labels and present it to sup. No more messing with individual folders,
The problem is that Maildir only supports (somewhat unofficially?)
single letter flags. So one solution would be to include a file in a
Maildir directory that maps flags to labels. Somewhat problematic would
be synchronizing this file. This could be solved that only sup would be
allowed to modify it (perhaps offlineimap could be also allowed to
append new mappings to it, this would still be reasonably safe).
Another solution would be to create a simple SQLite store with a one
table holding all messages, each row just a message ID and the content
of the message and another table holding labels corresponding to each
message. While it may seem superfluous to create a new storage format, I
see many advantages in this solution:
- Each program can include its own additional tables for any information
it needs to keep, like message status or IMAP UID.
- Concurrent access for both imap synchronization and mail reader
possible (unless the database is on a NFS volume or buggy Windows shares).
- ACID transactional operations, no problems with locking - this is all
handled by the database. Easy rollback when an operation fails, for
example due to network problems.
- Everything in a single file. Easy copying, easy backup.
- Many operations will be very fast even without any external indexing,
like listing all messages with a given label, newer than some date etc.
Again, all handled by the database/
- It's embedded, no need to run any server software. Supported by python
and ruby and available in major repositories.
It seems that implementing this idea is simple enough to give it a try
just to test it.
I'd be glad to hear your opinion on those two ideas. I'm willing to
program it (even though I'm used other to languages than ruby and
python), so I'm seeking primarily critique and moral support.
I'm not in the list so please keep me in CC in all answers. Thank you.
More information about the OfflineIMAP-project