channel

package
v0.1.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 15, 2026 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Manager

type Manager struct {
	// contains filtered or unexported fields
}

Manager maintains the channel tree state.

func NewManager

func NewManager(db *gorm.DB, serverID uint) *Manager

NewManager creates a ChannelManager for a virtual server.

func (*Manager) AncestorChain

func (m *Manager) AncestorChain(channelID uint32) []uint32

AncestorChain returns channel IDs from the given channel up to root (inclusive). First element is the channel, last is root.

func (*Manager) CleanEmptyTempChannels

func (m *Manager) CleanEmptyTempChannels(hasUsers func(channelID uint32) bool)

CleanEmptyTempChannels removes temporary channels that have no users and no children. hasUsers returns true if the channel has any users.

func (*Manager) Create

func (m *Manager) Create(parentID uint32, name string, description string, position int32, temporary bool, maxUsers uint32) *mumble.Channel

Create creates a new channel. Returns the channel or nil on error.

func (*Manager) GetChannel

func (m *Manager) GetChannel(id uint32) (*mumble.Channel, bool)

GetChannel returns a channel by ID.

func (*Manager) GetChannelWithMeta

func (m *Manager) GetChannelWithMeta(channelID uint32) (ch *mumble.Channel, inheritACL bool, ok bool)

GetChannelWithMeta returns the channel and its InheritACL. ok is false if not found.

func (*Manager) GetTree

func (m *Manager) GetTree() []*mumble.Channel

GetTree returns the full channel tree as a flat list (BFS order).

func (*Manager) LinkedChannelIDs

func (m *Manager) LinkedChannelIDs(channelID uint32) []uint32

LinkedChannelIDs returns the channel ID and its linked channel IDs.

func (*Manager) NextID

func (m *Manager) NextID() uint32

NextID returns the next unused channel ID for temporary channels (in-memory only).

func (*Manager) Reload

func (m *Manager) Reload()

Reload re-reads the channel tree from the database. Use when the DB may have been modified outside this manager (e.g. by another process or REST when using a fallback manager).

func (*Manager) Remove

func (m *Manager) Remove(id uint32) bool

Remove removes a channel. Returns false if channel not found, is root, or has children.

func (*Manager) RootID

func (m *Manager) RootID() uint32

RootID returns the root channel ID (0 per Mumble spec).

func (*Manager) ServerID

func (m *Manager) ServerID() uint

ServerID returns the virtual server ID.

func (*Manager) SubtreeIDs

func (m *Manager) SubtreeIDs(id uint32) []uint32

SubtreeIDs returns all channel IDs in the subtree rooted at id (including id).

func (*Manager) Update

func (m *Manager) Update(id uint32, opts UpdateOpts) bool

Update updates channel metadata. Returns false if channel not found or update failed.

type UpdateOpts

type UpdateOpts struct {
	Name        *string
	Description *string
	Position    *int32
	MaxUsers    *uint32
	Temporary   *bool
	Links       []uint32 // if non-nil, replace
	LinksAdd    []uint32
	LinksRemove []uint32
}

UpdateOpts holds optional channel updates (nil = don't change).

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL