summaryrefslogtreecommitdiffstats
path: root/vendor/github.com/lrstanley/girc/event.go
diff options
context:
space:
mode:
authorWim <wim@42.be>2019-01-03 00:07:50 +0100
committerWim <wim@42.be>2019-01-03 00:07:50 +0100
commitd2044c647b2e57ec5d5a7684177cf5e2e3325714 (patch)
treec0cd092f4cb2bb528f455e33d7f989e8f3099b7b /vendor/github.com/lrstanley/girc/event.go
parentc585d00f162cc244b381fcaaef7ac5b1efda2cf5 (diff)
downloadmatterbridge-msglm-d2044c647b2e57ec5d5a7684177cf5e2e3325714.tar.gz
matterbridge-msglm-d2044c647b2e57ec5d5a7684177cf5e2e3325714.tar.bz2
matterbridge-msglm-d2044c647b2e57ec5d5a7684177cf5e2e3325714.zip
Update vendor
* go-telegram-bot-api/telegram-bot-api * lrstanley/girc * matterbridge/gomatrix
Diffstat (limited to 'vendor/github.com/lrstanley/girc/event.go')
-rw-r--r--vendor/github.com/lrstanley/girc/event.go11
1 files changed, 9 insertions, 2 deletions
diff --git a/vendor/github.com/lrstanley/girc/event.go b/vendor/github.com/lrstanley/girc/event.go
index 0b40b40b..69f82148 100644
--- a/vendor/github.com/lrstanley/girc/event.go
+++ b/vendor/github.com/lrstanley/girc/event.go
@@ -516,7 +516,8 @@ const (
// Source represents the sender of an IRC event, see RFC1459 section 2.3.1.
// <servername> | <nick> [ '!' <user> ] [ '@' <host> ]
type Source struct {
- // Name is the nickname, server name, or service name.
+ // Name is the nickname, server name, or service name, in its original
+ // non-rfc1459 form.
Name string `json:"name"`
// Ident is commonly known as the "user".
Ident string `json:"ident"`
@@ -525,6 +526,12 @@ type Source struct {
Host string `json:"host"`
}
+// ID is the nickname, server name, or service name, in it's converted
+// and comparable) form.
+func (s *Source) ID() string {
+ return ToRFC1459(s.Name)
+}
+
// Equals compares two Sources for equality.
func (s *Source) Equals(ss *Source) bool {
if s == nil && ss == nil {
@@ -533,7 +540,7 @@ func (s *Source) Equals(ss *Source) bool {
if s != nil && ss == nil || s == nil && ss != nil {
return false
}
- if s.Name != ss.Name || s.Ident != ss.Ident || s.Host != ss.Host {
+ if s.ID() != ss.ID() || s.Ident != ss.Ident || s.Host != ss.Host {
return false
}
return true