commit c9274aa

Gabriel Arakaki Giovanini  ·  2023-07-12 20:23:32 +0000 UTC
parent 17769fb
Fix tls configuration input

`Sscan` does not parse "yes" or "no" to true or false. So inputting
"yes" yields a false on `tls` variable, leaving the address in the
configuration file with "irc+insecure://".
1 files changed,  +8, -2
+8, -2
 1@@ -61,9 +61,15 @@ func main() {
 2 			if tlsStr == "" {
 3 				break
 4 			}
 5-			if _, err := fmt.Fscan(strings.NewReader(tlsStr), &tls); err == nil {
 6-				break
 7+			switch strings.ToLower(tlsStr) {
 8+			case "y", "yes":
 9+				tls = true
10+			case "n", "no":
11+				tls = false
12+			default:
13+				continue
14 			}
15+			break
16 		}
17 		fmt.Fprintf(os.Stderr, "Configuration assistant: Enter your nickname: ")
18 		for nick == "" {