summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDimitri Sokolyuk <demon@dim13.org>2015-10-11 18:20:48 +0200
committerDimitri Sokolyuk <demon@dim13.org>2015-10-11 18:20:48 +0200
commit1625dffcdad5c85699a22698ea32594bbc8d7946 (patch)
tree0e59cd4e62df588642ed54c83e2adfebe0c1990c
parente7e2f7b851e9a25f9bd79e579a0131dde9124065 (diff)
Use Rune Count
-rw-r--r--flood.go3
1 files changed, 2 insertions, 1 deletions
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 {