add: :n username channelname ex: :n testuser #testchannel (#97)

Add: :n <nick> <channel> as a command to the example client.

This queries the state tracker for the status of the user on the given channel.
This commit is contained in:
momo-aux 2017-06-02 23:39:41 +02:00 committed by Alex Bee
parent 329a62d7d9
commit 2ece5aab67
2 changed files with 7 additions and 0 deletions

1
.gitignore vendored
View File

@ -5,3 +5,4 @@ _test/
*.swp *.swp
*~ *~
*.out *.out
/.gitconfig

View File

@ -55,6 +55,12 @@ func main() {
switch idx := strings.Index(cmd, " "); { switch idx := strings.Index(cmd, " "); {
case cmd[1] == 'd': case cmd[1] == 'd':
fmt.Printf(c.String()) 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': case cmd[1] == 'f':
if len(cmd) > 2 && cmd[2] == 'e' { if len(cmd) > 2 && cmd[2] == 'e' {
// enable flooding // enable flooding