From e0ca876de2dd8a8f0226848ef4ef10ef27400291 Mon Sep 17 00:00:00 2001 From: Wim Date: Fri, 14 Sep 2018 00:18:20 +0200 Subject: Update vendor lrstanley/girc --- vendor/github.com/lrstanley/girc/cap.go | 2 +- vendor/github.com/lrstanley/girc/client.go | 2 +- vendor/github.com/lrstanley/girc/event.go | 26 ++++++++++++++++++++++---- 3 files changed, 24 insertions(+), 6 deletions(-) (limited to 'vendor/github.com/lrstanley') diff --git a/vendor/github.com/lrstanley/girc/cap.go b/vendor/github.com/lrstanley/girc/cap.go index e7037f9f..89146484 100644 --- a/vendor/github.com/lrstanley/girc/cap.go +++ b/vendor/github.com/lrstanley/girc/cap.go @@ -102,7 +102,7 @@ func handleCAP(c *Client, e Event) { possible := possibleCapList(c) - if len(e.Params) >= 2 && len(e.Trailing) > 1 && e.Params[1] == CAP_LS { + if len(e.Params) >= 2 && e.Params[1] == CAP_LS { c.state.Lock() caps := parseCap(e.Trailing) diff --git a/vendor/github.com/lrstanley/girc/client.go b/vendor/github.com/lrstanley/girc/client.go index 4f823e16..63f47eaa 100644 --- a/vendor/github.com/lrstanley/girc/client.go +++ b/vendor/github.com/lrstanley/girc/client.go @@ -135,7 +135,7 @@ type Config struct { // PingDelay is the frequency between when the client sends a keep-alive // PING to the server, and awaits a response (and times out if the server // doesn't respond in time). This should be between 20-600 seconds. See - // Client.Lag() if you want to determine the delay between the server + // Client.Latency() if you want to determine the delay between the server // and the client. If this is set to -1, the client will not attempt to // send client -> server PING requests. PingDelay time.Duration diff --git a/vendor/github.com/lrstanley/girc/event.go b/vendor/github.com/lrstanley/girc/event.go index 20182340..5e17b15b 100644 --- a/vendor/github.com/lrstanley/girc/event.go +++ b/vendor/github.com/lrstanley/girc/event.go @@ -51,7 +51,7 @@ type Event struct { // Trailing text. e.g. with a PRIVMSG, this is the message text (part // after the colon.) Trailing string `json:"trailing"` - // EmptyTrailign, if true, the text prefix (:) will be added even if + // EmptyTrailing, if true, the text prefix (:) will be added even if // Event.Trailing is empty. EmptyTrailing bool `json:"empty_trailing"` // Sensitive should be true if the message is sensitive (e.g. and should @@ -383,12 +383,30 @@ func (e *Event) Pretty() (out string, ok bool) { return fmt.Sprintf("[*] %s has quit (%s)", e.Source.Name, e.Trailing), true } - if e.Command == KICK && len(e.Params) == 2 { + if e.Command == INVITE && len(e.Params) == 1 { + return fmt.Sprintf("[*] %s invited to %s by %s", e.Params[0], e.Trailing, e.Source.Name), true + } + + if e.Command == KICK && len(e.Params) >= 2 { + if e.Trailing == "" && len(e.Params) == 3 { + e.Trailing = e.Params[2] + } + return fmt.Sprintf("[%s] *** %s has kicked %s: %s", e.Params[0], e.Source.Name, e.Params[1], e.Trailing), true } - if e.Command == NICK && len(e.Params) == 1 { - return fmt.Sprintf("[*] %s is now known as %s", e.Source.Name, e.Params[0]), true + if e.Command == NICK { + // Workaround, see https://github.com/lrstanley/girc/pull/15#issuecomment-413845482 + var name string + if len(e.Params) == 1 { + name = e.Params[0] + } else if len(e.Trailing) > 0 { + name = e.Trailing + } + + if name != "" { + return fmt.Sprintf("[*] %s is now known as %s", e.Source.Name, name), true + } } if e.Command == TOPIC && len(e.Params) > 0 { -- cgit v1.2.3