This commit is contained in:
Ted Unangst 2023-08-08 16:17:47 -04:00
parent fe783eda2a
commit ad8d72ce0d
2 changed files with 36 additions and 0 deletions

View File

@ -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()
}
}

1
web.go
View File

@ -2656,6 +2656,7 @@ func serve() {
go redeliverator()
go tracker()
go bgmonitor()
go qotd()
loadLingo()
emuinit()