Make IMAP and SMTP sessions check for passwords

This commit is contained in:
2018-03-06 00:49:35 +00:00
parent 5aa6607746
commit 32df489b50
5 changed files with 51 additions and 14 deletions

View File

@@ -5,6 +5,8 @@ import (
"log"
imapbackend "github.com/emersion/go-imap/backend"
"ur.gs/crockery/internal/store"
)
var (
@@ -14,12 +16,12 @@ var (
// type Session implements the User interface for emersion/go-imap
type Session struct {
ID uint64
AccountName string
Account *store.Account
ServiceName string
}
func (s *Session) Username() string {
return s.AccountName
return s.Account.Username
}
func (s *Session) ListMailboxes(subscribed bool) ([]imapbackend.Mailbox, error) {
@@ -43,7 +45,7 @@ func (s *Session) RenameMailbox(existingName, newName string) error {
}
func (s *Session) Logout() error {
log.Printf("Ending %s session %d for %s", s.ServiceName, s.ID, s.AccountName)
log.Printf("Ending %s session %d for %s", s.ServiceName, s.ID, s.Username())
return nil
}