harmony/pkg/web/channel.go

40 lines
607 B
Go

package web
import (
"sync"
)
type ChannelType int
const (
ChannelUnknown ChannelType = 0
ChannelAll ChannelType = 1
ChannelText ChannelType = 2
ChannelVoice ChannelType = 3
)
type Channel struct {
ID int
Type ChannelType
Name string
Topic string
Clients map[int]*Client
*sync.Mutex
}
func NewChannel(id int, t ChannelType) *Channel {
c := Channel{ID: id, Type: t, Clients: make(map[int]*Client), Mutex: new(sync.Mutex)}
return &c
}
type ChannelListing struct {
ID int
Type ChannelType
Name string
Topic string
}
type ChannelList map[int]*ChannelListing