From 2ece5aab675bac99b291f006e95710d8b9d0758e Mon Sep 17 00:00:00 2001 From: momo-aux Date: Fri, 2 Jun 2017 23:39:41 +0200 Subject: [PATCH] add: :n username channelname ex: :n testuser #testchannel (#97) Add: :n as a command to the example client. This queries the state tracker for the status of the user on the given channel. --- .gitignore | 1 + client.go | 6 ++++++ 2 files changed, 7 insertions(+) diff --git a/.gitignore b/.gitignore index 93233d9..1cbcab5 100644 --- a/.gitignore +++ b/.gitignore @@ -5,3 +5,4 @@ _test/ *.swp *~ *.out +/.gitconfig diff --git a/client.go b/client.go index 204b297..b71d706 100644 --- a/client.go +++ b/client.go @@ -55,6 +55,12 @@ func main() { switch idx := strings.Index(cmd, " "); { case cmd[1] == 'd': fmt.Printf(c.String()) + case cmd[1] == 'n': + parts := strings.Split(cmd, " ") + username := strings.TrimSpace(parts[1]) + channelname := strings.TrimSpace(parts[2]) + _, userIsOn := c.StateTracker().IsOn(channelname, username) + fmt.Printf("Checking if %s is in %s Online: %t\n", username, channelname, userIsOn) case cmd[1] == 'f': if len(cmd) > 2 && cmd[2] == 'e' { // enable flooding