36 From string `xml:"from,attr"` |
36 From string `xml:"from,attr"` |
37 Id string `xml:"id,attr"` |
37 Id string `xml:"id,attr"` |
38 Lang string `xml:"http://www.w3.org/XML/1998/namespace lang,attr"` |
38 Lang string `xml:"http://www.w3.org/XML/1998/namespace lang,attr"` |
39 Version string `xml:"version,attr"` |
39 Version string `xml:"version,attr"` |
40 } |
40 } |
|
41 |
41 var _ fmt.Stringer = &stream{} |
42 var _ fmt.Stringer = &stream{} |
42 |
43 |
43 // <stream:error> |
44 // <stream:error> |
44 type streamError struct { |
45 type streamError struct { |
45 XMLName xml.Name `xml:"http://etherx.jabber.org/streams error"` |
46 XMLName xml.Name `xml:"http://etherx.jabber.org/streams error"` |
46 Any Generic `xml:",any"` |
47 Any Generic `xml:",any"` |
47 Text *errText |
48 Text *errText |
48 } |
49 } |
49 |
50 |
50 type errText struct { |
51 type errText struct { |
51 XMLName xml.Name `xml:"urn:ietf:params:xml:ns:xmpp-streams text"` |
52 XMLName xml.Name `xml:"urn:ietf:params:xml:ns:xmpp-streams text"` |
52 Lang string `xml:"http://www.w3.org/XML/1998/namespace lang,attr"` |
53 Lang string `xml:"http://www.w3.org/XML/1998/namespace lang,attr"` |
53 Text string `xml:",chardata"` |
54 Text string `xml:",chardata"` |
54 } |
55 } |
55 |
56 |
56 type Features struct { |
57 type Features struct { |
57 Starttls *starttls `xml:"urn:ietf:params:xml:ns:xmpp-tls starttls"` |
58 Starttls *starttls `xml:"urn:ietf:params:xml:ns:xmpp-tls starttls"` |
58 Mechanisms mechs `xml:"urn:ietf:params:xml:ns:xmpp-sasl mechanisms"` |
59 Mechanisms mechs `xml:"urn:ietf:params:xml:ns:xmpp-sasl mechanisms"` |
82 } |
83 } |
83 |
84 |
84 // One of the three core XMPP stanza types: iq, message, presence. See |
85 // One of the three core XMPP stanza types: iq, message, presence. See |
85 // RFC3920, section 9. |
86 // RFC3920, section 9. |
86 type Header struct { |
87 type Header struct { |
87 To string `xml:"to,attr,omitempty"` |
88 To string `xml:"to,attr,omitempty"` |
88 From string `xml:"from,attr,omitempty"` |
89 From string `xml:"from,attr,omitempty"` |
89 Id string `xml:"id,attr,omitempty"` |
90 Id string `xml:"id,attr,omitempty"` |
90 Type string `xml:"type,attr,omitempty"` |
91 Type string `xml:"type,attr,omitempty"` |
91 Lang string `xml:"http://www.w3.org/XML/1998/namespace lang,attr,omitempty"` |
92 Lang string `xml:"http://www.w3.org/XML/1998/namespace lang,attr,omitempty"` |
92 Innerxml string `xml:",innerxml"` |
93 Innerxml string `xml:",innerxml"` |
93 Error *Error |
94 Error *Error |
94 Nested []interface{} |
95 Nested []interface{} |
95 } |
96 } |
96 |
97 |
97 // message stanza |
98 // message stanza |
98 type Message struct { |
99 type Message struct { |
99 XMLName xml.Name `xml:"jabber:client message"` |
100 XMLName xml.Name `xml:"jabber:client message"` |
100 Header |
101 Header |
101 Subject *Generic `xml:"jabber:client subject"` |
102 Subject *Generic `xml:"jabber:client subject"` |
102 Body *Generic `xml:"jabber:client body"` |
103 Body *Generic `xml:"jabber:client body"` |
103 Thread *Generic `xml:"jabber:client thread"` |
104 Thread *Generic `xml:"jabber:client thread"` |
104 } |
105 } |
|
106 |
105 var _ Stanza = &Message{} |
107 var _ Stanza = &Message{} |
106 |
108 |
107 // presence stanza |
109 // presence stanza |
108 type Presence struct { |
110 type Presence struct { |
109 XMLName xml.Name `xml:"presence"` |
111 XMLName xml.Name `xml:"presence"` |
110 Header |
112 Header |
111 Show *Generic `xml:"jabber:client show"` |
113 Show *Generic `xml:"jabber:client show"` |
112 Status *Generic `xml:"jabber:client status"` |
114 Status *Generic `xml:"jabber:client status"` |
113 Priority *Generic `xml:"jabber:client priority"` |
115 Priority *Generic `xml:"jabber:client priority"` |
114 } |
116 } |
|
117 |
115 var _ Stanza = &Presence{} |
118 var _ Stanza = &Presence{} |
116 |
119 |
117 // iq stanza |
120 // iq stanza |
118 type Iq struct { |
121 type Iq struct { |
119 XMLName xml.Name `xml:"iq"` |
122 XMLName xml.Name `xml:"iq"` |
120 Header |
123 Header |
121 } |
124 } |
|
125 |
122 var _ Stanza = &Iq{} |
126 var _ Stanza = &Iq{} |
123 |
127 |
124 // Describes an XMPP stanza error. See RFC 3920, Section 9.3. |
128 // Describes an XMPP stanza error. See RFC 3920, Section 9.3. |
125 type Error struct { |
129 type Error struct { |
126 XMLName xml.Name `xml:"error"` |
130 XMLName xml.Name `xml:"error"` |
127 // The error type attribute. |
131 // The error type attribute. |
128 Type string `xml:"type,attr"` |
132 Type string `xml:"type,attr"` |
129 // Any nested element, if present. |
133 // Any nested element, if present. |
130 Any *Generic |
134 Any *Generic |
131 } |
135 } |
|
136 |
132 var _ error = &Error{} |
137 var _ error = &Error{} |
133 |
138 |
134 // Used for resource binding as a nested element inside <iq/>. |
139 // Used for resource binding as a nested element inside <iq/>. |
135 type bindIq struct { |
140 type bindIq struct { |
136 XMLName xml.Name `xml:"urn:ietf:params:xml:ns:xmpp-bind bind"` |
141 XMLName xml.Name `xml:"urn:ietf:params:xml:ns:xmpp-bind bind"` |