From e2836b638895aa5a74e9fd65240e6a7c38f97724 Mon Sep 17 00:00:00 2001 From: mappu Date: Mon, 4 Jun 2018 16:39:08 +1200 Subject: [PATCH] vendor: update libnmdc to master (post-0.17.0) --- Gopkg.lock | 6 +++--- Gopkg.toml | 2 +- vendor/code.ivysaur.me/libnmdc/.hgtags | 1 + vendor/code.ivysaur.me/libnmdc/AdcProtocol.go | 19 +++++++++-------- .../libnmdc/AutodetectProtocol.go | 12 +++++------ .../code.ivysaur.me/libnmdc/HubConnection.go | 21 +++++++++++++------ .../code.ivysaur.me/libnmdc/NmdcProtocol.go | 12 +++++------ vendor/code.ivysaur.me/libnmdc/Protocol.go | 6 +++--- vendor/code.ivysaur.me/libnmdc/libnmdc.go | 2 +- 9 files changed, 46 insertions(+), 35 deletions(-) diff --git a/Gopkg.lock b/Gopkg.lock index 7f39efa..7651a62 100644 --- a/Gopkg.lock +++ b/Gopkg.lock @@ -2,10 +2,10 @@ [[projects]] + branch = "master" name = "code.ivysaur.me/libnmdc" packages = ["."] - revision = "b58bed9c3c4612abb2b1d67c7bc25863c5ceef28" - version = "v0.17.0" + revision = "9eddfc6e586fd4a99bdc87d32bade0cd1a5a33e6" [[projects]] branch = "master" @@ -28,6 +28,6 @@ [solve-meta] analyzer-name = "dep" analyzer-version = 1 - inputs-digest = "75039ebfc2a88d68b24c32495279190af07226639cdd9acf711588a292e97f51" + inputs-digest = "f42caa97e6521c92eb941027b3691e537030b092fbbb8712c220c6edd92e16b3" solver-name = "gps-cdcl" solver-version = 1 diff --git a/Gopkg.toml b/Gopkg.toml index 13c491c..d4c612d 100644 --- a/Gopkg.toml +++ b/Gopkg.toml @@ -27,4 +27,4 @@ [[constraint]] name = "code.ivysaur.me/libnmdc" - version = "0.17.0" + branch = "master" diff --git a/vendor/code.ivysaur.me/libnmdc/.hgtags b/vendor/code.ivysaur.me/libnmdc/.hgtags index 48a284e..a690ff7 100644 --- a/vendor/code.ivysaur.me/libnmdc/.hgtags +++ b/vendor/code.ivysaur.me/libnmdc/.hgtags @@ -19,3 +19,4 @@ e7c2c71ef24b386add728fad35fff4a996fccbac v0.9.0 6422ed687cd308c339b6dc188bbe1034ed93f893 v0.14.0 84fb191007017862ffc37af68dcdace5d8c06eee v0.15.0 a48811ff2cfe5246c26801cf27da25bf56fec8bb v0.16.0 +800d6c41581571460f26f46b71525306116e8066 v0.17.0 diff --git a/vendor/code.ivysaur.me/libnmdc/AdcProtocol.go b/vendor/code.ivysaur.me/libnmdc/AdcProtocol.go index d423ee8..19b3f69 100644 --- a/vendor/code.ivysaur.me/libnmdc/AdcProtocol.go +++ b/vendor/code.ivysaur.me/libnmdc/AdcProtocol.go @@ -468,8 +468,8 @@ func (this *AdcProtocol) ourINFO(includePid bool) string { return ret[1:] } -func (this *AdcProtocol) SayInfo() { - this.hc.SayRaw("BINF " + this.escape(this.sid) + " " + this.ourINFO(true) + "\n") +func (this *AdcProtocol) SayInfo() error { + return this.hc.SayRaw("BINF " + this.escape(this.sid) + " " + this.ourINFO(true) + "\n") } func (this *AdcProtocol) parts2flags(parts []string) (map[string]string, error) { @@ -614,16 +614,17 @@ func (this *AdcProtocol) unescape(encoded string) string { return strings.Replace(v2, `\\`, `\`, -1) } -func (this *AdcProtocol) SayPublic(msg string) { - this.hc.SayRaw("BMSG " + this.sid + " " + this.escape(msg) + "\n") +func (this *AdcProtocol) SayPublic(msg string) error { + return this.hc.SayRaw("BMSG " + this.sid + " " + this.escape(msg) + "\n") } -func (this *AdcProtocol) SayPrivate(user, message string) { - if sid, ok := this.Nick2SID(user); ok { - this.hc.SayRaw("DMSG " + this.sid + " " + sid + " " + this.escape(message) + "\n") - } else { - this.logError(fmt.Errorf("Unknown user '%s'", user)) +func (this *AdcProtocol) SayPrivate(user, message string) error { + sid, ok := this.Nick2SID(user) + if !ok { + return fmt.Errorf("Unknown user '%s'", user) } + + return this.hc.SayRaw("DMSG " + this.sid + " " + sid + " " + this.escape(message) + "\n") } func (this *AdcProtocol) ProtoMessageSeparator() string { diff --git a/vendor/code.ivysaur.me/libnmdc/AutodetectProtocol.go b/vendor/code.ivysaur.me/libnmdc/AutodetectProtocol.go index 3c188f6..0b9c372 100644 --- a/vendor/code.ivysaur.me/libnmdc/AutodetectProtocol.go +++ b/vendor/code.ivysaur.me/libnmdc/AutodetectProtocol.go @@ -49,34 +49,34 @@ func (this *AutodetectProtocol) ProcessCommand(msg string) { this.realProto.ProcessCommand(msg) } -func (this *AutodetectProtocol) SayPublic(msg string) { +func (this *AutodetectProtocol) SayPublic(msg string) error { this.realProtoMut.Lock() defer this.realProtoMut.Unlock() if this.realProto == nil { this.realProto = NewNmdcProtocol(this.hc) } - this.realProto.SayPublic(msg) + return this.realProto.SayPublic(msg) } -func (this *AutodetectProtocol) SayPrivate(user, message string) { +func (this *AutodetectProtocol) SayPrivate(user, message string) error { this.realProtoMut.Lock() defer this.realProtoMut.Unlock() if this.realProto == nil { this.realProto = NewNmdcProtocol(this.hc) } - this.realProto.SayPrivate(user, message) + return this.realProto.SayPrivate(user, message) } -func (this *AutodetectProtocol) SayInfo() { +func (this *AutodetectProtocol) SayInfo() error { this.realProtoMut.Lock() defer this.realProtoMut.Unlock() if this.realProto == nil { this.realProto = NewNmdcProtocol(this.hc) } - this.realProto.SayInfo() + return this.realProto.SayInfo() } func (this *AutodetectProtocol) ProtoMessageSeparator() string { diff --git a/vendor/code.ivysaur.me/libnmdc/HubConnection.go b/vendor/code.ivysaur.me/libnmdc/HubConnection.go index e1dd29a..a58cce7 100644 --- a/vendor/code.ivysaur.me/libnmdc/HubConnection.go +++ b/vendor/code.ivysaur.me/libnmdc/HubConnection.go @@ -41,16 +41,25 @@ func (this *HubConnection) Users(cb func(*map[string]UserInfo) error) error { return cb(&this.users) } -func (this *HubConnection) SayPublic(message string) { - this.proto.SayPublic(message) +func (this *HubConnection) SayPublic(message string) error { + if this.proto == nil { + return ErrNotConnected + } + return this.proto.SayPublic(message) } -func (this *HubConnection) SayPrivate(recipient string, message string) { - this.proto.SayPrivate(recipient, message) +func (this *HubConnection) SayPrivate(recipient string, message string) error { + if this.proto == nil { + return ErrNotConnected + } + return this.proto.SayPrivate(recipient, message) } -func (this *HubConnection) SayInfo() { - this.proto.SayInfo() +func (this *HubConnection) SayInfo() error { + if this.proto == nil { + return ErrNotConnected + } + return this.proto.SayInfo() } func (this *HubConnection) UserExists(nick string) bool { diff --git a/vendor/code.ivysaur.me/libnmdc/NmdcProtocol.go b/vendor/code.ivysaur.me/libnmdc/NmdcProtocol.go index 1e708cb..149be59 100644 --- a/vendor/code.ivysaur.me/libnmdc/NmdcProtocol.go +++ b/vendor/code.ivysaur.me/libnmdc/NmdcProtocol.go @@ -292,16 +292,16 @@ func (this *NmdcProtocol) unescape(encoded string) string { return strings.Replace(v2, "&", "&", -1) } -func (this *NmdcProtocol) SayPublic(message string) { - this.hc.SayRaw("<" + this.hc.Hco.Self.Nick + "> " + this.escape(message) + "|") +func (this *NmdcProtocol) SayPublic(message string) error { + return this.hc.SayRaw("<" + this.hc.Hco.Self.Nick + "> " + this.escape(message) + "|") } -func (this *NmdcProtocol) SayPrivate(recipient, message string) { - this.hc.SayRaw("$To: " + recipient + " From: " + this.hc.Hco.Self.Nick + " $<" + this.hc.Hco.Self.Nick + "> " + this.escape(message) + "|") +func (this *NmdcProtocol) SayPrivate(recipient, message string) error { + return this.hc.SayRaw("$To: " + recipient + " From: " + this.hc.Hco.Self.Nick + " $<" + this.hc.Hco.Self.Nick + "> " + this.escape(message) + "|") } -func (this *NmdcProtocol) SayInfo() { - this.hc.SayRaw(this.getUserMyINFO(this.hc.Hco.Self) + "|") +func (this *NmdcProtocol) SayInfo() error { + return this.hc.SayRaw(this.getUserMyINFO(this.hc.Hco.Self) + "|") } func (this *NmdcProtocol) parseMyINFO(protomsg string) (*UserInfo, error) { diff --git a/vendor/code.ivysaur.me/libnmdc/Protocol.go b/vendor/code.ivysaur.me/libnmdc/Protocol.go index 416c398..0e93217 100644 --- a/vendor/code.ivysaur.me/libnmdc/Protocol.go +++ b/vendor/code.ivysaur.me/libnmdc/Protocol.go @@ -3,11 +3,11 @@ package libnmdc type Protocol interface { ProcessCommand(msg string) - SayPublic(string) + SayPublic(string) error - SayPrivate(user, message string) + SayPrivate(user, message string) error - SayInfo() + SayInfo() error ProtoMessageSeparator() string } diff --git a/vendor/code.ivysaur.me/libnmdc/libnmdc.go b/vendor/code.ivysaur.me/libnmdc/libnmdc.go index 4566eb6..4458a57 100644 --- a/vendor/code.ivysaur.me/libnmdc/libnmdc.go +++ b/vendor/code.ivysaur.me/libnmdc/libnmdc.go @@ -8,7 +8,7 @@ import ( const ( DEFAULT_CLIENT_TAG string = "libnmdc.go" - DEFAULT_CLIENT_VERSION string = "0.17" + DEFAULT_CLIENT_VERSION string = "0.18" DEFAULT_HUB_NAME string = "(unknown)" SEND_KEEPALIVE_EVERY time.Duration = 29 * time.Second AUTO_RECONNECT_AFTER time.Duration = 30 * time.Second