xmpp/structs.go
changeset 179 4477c9f31f43
parent 178 ccfebbd9f49b
child 180 3010996c1928
equal deleted inserted replaced
178:ccfebbd9f49b 179:4477c9f31f43
   179 	slash := strings.LastIndex(string(j), "/")
   179 	slash := strings.LastIndex(string(j), "/")
   180 	if slash == -1 {
   180 	if slash == -1 {
   181 		return ""
   181 		return ""
   182 	}
   182 	}
   183 	return string(j[slash+1:])
   183 	return string(j[slash+1:])
       
   184 }
       
   185 
       
   186 // Returns the bare JID, which is the JID without the resource part.
       
   187 func (j JID) Bare() JID {
       
   188 	node := j.Node()
       
   189 	if node == "" {
       
   190 		return JID(j.Domain())
       
   191 	}
       
   192 	return JID(fmt.Sprintf("%s@%s", node, j.Domain()))
   184 }
   193 }
   185 
   194 
   186 func (s *stream) String() string {
   195 func (s *stream) String() string {
   187 	var buf bytes.Buffer
   196 	var buf bytes.Buffer
   188 	buf.WriteString(`<stream:stream xmlns="`)
   197 	buf.WriteString(`<stream:stream xmlns="`)