go-imap
go-imap copied to clipboard
Avoid creating unnecessary backend.Mailbox objects
Ref https://github.com/emersion/go-imap/issues/337#issuecomment-594458545
There are also unnecessary uses of GetMailbox:
- Move SetSubscribed to User interface and do not call GetMailbox just to subscribe a mailbox.
- Mailbox.Status might get moved to the User interface as well, it might have benefits for backends that use shared db for all mailboxes and work needed for GetMailbox is different from information needed for Mailbox.Status (seems to match go-imap-sql).
- Append might get moved as well, but I do not think it is necessary. Though, I think it is a good idea to avoid opening the mailbox second time if the currently selected mailbox is already the target one.
Resolved by #374.
Fixed in go-imap v2.