[PATCH] Syncing gmail labels for gmail accounts

Rainer M Krug R.M.Krug at gmail.com
Wed Nov 28 08:03:22 GMT 2012

Hash: SHA1

On 24/11/12 15:13, Abdó Roig-Maranges wrote:
> Hi again,
>> Regarding the labels patch... well, I haven't done much email trashing recently, so I didn't
>> notice earlier. I found a couple of problems with labels sync for the Trash folder. I'll look
>> into it and post again.
>> 1) Moving a message to trash keeps the old labels (\Inbox for example) because of the label
>> sync. Gmail should clear all labels, but we resync them back afterwards. I'm not sure what's
>> the best way to fix this.
> After thinking about it, I believe there is no problem to fix. As a side effect of labels sync,
> the Trash folder behaves like all other folders regarding labels, instead of being special and
> clearing all labels. That's fine to me.
> Then if I, as a user, want to trash a message and not see it on the Inbox (or whatever other
> folder it belongs), I should explicitly remove the \Inbox label.
> If I wanted to keep the special behaviour of Trash regarding labels, Offlineimap should be
> aware that Trash is special and prevent labels sync, and this would be a little ugly, I guess.
> For instance, the trash folder name depends on the localization: [Gmail]/Trash, 
> [Gmail]/Papelera, [Google Mail]/Bin, etc...
>> 2) A python KeyError for Gmail.messagelabels[uid]['labels'], which seems to be triggered by
>> the fact that the messages in the Trash folder behave differently when setting labels.
> Well, that was a bug in my patch. It was triggered only when a new message with labels moved
> from local to gmail, for example when moving between folders "the IMAP way". I attach a patch.
> you can also pull it from github: https://github.com/aroig/offlineimap

Three questions before I try:

1) Am I right that, when I pull the git repo, that setup.py will install the patched offlineimap?

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?

3) I assume it is a sync, i.e. that changes in the labels in the x-headers locally get synched
back to gmail?

I would be very happy to test your patch and to give feedback.



> Thanks for the feedback :)
> 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

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


More information about the OfflineIMAP-project mailing list