From 1625dffcdad5c85699a22698ea32594bbc8d7946 Mon Sep 17 00:00:00 2001 From: Dimitri Sokolyuk Date: Sun, 11 Oct 2015 18:20:48 +0200 Subject: Use Rune Count --- flood.go | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/flood.go b/flood.go index 776a96a..356ab89 100644 --- a/flood.go +++ b/flood.go @@ -5,6 +5,7 @@ import ( "math" "sort" "strings" + "unicode/utf8" irc "github.com/fluffle/goirc/client" ) @@ -21,7 +22,7 @@ func Entropy(s string) (e float64) { } func Flood(s string) bool { - if len(s) < 8 { + if utf8.RuneCountInString(s) < 4 { return false } if v := strings.Fields(s); len(v) >= 6 { -- cgit v1.2.3