Clean up & documentation

This commit is contained in:
Mickael Remond 2019-06-28 16:41:53 +02:00
parent e3c0747cbb
commit 9bb4f32769
No known key found for this signature in database
GPG key ID: E6F6045D79965AA3
2 changed files with 38 additions and 7 deletions

View file

@ -18,7 +18,7 @@ struct that you can build by hand.
Here is for example how you would generate an IQ discovery result:
iqResp := stanza.NewIQ(stanza.Attrs{Type: "result", From: iq.To, To: iq.From, Id: iq.Id, Lang: "en"})
iqResp := stanza.NewIQ(stanza.Attrs{Type: "result", From: iq.To, To: iq.From, Id: iq.Id})
identity := stanza.Identity{
Name: opts.Name,
Category: opts.Category,
@ -52,8 +52,36 @@ Here is for example how you would generate an IQ discovery result using Builder:
### Message
Here is the list of implemented message extensions:
- `Delegation`
- `Markable`
- `MarkAcknowledged`
- `MarkDisplayed`
- `MarkReceived`
- `StateActive`
- `StateComposing`
- `StateGone`
- `StateInactive`
- `StatePaused`
- `HTML`
- `OOB`
- `ReceiptReceived`
- `ReceiptRequest`
- `Mood`
### Presence
Here is the list of implemented presence extensions:
- `MucPresence`
### IQ
IQ (Information Queries) contain a payload associated with the request and possibly an error. The main difference with
@ -62,8 +90,15 @@ having multiple payloads.
Here is the list of structs implementing IQPayloads:
- BindBind
- Pubsub
- `BindBind`
- `ControlSet`
- `ControlSetResponse`
- `Delegation`
- `DiscoInfo`
- `DiscoItems`
- `Pubsub`
- `Version`
- `Node`
Finally, when the payload of the parsed stanza is unknown, the parser will provide the unknown payload as a generic
`Node` element. You can also use the Node struct to add custom information on stanza generation. However, in both cases,

View file

@ -19,10 +19,6 @@ type Err struct {
Text string `xml:"urn:ietf:params:xml:ns:xmpp-stanzas text,omitempty"`
}
func (x *Err) Namespace() string {
return x.XMLName.Space
}
// UnmarshalXML implements custom parsing for XMPP errors
func (x *Err) UnmarshalXML(d *xml.Decoder, start xml.StartElement) error {
x.XMLName = start.Name