From 9bb4f327693f372458db43f2813c4ba70406a9d7 Mon Sep 17 00:00:00 2001 From: Mickael Remond Date: Fri, 28 Jun 2019 16:41:53 +0200 Subject: [PATCH] Clean up & documentation --- stanza/README.md | 41 ++++++++++++++++++++++++++++++++++++++--- stanza/error.go | 4 ---- 2 files changed, 38 insertions(+), 7 deletions(-) diff --git a/stanza/README.md b/stanza/README.md index 074113d..18127a7 100644 --- a/stanza/README.md +++ b/stanza/README.md @@ -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, diff --git a/stanza/error.go b/stanza/error.go index 0ac857f..bcc947f 100644 --- a/stanza/error.go +++ b/stanza/error.go @@ -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