imap, http: wrap c.Select() calls to avoid wastage

c.Select() only when c.Mailbox.Name isn't already in that mailbox.
db: teach retrieveThread() about labels