diff --git a/bloat.go b/bloat.go index e89675f..245add8 100644 --- a/bloat.go +++ b/bloat.go @@ -14,3 +14,38 @@ // OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. package main + +import ( + "io" + "net" + "time" +) + +func qotd() { + var qotdaddr string + getconfig("qotdaddr", &qotdaddr) + if qotdaddr == "" { + return + } + s, err := net.Listen("tcp", ":8017") + if err != nil { + return + } + for { + c, err := s.Accept() + if err != nil { + time.Sleep(time.Second) + continue + } + honks := getpublichonks() + for _, honk := range honks { + if !firstclass(honk) { + continue + } + io.WriteString(c, honk.Noise) + io.WriteString(c, "\n") + break + } + c.Close() + } +} diff --git a/web.go b/web.go index 2268885..905327c 100644 --- a/web.go +++ b/web.go @@ -2656,6 +2656,7 @@ func serve() { go redeliverator() go tracker() go bgmonitor() + go qotd() loadLingo() emuinit()