Compare commits
4 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| b58bed9c3c | |||
| 0a8a7a62ce | |||
| 92f38b4464 | |||
| d7ccbf1cb0 |
1
.hgtags
1
.hgtags
@@ -18,3 +18,4 @@ e7c2c71ef24b386add728fad35fff4a996fccbac v0.9.0
|
||||
3ee0f4ea5142d66079a9500bdcd48a53bdcf362f v0.13.0
|
||||
6422ed687cd308c339b6dc188bbe1034ed93f893 v0.14.0
|
||||
84fb191007017862ffc37af68dcdace5d8c06eee v0.15.0
|
||||
a48811ff2cfe5246c26801cf27da25bf56fec8bb v0.16.0
|
||||
|
||||
@@ -135,7 +135,7 @@ func (this *AdcProtocol) ProcessCommand(msg string) {
|
||||
this.sid = parts[1]
|
||||
|
||||
// State transition IDENTIFY --> VERIFY and send our own info
|
||||
this.hc.SayRaw("BINF " + this.escape(this.sid) + " " + this.ourINFO(true) + "\n")
|
||||
this.SayInfo()
|
||||
this.state = adcStateVerify
|
||||
|
||||
case "IINF":
|
||||
@@ -468,6 +468,10 @@ 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) parts2flags(parts []string) (map[string]string, error) {
|
||||
flags := make(map[string]string, len(parts))
|
||||
for _, flag := range parts {
|
||||
|
||||
@@ -69,6 +69,16 @@ func (this *AutodetectProtocol) SayPrivate(user, message string) {
|
||||
this.realProto.SayPrivate(user, message)
|
||||
}
|
||||
|
||||
func (this *AutodetectProtocol) SayInfo() {
|
||||
this.realProtoMut.Lock()
|
||||
defer this.realProtoMut.Unlock()
|
||||
|
||||
if this.realProto == nil {
|
||||
this.realProto = NewNmdcProtocol(this.hc)
|
||||
}
|
||||
this.realProto.SayInfo()
|
||||
}
|
||||
|
||||
func (this *AutodetectProtocol) ProtoMessageSeparator() string {
|
||||
this.realProtoMut.Lock()
|
||||
defer this.realProtoMut.Unlock()
|
||||
|
||||
@@ -49,6 +49,10 @@ func (this *HubConnection) SayPrivate(recipient string, message string) {
|
||||
this.proto.SayPrivate(recipient, message)
|
||||
}
|
||||
|
||||
func (this *HubConnection) SayInfo() {
|
||||
this.proto.SayInfo()
|
||||
}
|
||||
|
||||
func (this *HubConnection) UserExists(nick string) bool {
|
||||
this.usersMut.RLock()
|
||||
defer this.usersMut.RUnlock()
|
||||
|
||||
@@ -81,7 +81,7 @@ func (this *NmdcProtocol) ProcessCommand(message string) {
|
||||
if commandParts[1] == this.hc.Hco.Self.Nick && !this.sentOurHello {
|
||||
this.hc.SayRaw("$Version 1,0091|")
|
||||
this.hc.SayRaw("$GetNickList|")
|
||||
this.sayInfo()
|
||||
this.SayInfo()
|
||||
this.sentOurHello = true
|
||||
|
||||
} else {
|
||||
@@ -253,7 +253,7 @@ func (this *NmdcProtocol) ProcessCommand(message string) {
|
||||
// Need to log in.
|
||||
// If the hub supports QuickList, we can skip one network roundtrip
|
||||
if _, ok := this.supports["QuickList"]; ok {
|
||||
this.sayInfo()
|
||||
this.SayInfo()
|
||||
this.hc.SayRaw("$GetNickList|")
|
||||
} else {
|
||||
this.hc.SayRaw("$ValidateNick " + this.escape(this.hc.Hco.Self.Nick) + "|")
|
||||
@@ -300,7 +300,7 @@ 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) sayInfo() {
|
||||
func (this *NmdcProtocol) SayInfo() {
|
||||
this.hc.SayRaw(this.getUserMyINFO(this.hc.Hco.Self) + "|")
|
||||
}
|
||||
|
||||
|
||||
@@ -7,6 +7,8 @@ type Protocol interface {
|
||||
|
||||
SayPrivate(user, message string)
|
||||
|
||||
SayInfo()
|
||||
|
||||
ProtoMessageSeparator() string
|
||||
}
|
||||
|
||||
|
||||
@@ -21,6 +21,9 @@ This package can be installed via go get: `go get code.ivysaur.me/libnmdc`
|
||||
|
||||
=CHANGELOG=
|
||||
|
||||
2018-03-24 0.17
|
||||
- Feature: Re-add sayInfo() function for reannouncing MyINFO changes
|
||||
|
||||
2017-11-26 0.16
|
||||
- Feature: Support connecting to ADC hubs
|
||||
- BREAKING: Simplify connection API
|
||||
|
||||
@@ -8,7 +8,7 @@ import (
|
||||
|
||||
const (
|
||||
DEFAULT_CLIENT_TAG string = "libnmdc.go"
|
||||
DEFAULT_CLIENT_VERSION string = "0.16"
|
||||
DEFAULT_CLIENT_VERSION string = "0.17"
|
||||
DEFAULT_HUB_NAME string = "(unknown)"
|
||||
SEND_KEEPALIVE_EVERY time.Duration = 29 * time.Second
|
||||
AUTO_RECONNECT_AFTER time.Duration = 30 * time.Second
|
||||
|
||||
Reference in New Issue
Block a user