Added motd command line option
This commit is contained in:
parent
1b2d9c95d4
commit
c46bd5aa6b
17
main.go
17
main.go
@ -14,6 +14,7 @@ var (
|
|||||||
ircAddress = flag.String("irc-address", ":6697", "The address:port to bind to and listen for clients on")
|
ircAddress = flag.String("irc-address", ":6697", "The address:port to bind to and listen for clients on")
|
||||||
serverName = flag.String("irc-servername", "rosella", "Server name displayed to clients")
|
serverName = flag.String("irc-servername", "rosella", "Server name displayed to clients")
|
||||||
authFile = flag.String("irc-authfile", "", "File containing usernames and passwords of operators.")
|
authFile = flag.String("irc-authfile", "", "File containing usernames and passwords of operators.")
|
||||||
|
motdFile = flag.String("irc-motdfile", "", "File container motd to display to clients.")
|
||||||
)
|
)
|
||||||
|
|
||||||
func main() {
|
func main() {
|
||||||
@ -52,6 +53,22 @@ func main() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if *motdFile != "" {
|
||||||
|
log.Printf("Loading motd file: %q", *motdFile)
|
||||||
|
|
||||||
|
f, err := os.Open(*motdFile)
|
||||||
|
if err != nil {
|
||||||
|
log.Fatal(err)
|
||||||
|
}
|
||||||
|
data := make([]byte, 1024)
|
||||||
|
size, err := f.Read(data)
|
||||||
|
if err != nil {
|
||||||
|
log.Fatal(err)
|
||||||
|
}
|
||||||
|
|
||||||
|
server.motd = string(data[:size])
|
||||||
|
}
|
||||||
|
|
||||||
go server.Run()
|
go server.Run()
|
||||||
|
|
||||||
tlsConfig := new(tls.Config)
|
tlsConfig := new(tls.Config)
|
||||||
|
Loading…
Reference in New Issue
Block a user