Fix: go module and event bug

This commit is contained in:
kayos@tcp.direct 2021-10-09 06:25:17 -07:00
parent c4ff5a6022
commit b84d822ec5
6 changed files with 9 additions and 10 deletions

View File

@ -7,7 +7,7 @@ import (
"strings"
"sync"
"git.tcp.direct/kayos/girc-atomic"
"github.com/yunginnanet/girc-atomic"
)
// Input is a wrapper for events, based around private messages.

View File

@ -270,14 +270,14 @@ func handleCTCPVersion(client *Client, ctcp CTCPEvent) {
client.Cmd.SendCTCPReplyf(
ctcp.Source.ID(), CTCP_VERSION,
"girc (git.tcp.direct/kayos/girc-atomic) using %s (%s, %s)",
"girc (github.com/yunginnanet/girc-atomic) using %s (%s, %s)",
runtime.Version(), runtime.GOOS, runtime.GOARCH,
)
}
// handleCTCPSource replies with the public git location of this library.
func handleCTCPSource(client *Client, ctcp CTCPEvent) {
client.Cmd.SendCTCPReply(ctcp.Source.ID(), CTCP_SOURCE, "https://git.tcp.direct/kayos/girc-atomic")
client.Cmd.SendCTCPReply(ctcp.Source.ID(), CTCP_SOURCE, "https://github.com/yunginnanet/girc-atomic")
}
// handleCTCPTime replies with a RFC 1123 (Z) formatted version of Go's

View File

@ -248,7 +248,8 @@ func (e *Event) Len() (length int) {
// If param contains a space or it's empty, it's trailing, so it should be
// prefixed with a colon (:).
if i == len(e.Params)-1 && (strings.Contains(e.Params[i], " ") || e.Params[i] == "") {
if i == len(e.Params)-1 && (strings.Contains(e.Params[i], " ") ||
strings.HasPrefix(e.Params[i], ":") || e.Params[i] == "") {
length++
}
}
@ -286,9 +287,8 @@ func (e *Event) Bytes() []byte {
// Space separated list of arguments.
if len(e.Params) > 0 {
// buffer.WriteByte(eventSpace)
for i := 0; i < len(e.Params); i++ {
if i == len(e.Params)-1 && (strings.Contains(e.Params[i], " ") || e.Params[i] == "") {
if i == len(e.Params)-1 && (strings.Contains(e.Params[i], " ") || strings.HasPrefix(e.Params[i], ":") || e.Params[i] == "") {
buffer.WriteString(string(eventSpace) + string(messagePrefix) + e.Params[i])
continue
}

View File

@ -10,7 +10,7 @@ import (
"strings"
"time"
"git.tcp.direct/kayos/girc-atomic"
"github.com/yunginnanet/girc-atomic"
)
func ExampleNew() {

4
go.mod
View File

@ -1,5 +1,5 @@
module git.tcp.direct/kayos/girc-atomic
module github.com/yunginnanet/girc-atomic
go 1.12
go 1.17
require github.com/araddon/dateparse v0.0.0-20210429162001-6b43995a97de

1
go.sum
View File

@ -10,7 +10,6 @@ github.com/scylladb/termtables v0.0.0-20191203121021-c4c0b6d42ff4/go.mod h1:C1a7
github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
github.com/stretchr/testify v1.7.0 h1:nwc3DEeHmmLAfoZucVR881uASk0Mfjw8xYJ99tb5CcY=
github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg=
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405 h1:yhCVgyC4o1eVCa2tZl7eS0r+SDo693bJlVdllGtEeKM=
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c h1:dUUwHk2QECo/6vqA44rthZ8ie2QXMNeKRTHCNY2nXvo=
gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=