Compare commits
1 Commits
v1.6.6
...
RplWelcome
Author | SHA1 | Date | |
---|---|---|---|
![]() |
d3fd6ec764 |
@@ -33,6 +33,10 @@ type Config struct {
|
|||||||
sync.Mutex
|
sync.Mutex
|
||||||
filename string
|
filename string
|
||||||
|
|
||||||
|
Network struct {
|
||||||
|
Name string
|
||||||
|
}
|
||||||
|
|
||||||
Server struct {
|
Server struct {
|
||||||
PassConfig `yaml:",inline"`
|
PassConfig `yaml:",inline"`
|
||||||
Listen []string
|
Listen []string
|
||||||
@@ -97,6 +101,10 @@ func LoadConfig(filename string) (config *Config, err error) {
|
|||||||
|
|
||||||
config.filename = filename
|
config.filename = filename
|
||||||
|
|
||||||
|
if config.Network.Name == "" {
|
||||||
|
return nil, errors.New("Network name missing")
|
||||||
|
}
|
||||||
|
|
||||||
if config.Server.Name == "" {
|
if config.Server.Name == "" {
|
||||||
return nil, errors.New("Server name missing")
|
return nil, errors.New("Server name missing")
|
||||||
}
|
}
|
||||||
|
@@ -173,8 +173,12 @@ func RplCap(client *Client, subCommand CapSubCommand, arg interface{}) string {
|
|||||||
// numeric replies
|
// numeric replies
|
||||||
|
|
||||||
func (target *Client) RplWelcome() {
|
func (target *Client) RplWelcome() {
|
||||||
target.NumericReply(RPL_WELCOME,
|
target.NumericReply(
|
||||||
":Welcome to the Internet Relay Network %s", target.Id())
|
RPL_WELCOME,
|
||||||
|
":Welcome to the %s Internet Relay Network %s",
|
||||||
|
target.server.Network(),
|
||||||
|
target.Id(),
|
||||||
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
func (target *Client) RplYourHost() {
|
func (target *Client) RplYourHost() {
|
||||||
|
@@ -37,6 +37,7 @@ type Server struct {
|
|||||||
idle chan *Client
|
idle chan *Client
|
||||||
motdFile string
|
motdFile string
|
||||||
name Name
|
name Name
|
||||||
|
network Name
|
||||||
description string
|
description string
|
||||||
newConns chan net.Conn
|
newConns chan net.Conn
|
||||||
operators map[Name][]byte
|
operators map[Name][]byte
|
||||||
@@ -63,6 +64,7 @@ func NewServer(config *Config) *Server {
|
|||||||
idle: make(chan *Client),
|
idle: make(chan *Client),
|
||||||
motdFile: config.Server.MOTD,
|
motdFile: config.Server.MOTD,
|
||||||
name: NewName(config.Server.Name),
|
name: NewName(config.Server.Name),
|
||||||
|
network: NewName(config.Network.Name),
|
||||||
description: config.Server.Description,
|
description: config.Server.Description,
|
||||||
newConns: make(chan net.Conn),
|
newConns: make(chan net.Conn),
|
||||||
operators: config.Operators(),
|
operators: config.Operators(),
|
||||||
@@ -314,6 +316,7 @@ func (s *Server) Rehash() error {
|
|||||||
|
|
||||||
s.motdFile = s.config.Server.MOTD
|
s.motdFile = s.config.Server.MOTD
|
||||||
s.name = NewName(s.config.Server.Name)
|
s.name = NewName(s.config.Server.Name)
|
||||||
|
s.network = NewName(s.config.Network.Name)
|
||||||
s.description = s.config.Server.Description
|
s.description = s.config.Server.Description
|
||||||
s.operators = s.config.Operators()
|
s.operators = s.config.Operators()
|
||||||
|
|
||||||
@@ -324,6 +327,10 @@ func (s *Server) Id() Name {
|
|||||||
return s.name
|
return s.name
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (s *Server) Network() Name {
|
||||||
|
return s.network
|
||||||
|
}
|
||||||
|
|
||||||
func (s *Server) String() string {
|
func (s *Server) String() string {
|
||||||
return s.name.String()
|
return s.name.String()
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user