So, Gmail's IMAP is a bit 'weird'. They use IMAP folders to represent Labels. I believe typically that an email in IMAP can only belong to one 'Folder', however with Gmail, an email message can belong to many 'folders' which gives us very close functionality to labels.
My question is, I'm writing a gmail client (so that things like Starring, deleting, and archiving work a bit more intuitively than a standard imap client), but I would like to be able to display for a given email, which folders (labels) it is in.
As far as I can tell this is not easy (I'd have to loop through every message in every folder to see which ones it's in).
Does anyone know of a tidy way to do this? Or am I right in assuming there's no easy way?