storing and synchronizing labels

Petr Pudlák petr.mvd at gmail.com
Wed Jul 31 20:58:48 BST 2013


Dne 07/31/2013 09:41 PM, Abdó Roig-Maranges napsal(a):
> Hi,
>
>> 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,
>> mapping, etc.
>
> Well, about a year ago I wrote something close to what you propose, and I've
> been using it since. I submitted a pull request to offlineimap some days ago:
>
> https://github.com/OfflineIMAP/offlineimap/pull/43
>
> The approach is to sync only the All Mail folder, and use Gmail specific IMAP
> commands to fetch the labels.
>
> Unlike what you propose, I decided to store labels inside the contents of the
> message, under a header X-Keywords. The main advantages are:
>
>    * labels travel with messages if I sync them across computers. Previously I
>      had tried to store them in a separate database and it was a mess.
>
>    * I can see and edit labels with my email client (mu4e by the way) and sync
>      them back to gmail, without the need for the mail client to access an
>      external label database. The mail client just needs to change a line in the
>      message file.
>
> Hope this helps.
>
> Abdó.
Hi,

thank's, that helps, I'll look into it. I also thought about inserting 
it into message headers, but it seemed too invasive to me. I felt that 
message flags/labels should not influence its content. I suppose there 
were reasons why other mail stores like Maildir keep flags separately. 
One reason could be that two programs modifying message labels 
concurrently can mess it up. But yes, it's an option.

Only now I discovered that OfflineIMAP already uses SQLite for storing 
cache information. So storing messages there would be probably even 
simpler than I thought.

   Best regards,
   Petr




More information about the OfflineIMAP-project mailing list