nmdc-ircfrontend/rosella.go

64 lines
983 B
Go
Raw Normal View History

2013-08-23 01:03:37 +00:00
package main
2013-08-24 06:48:28 +00:00
import "net"
2013-08-23 01:03:37 +00:00
type Server struct {
2013-08-23 22:59:33 +00:00
eventChan chan Event
running bool
name string
clientMap map[string]*Client //Map of nicks → clients
channelMap map[string]*Channel //Map of channel names → channels
operatorMap map[string]string //Map of usernames → SHA1 hashed passwords
2013-08-23 01:03:37 +00:00
}
type Client struct {
server *Server
connection net.Conn
signalChan chan int
outputChan chan string
nick string
2013-08-23 15:24:06 +00:00
registered bool
connected bool
2013-08-23 22:59:33 +00:00
operator bool
2013-08-23 01:03:37 +00:00
channelMap map[string]*Channel
}
2013-08-24 06:48:28 +00:00
type Event struct {
client *Client
input string
}
2013-08-23 01:03:37 +00:00
type Channel struct {
name string
topic string
clientMap map[string]*Client
}
const (
signalStop int = iota
)
const (
rplWelcome int = iota
rplJoin
rplPart
2013-08-23 01:03:37 +00:00
rplTopic
rplNoTopic
2013-08-23 01:03:37 +00:00
rplNames
rplNickChange
rplKill
2013-08-23 16:39:10 +00:00
rplMsg
2013-08-23 21:09:29 +00:00
rplList
2013-08-23 22:59:33 +00:00
rplOper
2013-08-23 01:03:37 +00:00
errMoreArgs
errNoNick
errInvalidNick
errNickInUse
errAlreadyReg
errNoSuchNick
2013-08-23 14:39:40 +00:00
errUnknownCommand
2013-08-23 15:24:06 +00:00
errNotReg
2013-08-23 22:59:33 +00:00
errPassword
2013-08-23 23:18:54 +00:00
errNoPriv
2013-08-23 01:03:37 +00:00
)