From 650ea0ce101bd66b5ad6db1e5615ef2493f1bee1 Mon Sep 17 00:00:00 2001 From: Gisle Aune Date: Mon, 26 Nov 2018 22:16:08 +0100 Subject: [PATCH] client: Changed Join and Part method to use queued send instead. [BC Break: removed error return] --- client.go | 8 ++++---- client_test.go | 13 ++----------- 2 files changed, 6 insertions(+), 15 deletions(-) diff --git a/client.go b/client.go index 12aa4bc..936d9a6 100644 --- a/client.go +++ b/client.go @@ -473,13 +473,13 @@ func (client *Client) PrivmsgOverhead(targetName string, action bool) int { } // Join joins one or more channels without a key. -func (client *Client) Join(channels ...string) error { - return client.Sendf("JOIN %s", strings.Join(channels, ",")) +func (client *Client) Join(channels ...string) { + client.SendQueuedf("JOIN %s", strings.Join(channels, ",")) } // Part parts one or more channels. -func (client *Client) Part(channels ...string) error { - return client.Sendf("PART %s", strings.Join(channels, ",")) +func (client *Client) Part(channels ...string) { + client.SendQueuedf("PART %s", strings.Join(channels, ",")) } // Target gets a target by kind and name diff --git a/client_test.go b/client_test.go index 01f5187..cfd6d1e 100644 --- a/client_test.go +++ b/client_test.go @@ -3,7 +3,6 @@ package irc_test import ( "context" "errors" - "fmt" "testing" "git.aiterp.net/gisle/irc" @@ -102,11 +101,7 @@ func TestClient(t *testing.T) { return nil }}, {Callback: func() error { - err := client.Join("#Test") - if err != nil { - return fmt.Errorf("Failed to join #Test: %s", err) - } - + client.Join("#Test") return nil }}, {Kind: 'C', Data: "JOIN #Test"}, @@ -264,11 +259,7 @@ func TestClient(t *testing.T) { {Kind: 'C', Data: "PRIVMSG #Test :\x01ACTION does stuff with 42 things\x01"}, {Kind: 'C', Data: "PRIVMSG #Test :Hello, World"}, {Callback: func() error { - err := client.Part("#Test") - if err != nil { - return fmt.Errorf("Failed to part #Test: %s", err) - } - + client.Part("#Test") return nil }}, {Kind: 'C', Data: "PART #Test"},