re-add SayInfo() support, for changing tag/share-size on an active connection
This commit is contained in:
parent
92f38b4464
commit
0a8a7a62ce
@ -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
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user