5
0
mirror of https://github.com/cwinfo/matterbridge.git synced 2024-11-22 21:50:28 +00:00
matterbridge/vendor/layeh.com/gumble/gumble/channels.go
2020-10-01 22:50:56 +02:00

29 lines
747 B
Go

package gumble
// Channels is a map of server channels.
type Channels map[uint32]*Channel
// create adds a new channel with the given id to the collection. If a channel
// with the given id already exists, it is overwritten.
func (c Channels) create(id uint32) *Channel {
channel := &Channel{
ID: id,
Links: Channels{},
Children: Channels{},
Users: Users{},
}
c[id] = channel
return channel
}
// Find returns a channel whose path (by channel name) from the server root
// channel is equal to the arguments passed. nil is returned if c does not
// containt the root channel.
func (c Channels) Find(names ...string) *Channel {
root := c[0]
if names == nil || root == nil {
return root
}
return root.Find(names...)
}