aboutsummaryrefslogtreecommitdiffstats
path: root/commands
diff options
context:
space:
mode:
authorKarel Balej <balejk@matfyz.cz>2024-01-30 20:11:24 +0100
committerRobin Jarry <robin@jarry.cc>2024-02-12 22:55:25 +0100
commit54711a2b9b63c57104a173b95e3cb255f92e5974 (patch)
tree56f085db0e595b01115e75d6f283d6091dea32d0 /commands
parenta977d1246d362baf9c8f45ef95df882091f681ac (diff)
downloadaerc-54711a2b9b63c57104a173b95e3cb255f92e5974.tar.gz
send: refactor parseScheme
Rename several variables to better distinguish their meaning. Signed-off-by: Karel Balej <balejk@matfyz.cz> Acked-by: Robin Jarry <robin@jarry.cc>
Diffstat (limited to 'commands')
-rw-r--r--commands/compose/send.go16
1 files changed, 8 insertions, 8 deletions
diff --git a/commands/compose/send.go b/commands/compose/send.go
index 13d9fd4a..f95e1447 100644
--- a/commands/compose/send.go
+++ b/commands/compose/send.go
@@ -326,29 +326,29 @@ func (s *sendmailSender) Close() error {
return ce
}
-func parseScheme(uri *url.URL) (scheme string, auth string, err error) {
- scheme = ""
+func parseScheme(uri *url.URL) (protocol string, auth string, err error) {
+ protocol = ""
auth = "plain"
if uri.Scheme != "" {
parts := strings.Split(uri.Scheme, "+")
switch len(parts) {
case 1:
- scheme = parts[0]
+ protocol = parts[0]
case 2:
if parts[1] == "insecure" {
- scheme = uri.Scheme
+ protocol = uri.Scheme
} else {
- scheme = parts[0]
+ protocol = parts[0]
auth = parts[1]
}
case 3:
- scheme = parts[0] + "+" + parts[1]
+ protocol = parts[0] + "+" + parts[1]
auth = parts[2]
default:
- return "", "", fmt.Errorf("Unknown transfer protocol %s", uri.Scheme)
+ return "", "", fmt.Errorf("Unknown scheme %s", uri.Scheme)
}
}
- return scheme, auth, nil
+ return protocol, auth, nil
}
func newSaslClient(auth string, uri *url.URL) (sasl.Client, error) {