<html><body><div style="color:#000; background-color:#fff; font-family:times new roman, new york, times, serif;font-size:12pt"><div><span><br></span></div><br><div style="font-family: times new roman, new york, times, serif; font-size: 12pt;"><div style="font-family: times new roman, new york, times, serif; font-size: 12pt;">
On Tue, Oct 2, 2012 at 12:49 PM, chris coleman wrote:<br>><br>><br>> On Tue, Oct 2, 2012 at 2:33 AM, Eygene Ryabinkin <<a ymailto="mailto:rea-fbsd@codelabs.ru" href="mailto:rea-fbsd@codelabs.ru">rea-fbsd@codelabs.ru</a>><br>> wrote:<br>>> Tue, Oct 02, 2012 at 10:53:11AM +0200, Rainer M Krug wrote:<br>>>> -----BEGIN PGP SIGNED MESSAGE-----<br>>>> Hash: SHA1<br>>>><br>>>> On 02/10/12 10:34, Eygene Ryabinkin wrote:<br>>>> > Mon, Oct 01, 2012 at 09:44:46PM -0700, Zain Memon wrote:<br>>>> >> Can I get OfflineIMAP to fetch and store my Gmail labels without<br>>>> >> having multiple copies of<br>>>> >> the same message?<br>>>> ><br>>>> > If I am not terribly mistaken, current implementation of GMail<br>>>> > folder storage does not allow for this.<br>>>><br>>>> Well - you could use
 the<br>>>> <a href="https://developers.google.com/google-apps/gmail/imap_extensions" target="_blank">https://developers.google.com/google-apps/gmail/imap_extensions</a> api<br>>>> (particularly<br>>>><br>>>> <a href="https://developers.google.com/google-apps/gmail/imap_extensions#access_to_gmail_labels_x-gm-labels" target="_blank">https://developers.google.com/google-apps/gmail/imap_extensions#access_to_gmail_labels_x-gm-labels</a>)<br>>>> to get the tags for downloaded messages, if I am not completely<br>>>> mistaken.<br>>><br>>> I meant the implementation of GMail support in OfflineIMAP.  Sorry<br>>> for not being clear.<br>>> --<br>>> Eygene Ryabinkin                                        ,,,^..^,,,<br>>> [ Life's unfair - but root password helps! 
         | <a target="_blank" href="http://codelabs.ru/">codelabs.ru</a> ]<br>>> [ 82FE 06BC D497 C0DE 49EC  4FF0 16AF 9EAE 8152 ECFB | <a target="_blank" href="http://freebsd.org/">freebsd.org</a> ]<br>><br>><br>> I'm considering creating a patch for storing Gmail labels for<br>> type=Gmail. For the Maildir format, where could I store the label data<br>> for each message? I'm not super familiar with the Maildir format but<br>> it seems to me that labels should be handled similarly to flags, but I<br>> don't think it's a good idea to store labels in the filename of each<br>> message. Does the Maildir format allow for mutable data to be stored<br>> in the file itself?<br>><br>> Hi Zain,<br>><br>> You should get the extra info from gmail, and then store it in headers<br>> inside the message.<br>> The headers are: X-GM-MSGID, X-GM-THRID, X-GM-LABELS, in addition to<br>> existing
 XLIST.<br>> The user will need to use a mailreader (Thunderbird is one) that has an<br>> extension available to support those gmail specific message headers IN THE<br>> MESSAGE not on the gmail server.<br>> There is some more detail / code here, but note, it's code that talks to<br>> gmail's servers to ask for the extra info "live", not code that reads to<br>> extra info from the message headers...:<br>> http://www.google-melange.com/gsoc/project/google/gsoc2012/atuljangra/31001<br>><br>> Chris<br>><br>><br><br>The reason I was hesitant to store X-GM-LABELS as a header in the<br>message is because it is mutable, similar to the flags. I could change<br>labels for a message on the server and I would expect OfflineIMAP to<br>sync that to my local copy; but it's my understanding that Maildir file<br>contents are supposed to be immutable.<br><br>Hi Zain,<br><br>If the Maildir file contents are supposed to be immutable, then
 you have to decide how you're going to handle these gmail extensions to the imap protocol.<br><br>One way - write a plugin/extension to your mailreader (Thunderbird is an easy example) to query gmail "live" for those labels, thread ids, msg ids, and xlist, and make the messages display differently by taking that info into account.<br><br>Second way - copy those labels down so they're stored in a static form on the local maildir - possibly in a sqlite database for fast read/updates - PLUS a plugin for the mailreader to let the user view/modify those extended gmail tags - and re-upload it back to gmail servers during offlineimap's sync procedure...  This allows for true disconncted offline use..<br><br>Third way - write an extension for one of the popular mailservers (dovecot, cyrus, etc) to implement these gmail extended imap features - and just replicate between gmail's imap server and your local imap server.  Obviously this skips using the
 Maildir and just talks imap protocol between gmail's imap server and your local server... A bit heavier in terms of memory and cpu requirements but probably the cleanest solution with the least amount of coding needed on the OfflineImap side.<br><br><br><br><br> </div> </div>  </div></body></html>