]> git.0d.be Git - barnard.git/blobdiff - main.go
remove UI stuff, turn into CLI
[barnard.git] / main.go
diff --git a/main.go b/main.go
index 7a779d55c4cb62055a763ca1907d3f6f61900e88..dbdc2090b5f59b73cc913fe9224b8b00602346fa 100644 (file)
--- a/main.go
+++ b/main.go
@@ -6,8 +6,8 @@ import (
        "fmt"
        "os"
 
-       "layeh.com/barnard/uiterm"
        "layeh.com/gumble/gumble"
+       "layeh.com/gumble/gumbleutil"
        _ "layeh.com/gumble/opus"
 )
 
@@ -18,6 +18,7 @@ func main() {
        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()
 
@@ -25,6 +26,7 @@ func main() {
        b := Barnard{
                Config:  gumble.NewConfig(),
                Address: *server,
+               DefaultChannel: *channel,
        }
 
        b.Config.Username = *username
@@ -42,6 +44,14 @@ func main() {
                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
 }