xmpp/structs.go
changeset 172 36a42bc073f0
parent 171 2f6ae54a2bd1
child 178 ccfebbd9f49b
equal deleted inserted replaced
171:2f6ae54a2bd1 172:36a42bc073f0
    96 
    96 
    97 // message stanza
    97 // message stanza
    98 type Message struct {
    98 type Message struct {
    99 	XMLName xml.Name `xml:"jabber:client message"`
    99 	XMLName xml.Name `xml:"jabber:client message"`
   100 	Header
   100 	Header
   101 	Subject *Generic `xml:"jabber:client subject"`
   101 	Subject []Text   `xml:"jabber:client subject"`
   102 	Body    *Generic `xml:"jabber:client body"`
   102 	Body    []Text   `xml:"jabber:client body"`
   103 	Thread  *Generic `xml:"jabber:client thread"`
   103 	Thread  *Data  `xml:"jabber:client thread"`
   104 }
   104 }
   105 
   105 
   106 var _ Stanza = &Message{}
   106 var _ Stanza = &Message{}
   107 
   107 
   108 // presence stanza
   108 // presence stanza
   109 type Presence struct {
   109 type Presence struct {
   110 	XMLName xml.Name `xml:"presence"`
   110 	XMLName xml.Name `xml:"presence"`
   111 	Header
   111 	Header
   112 	Show     *Generic `xml:"jabber:client show"`
   112 	Show     *Data   `xml:"jabber:client show"`
   113 	Status   *Generic `xml:"jabber:client status"`
   113 	Status   []Text  `xml:"jabber:client status"`
   114 	Priority *Generic `xml:"jabber:client priority"`
   114 	Priority *Data   `xml:"jabber:client priority"`
   115 }
   115 }
   116 
   116 
   117 var _ Stanza = &Presence{}
   117 var _ Stanza = &Presence{}
   118 
   118 
   119 // iq stanza
   119 // iq stanza
   138 // Used for resource binding as a nested element inside <iq/>.
   138 // Used for resource binding as a nested element inside <iq/>.
   139 type bindIq struct {
   139 type bindIq struct {
   140 	XMLName  xml.Name `xml:"urn:ietf:params:xml:ns:xmpp-bind bind"`
   140 	XMLName  xml.Name `xml:"urn:ietf:params:xml:ns:xmpp-bind bind"`
   141 	Resource *string  `xml:"resource"`
   141 	Resource *string  `xml:"resource"`
   142 	Jid      *string  `xml:"jid"`
   142 	Jid      *string  `xml:"jid"`
       
   143 }
       
   144 
       
   145 // Holds human-readable text, with an optional language
       
   146 // specification. Generally multiple instances of these can be found
       
   147 // together, allowing the software to choose which language to present
       
   148 // to the user.
       
   149 type Text struct {
       
   150 	XMLName xml.Name
       
   151 	Lang     string `xml:"http://www.w3.org/XML/1998/namespace lang,attr,omitempty"`
       
   152 	Chardata string `xml:",chardata"`
       
   153 }
       
   154 
       
   155 // Non-human-readable content of some sort, used by the protocol.
       
   156 type Data struct {
       
   157 	XMLName xml.Name
       
   158 	Chardata string `xml:",chardata"`
   143 }
   159 }
   144 
   160 
   145 // Holds an XML element not described by the more specific types.
   161 // Holds an XML element not described by the more specific types.
   146 type Generic struct {
   162 type Generic struct {
   147 	XMLName  xml.Name
   163 	XMLName  xml.Name