mirror of
https://github.com/shazow/ssh-chat.git
synced 2025-08-04 02:07:49 -04:00
29 lines
494 B
Go
29 lines
494 B
Go
package chat
|
|
|
|
// Host knows about all the commands and channels.
|
|
type Host struct {
|
|
defaultChannel *Channel
|
|
commands Commands
|
|
done chan struct{}
|
|
}
|
|
|
|
func NewHost() *Host {
|
|
h := Host{
|
|
commands: defaultCmdHandlers,
|
|
}
|
|
h.defaultChannel = h.CreateChannel("")
|
|
return &h
|
|
}
|
|
|
|
func (h *Host) handleCommand(m Message) {
|
|
// TODO: ...
|
|
}
|
|
|
|
func (h *Host) broadcast(ch *Channel, m Message) {
|
|
// TODO: ...
|
|
}
|
|
|
|
func (h *Host) CreateChannel(id string) *Channel {
|
|
return NewChannel(id)
|
|
}
|