ref: 8a516e9e064619dcb3d84499b66e1562546be918 xmpp/stanza/iq_test.go -rw-r--r-- 6.5 KiB
stanza: create stanzas from any start element

Previously stanzas were unmarshaled from the start element using an
xml.Decoder. This is slow and inefficient, and if the name of the stanza
differs an error will be returned. Implementing manual decoding of the
start element should make things faster (though this has not been
verified) and allows the name of the initial start element to be
disregarded. This will not change the name when the stanza typed value
is marshaled back into an XML stream.

Signed-off-by: Sam Whited <sam@samwhited.com>
all: move stanza wrapping to methods

Previously to wrap a payload in a stanza you would use the functions
WrapIQ, WrapMessage, and WrapPresence. Each of these took their
respective stanza types and a payload.
These have been moved to Wrap methods on the various stanza types that
take a payload to make them easier to use in handlers where you already
have the stanza.
The down side is that these methods now exist on types that embed a
stanza, which may be confusing since the payload will be ignored and
only the stanza will be used.

Signed-off-by: Sam Whited <sam@samwhited.com>
stanza: support tokens/stanza conversion

Signed-off-by: Sam Whited <sam@samwhited.com>
stanza: add API for easily replying to IQs

Previously the user had to do the repetative task of switching the
to/from attributes and changing the type.  While this isn't a lot of
extra work, it has to be done every time you want to reply to an IQ.
Instead it makes sense to have an easy way to simply reply to the IQ
without making an explicit copy or modifying it and without having to
jump through extra hoops.
stanza: make the zero value of IQType a "get" IQ
stanza: fix broken IQ type marshaling tests
all: remove unnecessary pointer in WrapIQ
all: update copyright message

[ci skip]
stanza: don't enforce partial IQ semantics
stanza: simplify IQ type
stanza: move stanza functionality into new package
Make all stanza types satisfy fmt.Stringer

Add "IQ" back to the end of the IQ types
Make IQ types unmarshalable (and add tests)
Start stubbing out IQ sending methods