-
Notifications
You must be signed in to change notification settings - Fork 313
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
go-imap v2 #260
Comments
IIRC After some discussion on IRC, we agreed that the best way is to ditch modular design and implement all extensions in go-imap. We could just a lot of arguments for all extensions that we might support... Then it will be compatibility disaster since the addition of the new arguments/return values to support new extensions will break it. Basically, my current idea is to add structure arguments to each client/backend command that will let us pass all extension information. The same goes for return values. For example this is client would pass UNCHANGEDSINCE (from CONDSTORE) argument to STORE: _, err := cl.Store(seqSet, imap.FormatFlagsOp(imap.AddFlags, true), []string{"$foo"}, nil, imap.ExtCmdData{
UnchangedSince: ...,
}) Note the additional return value, this is the structure containing possible extension responses, unused now. |
Also, the current storage backend interface forces backends to be stateless, making it impossible to implement \Recent flag handling and other things that require keeping track of opened mailboxes. We need a way to explicitly tell backend when user opens a mailbox and how (EXAMINE vs SELECT). The same goes for the CLOSE command type User interface {
// ...
OpenMailbox(name string, readOnly bool) (backend.Mailbox, error)
}
type Mailbox interface {
// ...
Close() error
} |
Side note: We probably want to mark the existing "extensions interface" in go-imap v1 as deprecated to indicate that we are getting rid of it. |
Another consideration for v2 backend interface: Support for certain extensions may not be determined by simply type-asserting on a certain interface. This is what I workaround by adding Note that with possible go-imap v2 backend interface changes (similar to client interface changes) this will be the case for many more extensions. The more generic solution for this problem is used in maddy codebase. The |
I've rewritten the client part in the |
The v2 branch is now mature enough to close this. |
go-imap v1 will be released without any major changes to the API. But it's time to cleanup the mess for v2:
go-imap extensions system is a kind of mess. It is hard to extend existing commands, I think this we might want to reconsider how it should work, taking into account the number of extensions that modify existing commands instead of adding new.
Originally posted by @foxcpp in #82 (comment)
The text was updated successfully, but these errors were encountered: