[PATCH] Re: properly check whether dstfolder supports labels

Abdó Roig-Maranges abdo.roig at gmail.com
Mon Apr 6 22:23:05 BST 2015

Nicolas Sebrecht writes:

> On Mon, Apr 06, 2015 at 08:12:03PM +0200, Abdó Roig-Maranges wrote:
>> IMAP/Gmail should work just fine, with a warning that local repository does not
>> support labels.
> Frankly, I don't get why we should support IMAP/Gmail if it's just about
> doing the same thing as IMAP/IMAP would do with Gmail backend on one
> side.
> [...]
> I think we are still far from this. The idea of Gmail/IMAP is good but
> we have to find a way to translate the labels on the IMAP side. The best
> equivalent I can think of is folders.

Ok, I understand. I don't see an obvious way to do it.

Also, there is a performance issue I just noticed with the Gmail/Gmail
setup. When I wrote the labels thing, I had Maildir/Gmail in mind...

The thing is:

* changing labels on a Maildir is best done one message at a time, and changing
  all labels of a message in a single write.

* changing labels on Gmail is best done one label at a time, and changing it for
  a range of uids in a single transaction.

So, when I wrote the copymessageto_labels for GmailFolder and
GmailMaildirFolder, I did it with those optimizations in mind.

Now, doing Gmail/Gmail, will use the wrong optimization. Fixing this will fit in
the "big refactoring" context besides, I don't have much time, so I'll leave it
as it is for now.

I'll try to document this and some other things you asked in the following days.

Anyway, I resent v2 of the previous patch with the better check for label
capabilities. I removed one warning, because it would be triggered on every

The patch is just a minimal translation from an obscure try-except idiom to a
cleaner condition check.


More information about the OfflineIMAP-project mailing list