Skip to content

Commit

Permalink
chup logic fixed chdown pending
Browse files Browse the repository at this point in the history
  • Loading branch information
talkkonnect committed Mar 5, 2022
1 parent 50d2f98 commit e574de2
Show file tree
Hide file tree
Showing 4 changed files with 37 additions and 27 deletions.
27 changes: 18 additions & 9 deletions clientcommands.go
Original file line number Diff line number Diff line change
Expand Up @@ -378,38 +378,47 @@ func (b *Talkkonnect) ChannelUp() {
if !(IsConnected) {
return
}

ChannelAction = "channelup"
TTSEvent("channelup")
Channel := b.Client.Channels.Find()
currentIndex := b.findChannelIndex(b.Client.Self.Channel.ID)
NextIndex := currentIndex

if currentIndex+1 < len(b.Client.Channels) {
Channel = b.Client.Channels.Find(ChannelsList[currentIndex+1].chanName)
NextIndex = currentIndex + 1
}

if Channel != nil {
b.Client.Self.Move(Channel)
if ChannelsList[NextIndex].chanenterPermissions {
if Channel != nil {
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)
if ChannelsList[i].chanenterPermissions {
b.Client.Self.Move(Channel)
break
}
}
}
}

func (b *Talkkonnect) ChannelDown() {
if !(IsConnected) {
return
}

ChannelAction = "channeldown"
TTSEvent("channeldown")
Channel := b.Client.Channels.Find()
Channel := b.Client.Channels.Find(ChannelsList[len(b.Client.Channels)-1].chanName)
currentIndex := b.findChannelIndex(b.Client.Self.Channel.ID)
log.Println("alert: Current Index in Channel Down Func ", currentIndex)

if currentIndex > 0 {
Channel = b.Client.Channels.Find(ChannelsList[currentIndex-1].chanName)
}

if currentIndex == 0 {
Channel = b.Client.Channels.Find(ChannelsList[len(b.Client.Channels)-1].chanName)
}

if currentIndex == 1 {
Channel = b.Client.Channels.Find()
}
Expand Down
3 changes: 3 additions & 0 deletions onevent.go
Original file line number Diff line number Diff line change
Expand Up @@ -269,6 +269,9 @@ func (b *Talkkonnect) OnPermissionDenied(e *gumble.PermissionDeniedEvent) {
for index, ch := range ChannelsList {
if ch.chanID == int(e.Channel.ID) {
ChannelsList[index].chanenterPermissions = false
if ChannelAction == "channelup" {
b.ChannelUp()
}
break
}
}
Expand Down
2 changes: 1 addition & 1 deletion version.go
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
package talkkonnect

const (
talkkonnectVersion string = "2.12.01"
talkkonnectVersion string = "2.12.02"
talkkonnectReleased string = "Mar 5 2022"
)

Expand Down
32 changes: 15 additions & 17 deletions xmlparser.go
Original file line number Diff line number Diff line change
Expand Up @@ -655,8 +655,8 @@ var (
ConnectAttempts int
AccountIndex int
GenericCounter int
ChannelIndex int
CurrentIndex int
ChannelAction string
)

// Generic Global Timer Variables
Expand All @@ -678,22 +678,20 @@ var (

//Mumble Account Settings Global Variables
var (
Default []bool
Name []string
Server []string
Username []string
Password []string
Insecure []bool
Register []bool
Certificate []string
Channel []string
Ident []string
Tokens []gumble.AccessTokens
VT []VTStruct
Accounts int
MaxTokensInAccounts int
ChannelsIndexMax int
ChannelsList []ChannelsListStruct
Default []bool
Name []string
Server []string
Username []string
Password []string
Insecure []bool
Register []bool
Certificate []string
Channel []string
Ident []string
Tokens []gumble.AccessTokens
VT []VTStruct
Accounts int
ChannelsList []ChannelsListStruct
)

//HD44780 LCD Screen Settings Golbal Variables
Expand Down

0 comments on commit e574de2

Please sign in to comment.