structs.go
changeset 52 9b664fde0ec3
parent 51 1af366d10d32
child 59 be6815a9653a
equal deleted inserted replaced
51:1af366d10d32 52:9b664fde0ec3
   185 		result = result + "/" + jid.Resource
   185 		result = result + "/" + jid.Resource
   186 	}
   186 	}
   187 	return result
   187 	return result
   188 }
   188 }
   189 
   189 
       
   190 // Set implements flag.Value. It returns true if it successfully
       
   191 // parses the string.
   190 func (jid *JID) Set(val string) bool {
   192 func (jid *JID) Set(val string) bool {
   191 	r := regexp.MustCompile("^(([^@/]+)@)?([^@/]+)(/([^@/]+))?$")
   193 	r := regexp.MustCompile("^(([^@/]+)@)?([^@/]+)(/([^@/]+))?$")
   192 	parts := r.FindStringSubmatch(val)
   194 	parts := r.FindStringSubmatch(val)
   193 	if parts == nil {
   195 	if parts == nil {
   194 		return false
   196 		return false