From c46bd5aa6b1d9c34075231f81568ddaea6f6731e Mon Sep 17 00:00:00 2001 From: Harry Jeffery Date: Sun, 8 Sep 2013 22:56:43 +0100 Subject: [PATCH] Added motd command line option --- main.go | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/main.go b/main.go index 5d44550..5a113bc 100644 --- a/main.go +++ b/main.go @@ -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)