Extremely WIP, but now messages appear in the evolution list pane
This commit is contained in:
@@ -4,7 +4,6 @@ import (
|
||||
"fmt"
|
||||
"log"
|
||||
|
||||
"github.com/emersion/go-imap"
|
||||
imapbackend "github.com/emersion/go-imap/backend"
|
||||
|
||||
"ur.gs/crockery/internal/store"
|
||||
@@ -28,28 +27,43 @@ func (s *Session) Username() string {
|
||||
}
|
||||
|
||||
func (s *Session) ListMailboxes(subscribed bool) ([]imapbackend.Mailbox, error) {
|
||||
return []imapbackend.Mailbox{ // FIXME: hardcoded!
|
||||
&Mailbox{name: imap.InboxName, session: s},
|
||||
}, nil
|
||||
mailboxes, err := s.store.FindMailboxes(s.Account)
|
||||
log.Printf("Session(%v).ListMailboxes(%v): %#v %#v", s.ID, subscribed, mailboxes, err)
|
||||
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
imapped := make([]imapbackend.Mailbox, len(mailboxes))
|
||||
for i, mailbox := range mailboxes {
|
||||
imapped[i] = &Mailbox{stored: mailbox, session: s}
|
||||
}
|
||||
|
||||
return imapped, nil
|
||||
}
|
||||
|
||||
func (s *Session) GetMailbox(name string) (imapbackend.Mailbox, error) {
|
||||
if name == imap.InboxName { // FIXME: hardcoded!
|
||||
return &Mailbox{name: name, session: s}, nil
|
||||
mailbox, err := s.store.FindMailbox(s.Account, name)
|
||||
log.Printf("Session(%v).GetMailbox(%v): %#v %#v", s.ID, name, mailbox, err)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
return nil, ErrNotImplemented
|
||||
return &Mailbox{stored: mailbox, session: s}, nil
|
||||
}
|
||||
|
||||
func (s *Session) CreateMailbox(name string) error {
|
||||
log.Printf("Session(%v).CreateMailbox(%v): not implemented", s.ID, name)
|
||||
return ErrNotImplemented
|
||||
}
|
||||
|
||||
func (s *Session) DeleteMailbox(name string) error {
|
||||
log.Printf("Session(%v).DeleteMailbox(%v): not implemented", s.ID, name)
|
||||
return ErrNotImplemented
|
||||
}
|
||||
|
||||
func (s *Session) RenameMailbox(existingName, newName string) error {
|
||||
log.Printf("Session(%v).DeleteMailbox(%v, %v): not implemented", s.ID, existingName, newName)
|
||||
return ErrNotImplemented
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user