@@ 24,10 24,13 @@ var (
var (
ListOwwsExp = regexp.MustCompile(`^(Owws)`)
- PostOwwExp = regexp.MustCompile(`^[a-zA-Z0-9 ]+: ((?i)Oww)`)
+ PostOwwExp = regexp.MustCompile(`^[a-zA-Z0-9 ]+: ((?i)Oww)( [a-zA-Z0-9]+)?`)
)
func handleConnection(con net.Conn) {
+ if len(OwwPosts) == 25 {
+ OwwPosts = OwwPosts[15:]
+ }
buf := make([]byte, 1024)
con.Read(buf)
buf = bytes.TrimSpace(buf)
@@ 37,7 40,7 @@ func handleConnection(con net.Conn) {
}
} else if PostOwwExp.Match(buf) {
con.Write([]byte("Oww\n"))
- OwwPosts = append(OwwPosts, string(buf))
+ OwwPosts = append(OwwPosts, string(PostOwwExp.Find(buf)))
}
con.Close()
}