diff --git a/go.mod b/go.mod index 2d6107bf..844d8dc6 100644 --- a/go.mod +++ b/go.mod @@ -26,7 +26,7 @@ require ( github.com/kr/pretty v0.1.0 // indirect github.com/labstack/echo v0.0.0-20180219162101-7eec915044a1 github.com/labstack/gommon v0.2.1 // indirect - github.com/lrstanley/girc v0.0.0-20180427160007-102f17f86306 + github.com/lrstanley/girc v0.0.0-20180913221000-0fb5b684054e github.com/magiconair/properties v0.0.0-20180217134545-2c9e95027885 // indirect github.com/matterbridge/discordgo v0.0.0-20180806170629-ef40ff5ba64f github.com/matterbridge/go-xmpp v0.0.0-20180529212104-cd19799fba91 diff --git a/go.sum b/go.sum index 99fffb38..aa2f2f05 100644 --- a/go.sum +++ b/go.sum @@ -53,6 +53,8 @@ github.com/labstack/gommon v0.2.1 h1:C+I4NYknueQncqKYZQ34kHsLZJVeB5KwPUhnO0nmbpU github.com/labstack/gommon v0.2.1/go.mod h1:/tj9csK2iPSBvn+3NLM9e52usepMtrd5ilFYA+wQNJ4= github.com/lrstanley/girc v0.0.0-20180427160007-102f17f86306 h1:IqN61cmi7LM/IaYaP9a/KXFtHRS2a3+WHu8GhAXJT7c= github.com/lrstanley/girc v0.0.0-20180427160007-102f17f86306/go.mod h1:7cRs1SIBfKQ7e3Tam6GKTILSNHzR862JD0JpINaZoJk= +github.com/lrstanley/girc v0.0.0-20180913221000-0fb5b684054e h1:RpktB2igr6nS1EN7bCvjldAEfngrM5GyAbmOa4/cafU= +github.com/lrstanley/girc v0.0.0-20180913221000-0fb5b684054e/go.mod h1:7cRs1SIBfKQ7e3Tam6GKTILSNHzR862JD0JpINaZoJk= github.com/magiconair/properties v0.0.0-20180217134545-2c9e95027885 h1:HWxJJvF+QceKcql4r9PC93NtMEgEBfBxlQrZPvbcQvs= github.com/magiconair/properties v0.0.0-20180217134545-2c9e95027885/go.mod h1:PppfXfuXeibc/6YijjN8zIbojt8czPbwD3XqdrwzmxQ= github.com/matterbridge/discordgo v0.0.0-20180806170629-ef40ff5ba64f h1:9IIOO9Aznn8zJx3nokZ4U6nfuzWw5xAlygPvuRZMisQ= 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 { diff --git a/vendor/modules.txt b/vendor/modules.txt index 3748db19..c95b593e 100644 --- a/vendor/modules.txt +++ b/vendor/modules.txt @@ -62,7 +62,7 @@ github.com/labstack/gommon/color github.com/labstack/gommon/log github.com/labstack/gommon/bytes github.com/labstack/gommon/random -# github.com/lrstanley/girc v0.0.0-20180427160007-102f17f86306 +# github.com/lrstanley/girc v0.0.0-20180913221000-0fb5b684054e github.com/lrstanley/girc # github.com/magiconair/properties v0.0.0-20180217134545-2c9e95027885 github.com/magiconair/properties