Initial commit, lots of cleanup and stuff to do, it may not work.
This commit is contained in:
18
gumble/gumbleutil/channel.go
Normal file
18
gumble/gumbleutil/channel.go
Normal file
@ -0,0 +1,18 @@
|
||||
package gumbleutil // import "git.2mb.codes/~cmb/barnard/gumble/gumbleutil"
|
||||
|
||||
import (
|
||||
"git.2mb.codes/~cmb/barnard/gumble/gumble"
|
||||
)
|
||||
|
||||
// ChannelPath returns a slice of channel names, starting from the root channel
|
||||
// to the given channel.
|
||||
func ChannelPath(channel *gumble.Channel) []string {
|
||||
var pieces []string
|
||||
for ; channel != nil; channel = channel.Parent {
|
||||
pieces = append(pieces, channel.Name)
|
||||
}
|
||||
for i := 0; i < (len(pieces) / 2); i++ {
|
||||
pieces[len(pieces)-1-i], pieces[i] = pieces[i], pieces[len(pieces)-1-i]
|
||||
}
|
||||
return pieces
|
||||
}
|
Reference in New Issue
Block a user