LUSERCHANNEL/LUSERCLIENT handling
All checks were successful
continuous-integration/drone/push Build is passing

This commit is contained in:
blackbeard420 2021-10-27 21:25:41 -04:00
parent a89349d1e3
commit 659601e7c0
2 changed files with 26 additions and 4 deletions

View File

@ -2,6 +2,7 @@ package irc
const (
RPL_LUSERCLIENT = 251
RPL_LUSERCHANNELS = 254
RPL_NAMREPLY = 353
RPL_ENDOFMOTD = 376

View File

@ -3,6 +3,7 @@ package irc
import (
"fmt"
"log"
"strconv"
"strings"
"testing"
"time"
@ -40,7 +41,6 @@ func TestLusers(t *testing.T) {
con.NumericCallback = func(from string, i int, args string) {
if i == RPL_LUSERCLIENT {
log.Printf("luser reply: %s\n", args)
con.SendJoin(channel)
s := strings.Split(args, ":")
@ -58,6 +58,27 @@ func TestLusers(t *testing.T) {
con.Run()
}
func TestLusersChannels(t *testing.T) {
con := NewConnection("irc.ouch.chat:6667", "irc-go", "irc-go", nil, []string{channel})
con.NumericCallback = func(from string, i int, args string) {
if i == RPL_LUSERCHANNELS {
con.SendJoin(channel)
s := strings.TrimSpace(strings.Split(args, " ")[1])
val, err := strconv.Atoi(s)
if err == nil {
con.SendPrivmsg(channel, fmt.Sprintf("There are %d channels formed", val))
} else {
t.Fatal(err.Error())
}
con.SendQuit("scan complete")
}
}
con.Run()
}
func TestParser(t *testing.T) {
log.Printf("testing %s\n", t.Name())
}