structs.go
changeset 40 33e7f25f1fd2
parent 38 2839fece923e
child 41 c8c9e6a7e6c9
equal deleted inserted replaced
39:4a06f7ccfa84 40:33e7f25f1fd2
    73 	XMLName xml.Name
    73 	XMLName xml.Name
    74 	Chardata string `xml:"chardata"`
    74 	Chardata string `xml:"chardata"`
    75 	Mechanism string `xml:"attr"`
    75 	Mechanism string `xml:"attr"`
    76 	Any *Generic
    76 	Any *Generic
    77 }
    77 }
       
    78 
       
    79 // BUG(cjyar) Change XTo() to GetTo(), etc.
    78 
    80 
    79 // One of the three core XMPP stanza types: iq, message, presence. See
    81 // One of the three core XMPP stanza types: iq, message, presence. See
    80 // RFC3920, section 9.
    82 // RFC3920, section 9.
    81 type Stanza interface {
    83 type Stanza interface {
    82 	// Returns "iq", "message", or "presence".
    84 	// Returns "iq", "message", or "presence".
   240 	}
   242 	}
   241 	buf.WriteString("</stream:error>")
   243 	buf.WriteString("</stream:error>")
   242 	return buf.Bytes(), nil
   244 	return buf.Bytes(), nil
   243 }
   245 }
   244 
   246 
       
   247 // BUG(cjyar) We can probably eliminate this if we use an
       
   248 // appropriately-tagged XMLName field.
       
   249 
   245 func (e *errText) MarshalXML() ([]byte, os.Error) {
   250 func (e *errText) MarshalXML() ([]byte, os.Error) {
   246 	buf := bytes.NewBuffer(nil)
   251 	buf := bytes.NewBuffer(nil)
   247 	buf.WriteString("<text")
   252 	buf.WriteString("<text")
   248 	writeField(buf, "xmlns", NsStreams)
   253 	writeField(buf, "xmlns", NsStreams)
   249 	writeField(buf, "xml:lang", e.Lang)
   254 	writeField(buf, "xml:lang", e.Lang)
   306 	buf.WriteString(st.XName())
   311 	buf.WriteString(st.XName())
   307 	buf.WriteString(">")
   312 	buf.WriteString(">")
   308 	return buf.Bytes(), nil
   313 	return buf.Bytes(), nil
   309 }
   314 }
   310 
   315 
       
   316 // BUG(cjyar) We can probably eliminate this if we add an XMLName
       
   317 // field with an appropriate tag.
   311 func (er *Error) MarshalXML() ([]byte, os.Error) {
   318 func (er *Error) MarshalXML() ([]byte, os.Error) {
   312 	buf := bytes.NewBuffer(nil)
   319 	buf := bytes.NewBuffer(nil)
   313 	buf.WriteString("<error")
   320 	buf.WriteString("<error")
   314 	writeField(buf, "type", er.Type)
   321 	writeField(buf, "type", er.Type)
   315 	buf.WriteString(">")
   322 	buf.WriteString(">")