diff options
author | Karel Balej <balejk@matfyz.cz> | 2024-01-30 20:11:24 +0100 |
---|---|---|
committer | Robin Jarry <robin@jarry.cc> | 2024-02-12 22:55:25 +0100 |
commit | 54711a2b9b63c57104a173b95e3cb255f92e5974 (patch) | |
tree | 56f085db0e595b01115e75d6f283d6091dea32d0 /commands | |
parent | a977d1246d362baf9c8f45ef95df882091f681ac (diff) | |
download | aerc-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.go | 16 |
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) { |