aboutsummaryrefslogtreecommitdiff
path: root/internal/imap
diff options
context:
space:
mode:
Diffstat (limited to 'internal/imap')
-rw-r--r--internal/imap/cmds.go1
-rw-r--r--internal/imap/commando.go4
-rw-r--r--internal/imap/connection.go4
-rw-r--r--internal/imap/imap.go15
4 files changed, 13 insertions, 11 deletions
diff --git a/internal/imap/cmds.go b/internal/imap/cmds.go
index 499d6c0..d978d80 100644
--- a/internal/imap/cmds.go
+++ b/internal/imap/cmds.go
@@ -12,7 +12,6 @@ func (client *Client) EnsureFolder(folder Folder) error {
return client.commander.execute(ensureCommando{folder})
}
-
type addCommando struct {
folder Folder
messages []string
diff --git a/internal/imap/commando.go b/internal/imap/commando.go
index 1cf688e..348c724 100644
--- a/internal/imap/commando.go
+++ b/internal/imap/commando.go
@@ -13,8 +13,8 @@ type command interface {
}
type execution struct {
- cmd command
- done chan<- error
+ cmd command
+ done chan<- error
}
func (commander *commander) execute(command command) error {
diff --git a/internal/imap/connection.go b/internal/imap/connection.go
index 4d209a9..5f62586 100644
--- a/internal/imap/connection.go
+++ b/internal/imap/connection.go
@@ -102,10 +102,10 @@ func (conn *connection) ensureFolder(folder Folder) error {
if conn.mailboxes.locking(folder) {
// someone else tried to create the MB -- try again, now that he's done
return conn.ensureFolder(folder)
- } else {
- defer conn.mailboxes.unlocking(folder)
}
+ defer conn.mailboxes.unlocking(folder)
+
log.Printf("Checking for folder '%s'", folder)
mbox, found, err := conn.list(folder.str)
diff --git a/internal/imap/imap.go b/internal/imap/imap.go
index 8f4c50e..f8c8632 100644
--- a/internal/imap/imap.go
+++ b/internal/imap/imap.go
@@ -11,20 +11,23 @@ import (
)
func newImapClient(url *URL, forceTls bool) (*imapClient.Client, error) {
+ var (
+ c *imapClient.Client
+ err error
+ )
+
if forceTls {
- c, err := imapClient.DialTLS(url.Host, nil)
- if err != nil {
+ if c, err = imapClient.DialTLS(url.Host, nil); err != nil {
return nil, fmt.Errorf("connecting (TLS) to %s: %w", url.Host, err)
}
log.Print("Connected to ", url.Host, " (TLS)")
- return c, nil
} else {
- c, err := imapClient.Dial(url.Host)
- if err != nil {
+ if c, err = imapClient.Dial(url.Host); err != nil {
return nil, fmt.Errorf("connecting to %s: %w", url.Host, err)
}
- return c, nil
}
+
+ return c, nil
}
func (client *Client) connect(url *URL, forceTls bool) (*connection, error) {