Rename Session.connect to Session.connectIMAP

This commit is contained in:
Simon Ser 2020-02-10 17:21:34 +01:00
parent 9fe20a604c
commit 97eef13db4
No known key found for this signature in database
GPG key ID: 0FDE7BE0E88F5E48

View file

@ -72,7 +72,7 @@ func (s *Session) DoIMAP(f func(*imapclient.Client) error) error {
if s.imapConn == nil { if s.imapConn == nil {
var err error var err error
s.imapConn, err = s.manager.connect(s.username, s.password) s.imapConn, err = s.manager.connectIMAP(s.username, s.password)
if err != nil { if err != nil {
s.Close() s.Close()
return fmt.Errorf("failed to re-connect to IMAP server: %v", err) return fmt.Errorf("failed to re-connect to IMAP server: %v", err)
@ -156,7 +156,7 @@ func newSessionManager(dialIMAP DialIMAPFunc, dialSMTP DialSMTPFunc, logger echo
} }
} }
func (sm *SessionManager) connect(username, password string) (*imapclient.Client, error) { func (sm *SessionManager) connectIMAP(username, password string) (*imapclient.Client, error) {
c, err := sm.dialIMAP() c, err := sm.dialIMAP()
if err != nil { if err != nil {
return nil, err return nil, err
@ -184,7 +184,7 @@ func (sm *SessionManager) get(token string) (*Session, error) {
// Put connects to the IMAP server and creates a new session. If authentication // Put connects to the IMAP server and creates a new session. If authentication
// fails, the error will be of type AuthError. // fails, the error will be of type AuthError.
func (sm *SessionManager) Put(username, password string) (*Session, error) { func (sm *SessionManager) Put(username, password string) (*Session, error) {
c, err := sm.connect(username, password) c, err := sm.connectIMAP(username, password)
if err != nil { if err != nil {
return nil, err return nil, err
} }