From 03e5b3a84ec1d547493e50d485e000a9fa1e335e Mon Sep 17 00:00:00 2001 From: Alex Bramley Date: Sat, 19 Dec 2009 18:36:12 +0000 Subject: [PATCH] add flood testing capability to test client --- client.go | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/client.go b/client.go index 448a758..c2dc7e3 100644 --- a/client.go +++ b/client.go @@ -44,6 +44,19 @@ func main() { for cmd := range in { if cmd[0] == ':' { switch idx := strings.Index(cmd, " "); { + case cmd[1] == 'd': + fmt.Printf(c.String()) + case cmd[1] == 'f': + if len(cmd) > 2 && cmd[2] == 'e' { + // enable flooding + c.Flood = true + } else if len(cmd) > 2 && cmd[2] == 'd' { + // disable flooding + c.Flood = false + } + for i := 0; i < 20; i++ { + c.Privmsg("#", "flood test!") + } case idx == -1: continue case cmd[1] == 'q': @@ -53,8 +66,6 @@ func main() { c.Join(cmd[idx+1 : len(cmd)]) case cmd[1] == 'p': c.Part(cmd[idx+1 : len(cmd)]) - case cmd[1] == 'd': - fmt.Printf(c.String()) } } else { c.Raw(cmd)