aboutsummaryrefslogtreecommitdiff
path: root/internal/imap
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--internal/imap/client.go10
-rw-r--r--internal/imap/cmds.go12
-rw-r--r--internal/imap/commando.go16
-rw-r--r--internal/imap/folder.go10
-rw-r--r--internal/imap/imap.go4
5 files changed, 26 insertions, 26 deletions
diff --git a/internal/imap/client.go b/internal/imap/client.go
index 731e35b..783acf6 100644
--- a/internal/imap/client.go
+++ b/internal/imap/client.go
@@ -23,17 +23,17 @@ type Client struct {
nextFreeIndex int
}
-func (client *Client) Disconnect() {
- if client != nil {
- client.stopCommander()
+func (cl *Client) Disconnect() {
+ if cl != nil {
+ cl.stopCommander()
connected := false
- for _, conn := range client.connections {
+ for _, conn := range cl.connections {
connected = conn.disconnect() || connected
}
if connected {
- log.Print("Disconnected from ", client.host)
+ log.Print("Disconnected from ", cl.host)
}
}
}
diff --git a/internal/imap/cmds.go b/internal/imap/cmds.go
index 7c99fc3..3cfb61d 100644
--- a/internal/imap/cmds.go
+++ b/internal/imap/cmds.go
@@ -8,8 +8,8 @@ func (cmd ensureCommando) execute(conn *connection) error {
return conn.ensureFolder(cmd.folder)
}
-func (client *Client) EnsureFolder(folder Folder) error {
- return client.commander.execute(ensureCommando{folder})
+func (cl *Client) EnsureFolder(folder Folder) error {
+ return cl.commander.execute(ensureCommando{folder})
}
type addCommando struct {
@@ -21,8 +21,8 @@ func (cmd addCommando) execute(conn *connection) error {
return conn.putMessages(cmd.folder, cmd.messages)
}
-func (client *Client) PutMessages(folder Folder, messages []string) error {
- return client.commander.execute(addCommando{folder, messages})
+func (cl *Client) PutMessages(folder Folder, messages []string) error {
+ return cl.commander.execute(addCommando{folder, messages})
}
type replaceCommando struct {
@@ -37,6 +37,6 @@ func (cmd replaceCommando) execute(conn *connection) error {
return conn.replace(cmd.folder, cmd.header, cmd.value, cmd.newContent, cmd.force)
}
-func (client *Client) Replace(folder Folder, header, value, newContent string, force bool) error {
- return client.commander.execute(replaceCommando{folder, header, value, newContent, force})
+func (cl *Client) Replace(folder Folder, header, value, newContent string, force bool) error {
+ return cl.commander.execute(replaceCommando{folder, header, value, newContent, force})
}
diff --git a/internal/imap/commando.go b/internal/imap/commando.go
index 348c724..1ba4ed3 100644
--- a/internal/imap/commando.go
+++ b/internal/imap/commando.go
@@ -40,29 +40,29 @@ func executioner(conn *connection, pipe <-chan execution, done <-chan struct{})
}
}
-func (client *Client) startCommander() {
- if client.commander != nil {
+func (cl *Client) startCommander() {
+ if cl.commander != nil {
return
}
pipe := make(chan execution, maxPipeDepth)
done := make(chan struct{})
- client.commander = &commander{client, pipe, done}
+ cl.commander = &commander{cl, pipe, done}
- for _, conn := range client.connections {
+ for _, conn := range cl.connections {
if conn != nil {
go executioner(conn, pipe, done)
}
}
}
-func (client *Client) stopCommander() {
- if client.commander == nil {
+func (cl *Client) stopCommander() {
+ if cl.commander == nil {
return
}
- close(client.commander.done)
+ close(cl.commander.done)
- client.commander = nil
+ cl.commander = nil
}
diff --git a/internal/imap/folder.go b/internal/imap/folder.go
index 1f4e0bf..e845862 100644
--- a/internal/imap/folder.go
+++ b/internal/imap/folder.go
@@ -21,13 +21,13 @@ func (f Folder) Append(other Folder) Folder {
}
}
-func (client *Client) folderName(path []string) Folder {
+func (cl *Client) folderName(path []string) Folder {
return Folder{
- strings.Join(path, client.delimiter),
- client.delimiter,
+ strings.Join(path, cl.delimiter),
+ cl.delimiter,
}
}
-func (client *Client) NewFolder(path []string) Folder {
- return client.toplevel.Append(client.folderName(path))
+func (cl *Client) NewFolder(path []string) Folder {
+ return cl.toplevel.Append(cl.folderName(path))
}
diff --git a/internal/imap/imap.go b/internal/imap/imap.go
index f8c8632..63684a8 100644
--- a/internal/imap/imap.go
+++ b/internal/imap/imap.go
@@ -30,13 +30,13 @@ func newImapClient(url *URL, forceTls bool) (*imapClient.Client, error) {
return c, nil
}
-func (client *Client) connect(url *URL, forceTls bool) (*connection, error) {
+func (cl *Client) connect(url *URL, forceTls bool) (*connection, error) {
c, err := newImapClient(url, forceTls)
if err != nil {
return nil, err
}
- conn := client.createConnection(c)
+ conn := cl.createConnection(c)
if !forceTls {
if err = conn.startTls(); err != nil {