aboutsummaryrefslogtreecommitdiff
path: root/session.go
diff options
context:
space:
mode:
Diffstat (limited to 'session.go')
-rw-r--r--session.go9
1 files changed, 8 insertions, 1 deletions
diff --git a/session.go b/session.go
index 3aea68e..2da29c2 100644
--- a/session.go
+++ b/session.go
@@ -6,6 +6,7 @@ import (
"errors"
"fmt"
"net/http"
+ "os"
"sync"
"time"
@@ -142,17 +143,19 @@ type SessionManager struct {
dialIMAP DialIMAPFunc
dialSMTP DialSMTPFunc
logger echo.Logger
+ debug bool
locker sync.Mutex
sessions map[string]*Session // protected by locker
}
-func newSessionManager(dialIMAP DialIMAPFunc, dialSMTP DialSMTPFunc, logger echo.Logger) *SessionManager {
+func newSessionManager(dialIMAP DialIMAPFunc, dialSMTP DialSMTPFunc, logger echo.Logger, debug bool) *SessionManager {
return &SessionManager{
sessions: make(map[string]*Session),
dialIMAP: dialIMAP,
dialSMTP: dialSMTP,
logger: logger,
+ debug: debug,
}
}
@@ -167,6 +170,10 @@ func (sm *SessionManager) connectIMAP(username, password string) (*imapclient.Cl
return nil, AuthError{err}
}
+ if sm.debug {
+ c.SetDebug(os.Stderr)
+ }
+
return c, nil
}