Extremely WIP - expose a hardcoded INBOX to IMAP. Messages do not show in evolution yet

This commit is contained in:
2018-03-08 02:17:15 +00:00
parent b4537d1283
commit b661b4a978
4 changed files with 174 additions and 6 deletions

View File

@@ -4,13 +4,14 @@ import (
"fmt"
"log"
"github.com/emersion/go-imap"
imapbackend "github.com/emersion/go-imap/backend"
"ur.gs/crockery/internal/store"
)
var (
notImplemented = fmt.Errorf("Not yet implemented")
ErrNotImplemented = fmt.Errorf("Not yet implemented")
)
// type Session implements the User interface for emersion/go-imap
@@ -18,6 +19,8 @@ type Session struct {
ID uint64
Account store.Account
ServiceName string
store store.Interface
}
func (s *Session) Username() string {
@@ -25,23 +28,29 @@ func (s *Session) Username() string {
}
func (s *Session) ListMailboxes(subscribed bool) ([]imapbackend.Mailbox, error) {
return nil, notImplemented
return []imapbackend.Mailbox{ // FIXME: hardcoded!
&Mailbox{name: imap.InboxName, session: s},
}, nil
}
func (s *Session) GetMailbox(name string) (imapbackend.Mailbox, error) {
return nil, notImplemented
if name == imap.InboxName { // FIXME: hardcoded!
return &Mailbox{name: name, session: s}, nil
}
return nil, ErrNotImplemented
}
func (s *Session) CreateMailbox(name string) error {
return notImplemented
return ErrNotImplemented
}
func (s *Session) DeleteMailbox(name string) error {
return notImplemented
return ErrNotImplemented
}
func (s *Session) RenameMailbox(existingName, newName string) error {
return notImplemented
return ErrNotImplemented
}
func (s *Session) Logout() error {