]> git.0d.be Git - barnard.git/commitdiff
add cmdline argument to start in a specific channel
authorFrédéric Péters <fpeters@0d.be>
Thu, 19 Mar 2020 15:24:12 +0000 (16:24 +0100)
committerFrédéric Péters <fpeters@0d.be>
Thu, 19 Mar 2020 15:24:12 +0000 (16:24 +0100)
barnard.go
client.go
main.go

index 0e121b35b061cc310cce7150b43075c46ded7b8f..769151edb04dd38f612aea57ba35713e21226fb7 100644 (file)
@@ -14,6 +14,7 @@ type Barnard struct {
 
        Address   string
        TLSConfig tls.Config
+       DefaultChannel string
 
        Stream *gumbleopenal.Stream
 
index 6f932e5f7e62475107d713e252bc3dc442a2393c..060e059db383d642c85c8a33988d6ab6b321f145 100644 (file)
--- a/client.go
+++ b/client.go
@@ -45,6 +45,10 @@ func (b *Barnard) OnConnect(e *gumble.ConnectEvent) {
        if e.WelcomeMessage != nil {
                b.AddOutputLine(fmt.Sprintf("Welcome message: %s", esc(*e.WelcomeMessage)))
        }
+       if (b.DefaultChannel != "") {
+               b.Client.Self.Move(b.Client.Channels.Find(b.DefaultChannel))
+       }
+
 }
 
 func (b *Barnard) OnDisconnect(e *gumble.DisconnectEvent) {
diff --git a/main.go b/main.go
index 7a779d55c4cb62055a763ca1907d3f6f61900e88..bbe84fa14815b4d43e54a25070547b41d96ce8dd 100644 (file)
--- a/main.go
+++ b/main.go
@@ -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