Added motd command line option

This commit is contained in:
Harry Jeffery 2013-09-08 22:56:43 +01:00
parent 1b2d9c95d4
commit c46bd5aa6b

17
main.go
View File

@ -14,6 +14,7 @@ var (
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")
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() {
@ -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()
tlsConfig := new(tls.Config)