structs.go
changeset 28 78961db80bae
parent 26 4d0a369079ce
child 31 1dc47df5c99f
equal deleted inserted replaced
27:13bcc96a5a6c 28:78961db80bae
   103 	From string `xml:"attr"`
   103 	From string `xml:"attr"`
   104 	Id string `xml:"attr"`
   104 	Id string `xml:"attr"`
   105 	Type string `xml:"attr"`
   105 	Type string `xml:"attr"`
   106 	Lang string `xml:"attr"`
   106 	Lang string `xml:"attr"`
   107 	Error *Error
   107 	Error *Error
       
   108 	Subject *Generic
       
   109 	Body *Generic
       
   110 	Thread *Generic
   108 	Any *Generic
   111 	Any *Generic
   109 }
   112 }
   110 var _ xml.Marshaler = &Message{}
   113 var _ xml.Marshaler = &Message{}
   111 var _ Stanza = &Message{}
   114 var _ Stanza = &Message{}
   112 
   115 
   116 	From string `xml:"attr"`
   119 	From string `xml:"attr"`
   117 	Id string `xml:"attr"`
   120 	Id string `xml:"attr"`
   118 	Type string `xml:"attr"`
   121 	Type string `xml:"attr"`
   119 	Lang string `xml:"attr"`
   122 	Lang string `xml:"attr"`
   120 	Error *Error
   123 	Error *Error
       
   124 	Show *Generic
       
   125 	Status *Generic
       
   126 	Priority *Generic
   121 	Any *Generic
   127 	Any *Generic
   122 }
   128 }
   123 var _ xml.Marshaler = &Presence{}
   129 var _ xml.Marshaler = &Presence{}
   124 var _ Stanza = &Presence{}
   130 var _ Stanza = &Presence{}
   125 
   131 
   142 	Type string `xml:"attr"`
   148 	Type string `xml:"attr"`
   143 	// Any nested element, if present.
   149 	// Any nested element, if present.
   144 	Any *Generic
   150 	Any *Generic
   145 }
   151 }
   146 var _ xml.Marshaler = &Error{}
   152 var _ xml.Marshaler = &Error{}
       
   153 var _ os.Error = &Error{}
   147 
   154 
   148 // Holds an XML element not described by the more specific types.
   155 // Holds an XML element not described by the more specific types.
   149 type Generic struct {
   156 type Generic struct {
   150 	XMLName xml.Name
   157 	XMLName xml.Name
   151 	Any *Generic
   158 	Any *Generic
   300 	}
   307 	}
   301 	buf.WriteString("</error>")
   308 	buf.WriteString("</error>")
   302 	return buf.Bytes(), nil
   309 	return buf.Bytes(), nil
   303 }
   310 }
   304 
   311 
       
   312 func (er *Error) String() string {
       
   313 	bytes, _ := er.MarshalXML()
       
   314 	return string(bytes)
       
   315 }
       
   316 
   305 func (m *Message) XName() string {
   317 func (m *Message) XName() string {
   306 	return "message"
   318 	return "message"
   307 }
   319 }
   308 
   320 
   309 func (m *Message) XTo() string {
   321 func (m *Message) XTo() string {