"fmt"
"os"
- "layeh.com/barnard/uiterm"
"layeh.com/gumble/gumble"
+ "layeh.com/gumble/gumbleutil"
_ "layeh.com/gumble/opus"
)
password := flag.String("password", "", "the password of the server")
insecure := flag.Bool("insecure", false, "skip server certificate verification")
certificate := flag.String("certificate", "", "PEM encoded certificate and private key")
+ channel := flag.String("channel", "", "initial channel")
flag.Parse()
b := Barnard{
Config: gumble.NewConfig(),
Address: *server,
+ DefaultChannel: *channel,
}
b.Config.Username = *username
b.TLSConfig.Certificates = append(b.TLSConfig.Certificates, cert)
}
- b.Ui = uiterm.New(&b)
- b.Ui.Run()
+ keepAlive := make(chan bool)
+
+ b.Config.Attach(gumbleutil.Listener{
+ Disconnect: func(e *gumble.DisconnectEvent) {
+ keepAlive <- true
+ },
+ })
+
+ b.start()
+ <-keepAlive
}