use server.name and server.nameString, name for checking and getting nice comparison, nameString for reply outputs

This commit is contained in:
Daniel Oaks
2016-06-19 15:43:16 +10:00
parent 7b13858f8c
commit 2a519c8061
5 changed files with 46 additions and 44 deletions
+3 -1
View File
@@ -31,7 +31,8 @@ type Server struct {
db *sql.DB
idle chan *Client
motdLines []string
name string
name Name
nameString string // cache for server name string since it's used with almost every reply
newConns chan net.Conn
operators map[Name][]byte
password []byte
@@ -56,6 +57,7 @@ func NewServer(config *Config) *Server {
db: OpenDB(config.Server.Database),
idle: make(chan *Client),
name: NewName(config.Server.Name),
nameString: NewName(config.Server.Name).String(),
newConns: make(chan net.Conn),
operators: config.Operators(),
signals: make(chan os.Signal, len(SERVER_SIGNALS)),