mirror of
https://github.com/ergochat/ergo.git
synced 2024-11-25 13:29:27 +01:00
bump irc-go to v0.1.0
This commit is contained in:
parent
fa7b76d66a
commit
74f3ea1d2e
2
go.mod
2
go.mod
@ -8,7 +8,7 @@ require (
|
|||||||
github.com/docopt/docopt-go v0.0.0-20180111231733-ee0de3bc6815
|
github.com/docopt/docopt-go v0.0.0-20180111231733-ee0de3bc6815
|
||||||
github.com/ergochat/confusables v0.0.0-20201108231250-4ab98ab61fb1
|
github.com/ergochat/confusables v0.0.0-20201108231250-4ab98ab61fb1
|
||||||
github.com/ergochat/go-ident v0.0.0-20200511222032-830550b1d775
|
github.com/ergochat/go-ident v0.0.0-20200511222032-830550b1d775
|
||||||
github.com/ergochat/irc-go v0.0.0-20210617222258-256f1601d3ce
|
github.com/ergochat/irc-go v0.1.0
|
||||||
github.com/go-sql-driver/mysql v1.6.0
|
github.com/go-sql-driver/mysql v1.6.0
|
||||||
github.com/go-test/deep v1.0.6 // indirect
|
github.com/go-test/deep v1.0.6 // indirect
|
||||||
github.com/golang-jwt/jwt v3.2.2+incompatible
|
github.com/golang-jwt/jwt v3.2.2+incompatible
|
||||||
|
2
go.sum
2
go.sum
@ -12,6 +12,8 @@ github.com/ergochat/go-ident v0.0.0-20200511222032-830550b1d775 h1:QSJIdpr3HOzJD
|
|||||||
github.com/ergochat/go-ident v0.0.0-20200511222032-830550b1d775/go.mod h1:d2qvgjD0TvGNSvUs+mZgX090RiJlrzUYW6vtANGOy3A=
|
github.com/ergochat/go-ident v0.0.0-20200511222032-830550b1d775/go.mod h1:d2qvgjD0TvGNSvUs+mZgX090RiJlrzUYW6vtANGOy3A=
|
||||||
github.com/ergochat/irc-go v0.0.0-20210617222258-256f1601d3ce h1:RfyjeynouKZjmnN8WGzCSrtuHGZ9dwfSYBq405FPoqs=
|
github.com/ergochat/irc-go v0.0.0-20210617222258-256f1601d3ce h1:RfyjeynouKZjmnN8WGzCSrtuHGZ9dwfSYBq405FPoqs=
|
||||||
github.com/ergochat/irc-go v0.0.0-20210617222258-256f1601d3ce/go.mod h1:2vi7KNpIPWnReB5hmLpl92eMywQvuIeIIGdt/FQCph0=
|
github.com/ergochat/irc-go v0.0.0-20210617222258-256f1601d3ce/go.mod h1:2vi7KNpIPWnReB5hmLpl92eMywQvuIeIIGdt/FQCph0=
|
||||||
|
github.com/ergochat/irc-go v0.1.0 h1:jBHUayERH9SiPOWe4ePDWRztBjIQsU/jwLbbGUuiOWM=
|
||||||
|
github.com/ergochat/irc-go v0.1.0/go.mod h1:2vi7KNpIPWnReB5hmLpl92eMywQvuIeIIGdt/FQCph0=
|
||||||
github.com/ergochat/scram v1.0.2-ergo1 h1:2bYXiRFQH636pT0msOG39fmEYl4Eq+OuutcyDsCix/g=
|
github.com/ergochat/scram v1.0.2-ergo1 h1:2bYXiRFQH636pT0msOG39fmEYl4Eq+OuutcyDsCix/g=
|
||||||
github.com/ergochat/scram v1.0.2-ergo1/go.mod h1:1WAq6h33pAW+iRreB34OORO2Nf7qel3VV3fjBj+hCSs=
|
github.com/ergochat/scram v1.0.2-ergo1/go.mod h1:1WAq6h33pAW+iRreB34OORO2Nf7qel3VV3fjBj+hCSs=
|
||||||
github.com/ergochat/websocket v1.4.2-oragono1 h1:plMUunFBM6UoSCIYCKKclTdy/TkkHfUslhOfJQzfueM=
|
github.com/ergochat/websocket v1.4.2-oragono1 h1:plMUunFBM6UoSCIYCKKclTdy/TkkHfUslhOfJQzfueM=
|
||||||
|
3
vendor/github.com/ergochat/irc-go/LICENSE
generated
vendored
3
vendor/github.com/ergochat/irc-go/LICENSE
generated
vendored
@ -1,4 +1,5 @@
|
|||||||
Copyright (c) 2016-2017 Daniel Oaks
|
Copyright (c) 2016-2021 Daniel Oaks
|
||||||
|
Copyright (c) 2018-2021 Shivaram Lingamneni
|
||||||
|
|
||||||
Permission to use, copy, modify, and/or distribute this software for any
|
Permission to use, copy, modify, and/or distribute this software for any
|
||||||
purpose with or without fee is hereby granted, provided that the above
|
purpose with or without fee is hereby granted, provided that the above
|
||||||
|
38
vendor/github.com/ergochat/irc-go/ircmsg/message.go
generated
vendored
38
vendor/github.com/ergochat/irc-go/ircmsg/message.go
generated
vendored
@ -65,7 +65,7 @@ var (
|
|||||||
// extended by the IRCv3 Message Tags specification with the introduction
|
// extended by the IRCv3 Message Tags specification with the introduction
|
||||||
// of message tags.
|
// of message tags.
|
||||||
type Message struct {
|
type Message struct {
|
||||||
Prefix string
|
Source string
|
||||||
Command string
|
Command string
|
||||||
Params []string
|
Params []string
|
||||||
forceTrailing bool
|
forceTrailing bool
|
||||||
@ -154,6 +154,22 @@ func (msg *Message) ClientOnlyTags() map[string]string {
|
|||||||
return msg.clientOnlyTags
|
return msg.clientOnlyTags
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Nick returns the name component of the message source (typically a nickname,
|
||||||
|
// but possibly a server name).
|
||||||
|
func (msg *Message) Nick() (nick string) {
|
||||||
|
nuh, err := ParseNUH(msg.Source)
|
||||||
|
if err == nil {
|
||||||
|
return nuh.Name
|
||||||
|
}
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
// NUH returns the source of the message as a parsed NUH ("nick-user-host");
|
||||||
|
// if the source is not well-formed as a NUH, it returns an error.
|
||||||
|
func (msg *Message) NUH() (nuh NUH, err error) {
|
||||||
|
return ParseNUH(msg.Source)
|
||||||
|
}
|
||||||
|
|
||||||
// ParseLine creates and returns a message from the given IRC line.
|
// ParseLine creates and returns a message from the given IRC line.
|
||||||
func ParseLine(line string) (ircmsg Message, err error) {
|
func ParseLine(line string) (ircmsg Message, err error) {
|
||||||
return parseLine(line, 0, 0)
|
return parseLine(line, 0, 0)
|
||||||
@ -229,15 +245,15 @@ func parseLine(line string, maxTagDataLength int, truncateLen int) (ircmsg Messa
|
|||||||
// by one or more ASCII SPACE characters"
|
// by one or more ASCII SPACE characters"
|
||||||
line = trimInitialSpaces(line)
|
line = trimInitialSpaces(line)
|
||||||
|
|
||||||
// prefix
|
// source
|
||||||
if 0 < len(line) && line[0] == ':' {
|
if 0 < len(line) && line[0] == ':' {
|
||||||
prefixEnd := strings.IndexByte(line, ' ')
|
sourceEnd := strings.IndexByte(line, ' ')
|
||||||
if prefixEnd == -1 {
|
if sourceEnd == -1 {
|
||||||
return ircmsg, ErrorLineIsEmpty
|
return ircmsg, ErrorLineIsEmpty
|
||||||
}
|
}
|
||||||
ircmsg.Prefix = line[1:prefixEnd]
|
ircmsg.Source = line[1:sourceEnd]
|
||||||
// skip over the prefix and the separating space
|
// skip over the source and the separating space
|
||||||
line = line[prefixEnd+1:]
|
line = line[sourceEnd+1:]
|
||||||
}
|
}
|
||||||
|
|
||||||
line = trimInitialSpaces(line)
|
line = trimInitialSpaces(line)
|
||||||
@ -312,8 +328,8 @@ func (ircmsg *Message) parseTags(tags string) (err error) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// MakeMessage provides a simple way to create a new Message.
|
// MakeMessage provides a simple way to create a new Message.
|
||||||
func MakeMessage(tags map[string]string, prefix string, command string, params ...string) (ircmsg Message) {
|
func MakeMessage(tags map[string]string, source string, command string, params ...string) (ircmsg Message) {
|
||||||
ircmsg.Prefix = prefix
|
ircmsg.Source = source
|
||||||
ircmsg.Command = command
|
ircmsg.Command = command
|
||||||
ircmsg.Params = params
|
ircmsg.Params = params
|
||||||
ircmsg.UpdateTags(tags)
|
ircmsg.UpdateTags(tags)
|
||||||
@ -411,9 +427,9 @@ func (ircmsg *Message) line(tagLimit, clientOnlyTagDataLimit, serverAddedTagData
|
|||||||
return nil, ErrorTagsTooLong
|
return nil, ErrorTagsTooLong
|
||||||
}
|
}
|
||||||
|
|
||||||
if len(ircmsg.Prefix) > 0 {
|
if len(ircmsg.Source) > 0 {
|
||||||
buf.WriteByte(':')
|
buf.WriteByte(':')
|
||||||
buf.WriteString(ircmsg.Prefix)
|
buf.WriteString(ircmsg.Source)
|
||||||
buf.WriteByte(' ')
|
buf.WriteByte(' ')
|
||||||
}
|
}
|
||||||
|
|
||||||
|
61
vendor/github.com/ergochat/irc-go/ircmsg/userhost.go
generated
vendored
Normal file
61
vendor/github.com/ergochat/irc-go/ircmsg/userhost.go
generated
vendored
Normal file
@ -0,0 +1,61 @@
|
|||||||
|
// written by Daniel Oaks <daniel@danieloaks.net>
|
||||||
|
// released under the ISC license
|
||||||
|
|
||||||
|
package ircmsg
|
||||||
|
|
||||||
|
import (
|
||||||
|
"errors"
|
||||||
|
"strings"
|
||||||
|
)
|
||||||
|
|
||||||
|
var (
|
||||||
|
MalformedNUH = errors.New("NUH is malformed")
|
||||||
|
)
|
||||||
|
|
||||||
|
// NUH holds a parsed name!user@host source ("prefix") of an IRC message.
|
||||||
|
// The Name member will be either a nickname (in the case of a user-initiated
|
||||||
|
// message) or a server name (in the case of a server-initiated numeric,
|
||||||
|
// command, or NOTICE).
|
||||||
|
type NUH struct {
|
||||||
|
Name string
|
||||||
|
User string
|
||||||
|
Host string
|
||||||
|
}
|
||||||
|
|
||||||
|
// ParseNUH parses a NUH source of an IRC message into its constituent parts;
|
||||||
|
// name (nickname or server name), username, and hostname.
|
||||||
|
func ParseNUH(in string) (out NUH, err error) {
|
||||||
|
if len(in) == 0 {
|
||||||
|
return out, MalformedNUH
|
||||||
|
}
|
||||||
|
|
||||||
|
hostStart := strings.IndexByte(in, '@')
|
||||||
|
if hostStart != -1 {
|
||||||
|
out.Host = in[hostStart+1:]
|
||||||
|
in = in[:hostStart]
|
||||||
|
}
|
||||||
|
userStart := strings.IndexByte(in, '!')
|
||||||
|
if userStart != -1 {
|
||||||
|
out.User = in[userStart+1:]
|
||||||
|
in = in[:userStart]
|
||||||
|
}
|
||||||
|
out.Name = in
|
||||||
|
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
// Canonical returns the canonical string representation of the NUH.
|
||||||
|
func (nuh *NUH) Canonical() (result string) {
|
||||||
|
var out strings.Builder
|
||||||
|
out.Grow(len(nuh.Name) + len(nuh.User) + len(nuh.Host) + 2)
|
||||||
|
out.WriteString(nuh.Name)
|
||||||
|
if len(nuh.User) != 0 {
|
||||||
|
out.WriteByte('!')
|
||||||
|
out.WriteString(nuh.User)
|
||||||
|
}
|
||||||
|
if len(nuh.Host) != 0 {
|
||||||
|
out.WriteByte('@')
|
||||||
|
out.WriteString(nuh.Host)
|
||||||
|
}
|
||||||
|
return out.String()
|
||||||
|
}
|
56
vendor/github.com/ergochat/irc-go/ircutils/userhost.go
generated
vendored
56
vendor/github.com/ergochat/irc-go/ircutils/userhost.go
generated
vendored
@ -1,56 +0,0 @@
|
|||||||
// written by Daniel Oaks <daniel@danieloaks.net>
|
|
||||||
// released under the ISC license
|
|
||||||
|
|
||||||
package ircutils
|
|
||||||
|
|
||||||
import "strings"
|
|
||||||
|
|
||||||
// UserHost holds a username+host combination
|
|
||||||
type UserHost struct {
|
|
||||||
Nick string
|
|
||||||
User string
|
|
||||||
Host string
|
|
||||||
}
|
|
||||||
|
|
||||||
// ParseUserhost takes a userhost string and returns a UserHost instance.
|
|
||||||
func ParseUserhost(userhost string) UserHost {
|
|
||||||
var uh UserHost
|
|
||||||
|
|
||||||
if len(userhost) == 0 {
|
|
||||||
return uh
|
|
||||||
}
|
|
||||||
|
|
||||||
if strings.Contains(userhost, "!") {
|
|
||||||
usersplit := strings.SplitN(userhost, "!", 2)
|
|
||||||
var rest string
|
|
||||||
if len(usersplit) == 2 {
|
|
||||||
uh.Nick = usersplit[0]
|
|
||||||
rest = usersplit[1]
|
|
||||||
} else {
|
|
||||||
rest = usersplit[0]
|
|
||||||
}
|
|
||||||
|
|
||||||
hostsplit := strings.SplitN(rest, "@", 2)
|
|
||||||
if len(hostsplit) == 2 {
|
|
||||||
uh.User = hostsplit[0]
|
|
||||||
uh.Host = hostsplit[1]
|
|
||||||
} else {
|
|
||||||
uh.User = hostsplit[0]
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
hostsplit := strings.SplitN(userhost, "@", 2)
|
|
||||||
if len(hostsplit) == 2 {
|
|
||||||
uh.Nick = hostsplit[0]
|
|
||||||
uh.Host = hostsplit[1]
|
|
||||||
} else {
|
|
||||||
uh.User = hostsplit[0]
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return uh
|
|
||||||
}
|
|
||||||
|
|
||||||
// // Canonical returns the canonical string representation of the userhost.
|
|
||||||
// func (uh *UserHost) Canonical() string {
|
|
||||||
// return ""
|
|
||||||
// }
|
|
2
vendor/modules.txt
vendored
2
vendor/modules.txt
vendored
@ -16,7 +16,7 @@ github.com/ergochat/confusables
|
|||||||
# github.com/ergochat/go-ident v0.0.0-20200511222032-830550b1d775
|
# github.com/ergochat/go-ident v0.0.0-20200511222032-830550b1d775
|
||||||
## explicit
|
## explicit
|
||||||
github.com/ergochat/go-ident
|
github.com/ergochat/go-ident
|
||||||
# github.com/ergochat/irc-go v0.0.0-20210617222258-256f1601d3ce
|
# github.com/ergochat/irc-go v0.1.0
|
||||||
## explicit; go 1.15
|
## explicit; go 1.15
|
||||||
github.com/ergochat/irc-go/ircfmt
|
github.com/ergochat/irc-go/ircfmt
|
||||||
github.com/ergochat/irc-go/ircmsg
|
github.com/ergochat/irc-go/ircmsg
|
||||||
|
Loading…
Reference in New Issue
Block a user