fix parsing connection modes in MyINFO

This commit is contained in:
mappu 2016-11-29 19:23:00 +13:00
parent 7e249acd6c
commit d373e9791a

View File

@ -71,7 +71,7 @@ var rx_myinfo *regexp.Regexp
var rx_myinfo_notag *regexp.Regexp var rx_myinfo_notag *regexp.Regexp
func init() { func init() {
// $ALL <nick> <description>$ $<connection><flag>$<e-mail>$<sharesize>$ // Format: $ALL <nick> <description>$ $<connection><flag>$<e-mail>$<sharesize>$
HEAD := `(?ms)^\$ALL ([^ ]+) ` HEAD := `(?ms)^\$ALL ([^ ]+) `
FOOT := `\$.\$([^$]+)\$([^$]*)\$([0-9]*)\$$` FOOT := `\$.\$([^$]+)\$([^$]*)\$([0-9]*)\$$`
@ -106,7 +106,7 @@ func (this *UserInfo) fromMyINFO(protomsg string) error {
this.Description = NMDCUnescape(matches[2]) this.Description = NMDCUnescape(matches[2])
this.ClientTag = NMDCUnescape(matches[3]) this.ClientTag = NMDCUnescape(matches[3])
this.ClientVersion = matches[4] this.ClientVersion = matches[4]
this.ConnectionMode = ConnectionMode(matches[4][0]) this.ConnectionMode = ConnectionMode(matches[5][0])
maybeParse(matches[6], &this.HubsUnregistered, 0) maybeParse(matches[6], &this.HubsUnregistered, 0)
maybeParse(matches[7], &this.HubsRegistered, 0) maybeParse(matches[7], &this.HubsRegistered, 0)
maybeParse(matches[8], &this.HubsOperator, 0) maybeParse(matches[8], &this.HubsOperator, 0)