diff --git a/clientcommands.go b/clientcommands.go index c1d933a..bf1b307 100644 --- a/clientcommands.go +++ b/clientcommands.go @@ -394,9 +394,15 @@ func (b *Talkkonnect) ChannelUp() { b.Client.Self.Move(Channel) } } else { - for i := NextIndex + 1; i < len(b.Client.Channels); i++ { - log.Println("info: Skipping Channel") - Channel = b.Client.Channels.Find(ChannelsList[i].chanName) + for i := NextIndex + 1; i <= len(b.Client.Channels); i++ { + //special handling for when highest channel has no token + if i == len(b.Client.Channels) { + Channel = b.Client.Channels.Find() + b.Client.Self.Move(Channel) + return + } else { + Channel = b.Client.Channels.Find(ChannelsList[i].chanName) + } if ChannelsList[i].chanenterPermissions { b.Client.Self.Move(Channel) break @@ -415,9 +421,10 @@ func (b *Talkkonnect) ChannelDown() { currentIndex := b.findChannelIndex(b.Client.Self.Channel.ID) NextIndex := currentIndex - if currentIndex > 0 { - Channel = b.Client.Channels.Find(ChannelsList[currentIndex-1].chanName) - NextIndex = currentIndex - 1 + if currentIndex == 0 { + //special handling of max channel without token + Channel = b.Client.Channels.Find(ChannelsList[len(b.Client.Channels)-1].chanName) + NextIndex = len(b.Client.Channels) - 1 } if currentIndex == 1 { @@ -425,13 +432,17 @@ func (b *Talkkonnect) ChannelDown() { NextIndex = currentIndex - 1 } + if currentIndex > 1 { + Channel = b.Client.Channels.Find(ChannelsList[currentIndex-1].chanName) + NextIndex = currentIndex - 1 + } + if ChannelsList[NextIndex].chanenterPermissions { if Channel != nil { b.Client.Self.Move(Channel) } } else { - for i := NextIndex - 1; i > 0; i-- { - log.Println("info: Skipping Channel") + for i := NextIndex - 1; i >= 0; i-- { Channel = b.Client.Channels.Find(ChannelsList[i].chanName) if ChannelsList[i].chanenterPermissions { b.Client.Self.Move(Channel) diff --git a/onevent.go b/onevent.go index 90a9851..ae474e2 100644 --- a/onevent.go +++ b/onevent.go @@ -268,6 +268,7 @@ func (b *Talkkonnect) OnPermissionDenied(e *gumble.PermissionDeniedEvent) { log.Printf("warn: Permission Denied For Channel ID %v Channel Name %v\n", e.Channel.ID, e.Channel.Name) for index, ch := range ChannelsList { if ch.chanID == int(e.Channel.ID) { + log.Printf("warn: Setting Channel Index %v Channel ID %v Channel Name %v Channel Enter to False\n", index, e.Channel.ID, e.Channel.Name) ChannelsList[index].chanenterPermissions = false if ChannelAction == "channelup" { b.ChannelUp() diff --git a/version.go b/version.go index ffe19e7..e1fc800 100644 --- a/version.go +++ b/version.go @@ -31,10 +31,10 @@ package talkkonnect const ( - talkkonnectVersion string = "2.12.03" + talkkonnectVersion string = "2.12.04" talkkonnectReleased string = "Mar 5 2022" ) /* Release Notes -1. Fixed Channel Down Logic With Skipping Channels With No Permissions +1. Fixed Channel Up/Down when No Token For Last Channel */