summaryrefslogtreecommitdiff
path: root/command.go
diff options
context:
space:
mode:
authorDimitri Sokolyuk <demon@dim13.org>2015-07-29 20:20:01 +0200
committerDimitri Sokolyuk <demon@dim13.org>2015-07-29 20:20:01 +0200
commit48f0b5bc2c42bba866bbed26b7fa0741b7664179 (patch)
tree4389e7698c2719402490130d4e9bfeecb026530d /command.go
parentac23f21e41ca06f948f7f299aae1436e439b0637 (diff)
Kick on timeout, detect flood only on public line
Diffstat (limited to 'command.go')
-rw-r--r--command.go8
1 files changed, 6 insertions, 2 deletions
diff --git a/command.go b/command.go
index f576b13..f2f085b 100644
--- a/command.go
+++ b/command.go
@@ -48,8 +48,12 @@ func Dispatch(conn *irc.Conn, line *irc.Line) {
if f := strings.Fields(line.Text()); len(f) > 0 {
cmd := strings.ToLower(f[0])
if c, ok := commands[cmd]; ok {
- if c.WithArgs(len(f)) &&
- !(line.Public() && c.Timeout(line.Nick)) {
+ if line.Public() && c.Timeout(line.Nick) {
+ log.Println("timeout", line.Nick)
+ conn.Kick(*room, line.Nick, "timeout")
+ return
+ }
+ if c.WithArgs(len(f)) {
log.Println(line.Nick, f)
c.Handle(conn, line)
}