[PATCH] Syncing gmail labels for gmail accounts
Rainer M Krug
r.m.krug at gmail.com
Wed Nov 28 12:59:48 GMT 2012
-----BEGIN PGP SIGNED MESSAGE-----
On 28/11/12 13:48, Abdó Roig-Maranges wrote:
> X-Keywords: \Sent
> Hi Rainer,
thanks for the detailed answer - I will look into it but probably not this week. But I would like
to forward your email to the notmuch mailing list, as I would like to encourage them to index the
gmail labels in the x-headers with their tags - would be lovely.
Thanks a lot for this patch, sounds really brilliant,
>> 1) Am I right that, when I pull the git repo, that setup.py will install the patched
> Yes, the offlineimap fork on https://github.com/aroig/offlineimap is the current OI master
> branch + the patches on this thread. The setup.py installs the patched version.
> The man page and sample config is updated, so you can find some info there.
>> 2) How does a .offlineimaprc look when using your patch? Do I have to sync all folders or
>> only the [GMAIL] folders which are "real" imap folders and contain all emails and no
> Well, you will be fine syncing only the folder "[Gmail]/All Mail" (or whatever it is called for
> your account as the name is localized...).
> This is how I use it. I have one big "All Mail" folder with all the mail (even sent mail). Then
> I have my local Maildir indexed by mu , and use mu4e  as email client. With this setup I
> can search very fast, filter by label, etc. like on the web interface.
> The only small drawback is that mu4e is not able to change labels, so I wrote a little script,
> to do that, and integrated it with mu4e. You could also use formail  for this I guess.
> Syncing additional label folders should work just fine with the patch, if you want to do this.
> However, you will end up with message duplicates on your disk and sort of defeats the purpose
> of the patch.
> There are a couple of exceptions were it may be useful to sync the actual IMAP folder.
> [Gmail]/Drafts, is associated to the special label '\Drafts' (there are some special labels
> beginning with '\' that gmail gives special treatment [4,5]). I do sync the drafts folder,
> because my mail client uses the local Drafts folder to store... well, drafts, and then they
> get synced back to gmail.
> Also, [Gmail]/Trash is related to the special label "\Trash" and has special status on the
> gmail side. When you move a message there, it really goes to the actual gmail trash and it will
> be deleted after some time. Also deleting a message from Trash makes it go away. Deleting a
> message from All Mail has no effect (it just reappears on the next sync).
> If it helps, I attach a commented version of my offlineimaprc.
>> 3) I assume it is a sync, i.e. that changes in the labels in the X-headers locally get
>> synched back to gmail?
> Yes, it is a two way sync, just like flags.
> First propagates labels from gmail to local. For this compares labels on gmail with the ones
> from the last sync (this is stored on a database in ~/.offlineimap by default) and propagates
> whatever has changed, adding or removing labels.
> Then it does the same thing from local to gmail.
>> I would be very happy to test your patch and to give feedback.
> Thanks! I'd suggest you make backups of the following before testing:
> * the maildir you are syncing
> * offlineimap's cached data which by default is on the directory ~/.offlineimap. This is not
> essential, as if it were lost, offlineimap would rebuild it without data loss, but it could
> take some time...
> If you are currently using offlineimap with your mail collection, the data on ~/.offlineimap
> should be automatically updated to the new format, so you don't need to worry about that. If
> there were problems, though, it is safe to just remove ~/.offlineimap and let it be recreated.
> Either way, the first time will be slow because it must add the labels to every message in the
>  http://www.djcbsoftware.nl/code/mu/  http://www.djcbsoftware.nl/code/mu/mu4e.html 
> http://linuxcommand.org/man_pages/formail1.html 
> https://developers.google.com/google-apps/gmail/imap_extensions 
Rainer M. Krug, PhD (Conservation Ecology, SUN), MSc (Conservation Biology, UCT), Dipl. Phys.
Centre of Excellence for Invasion Biology
Tel : +33 - (0)9 53 10 27 44
Cell: +33 - (0)6 85 62 59 98
Fax : +33 - (0)9 58 10 27 44
Fax (D): +49 - (0)3 21 21 25 22 44
email: Rainer at krugs.de
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.11 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://www.enigmail.net/
-----END PGP SIGNATURE-----
More information about the OfflineIMAP-project