[PATCH] Syncing gmail labels for gmail accounts

Rainer M Krug R.M.Krug at gmail.com
Wed Nov 28 13:53:22 GMT 2012


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Just saw one thing: the X-Keywords appears in the email as the first line.
I assume this is  not by design. Also: it would be nice if these X-headers could be somehow
encrypted, so that they are not to easily exposed in the emails send. Another option would be to
delete the X-headers before sending.

As I am using notmuch, I will contat their mailing list and see if indexing of the X-Keywords can
be included - which would be brilliant.

Cheers,

Rainer



On 28/11/12 13:59, Rainer M Krug wrote:
> On 28/11/12 13:48, Abdó Roig-Maranges wrote:
>> X-Keywords: \Sent
> 
> 
>> Hi Rainer,
> 
> Hi Abdó
> 
> 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,
> 
> Rainer
> 
> 
> 
>>> 1) Am I right that, when I pull the git repo, that setup.py will install the patched 
>>> offlineimap?
> 
>> 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 
>>> duplicates?
> 
>> 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 [1], and use mu4e [2] 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 [3] 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 maildir.
> 
> 
>> [1] http://www.djcbsoftware.nl/code/mu/ [2] http://www.djcbsoftware.nl/code/mu/mu4e.html [3] 
>> http://linuxcommand.org/man_pages/formail1.html [4] 
>> https://developers.google.com/google-apps/gmail/imap_extensions [5] 
>> https://support.google.com/mail/bin/answer.py?hl=en&answer=77657
> 
> 
>> Abdó.
> 
> 
> 
> 
> _______________________________________________ OfflineIMAP-project mailing list 
> OfflineIMAP-project at lists.alioth.debian.org 
> http://lists.alioth.debian.org/cgi-bin/mailman/listinfo/offlineimap-project
> 
> OfflineIMAP homepage: http://software.complete.org/offlineimap
> 

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.11 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://www.enigmail.net/

iEYEARECAAYFAlC2F1IACgkQoYgNqgF2egpgFACfZRAAdj4fAyY5x1XnFL4E86Dz
JAYAn1MMssYk3MUDtQHL+hHB4lQO+Z1N
=LfIC
-----END PGP SIGNATURE-----





More information about the OfflineIMAP-project mailing list