~samwhited/xmpp

xmpp/xtime d---------
all: add strict namespace checking to mux

Previously anything that had a local name that looked like a stanza
("message", "iq", or "presence") would be treated as such, opening us up
to potential vulnerabilities in servers that allow a
{jabber:server}message on a jabber:client stream but don't treat it as a
stanza, for example.
Being more strict about checking namespaces helps to avoid this issue,
but does require a breaking change to the mux API.

Signed-off-by: Sam Whited <sam@samwhited.com>
all: generate disco features

Signed-off-by: Sam Whited <sam@samwhited.com>
all: update build tags for Go 1.17

See: https://golang.org/issues/41184

Signed-off-by: Sam Whited <sam@samwhited.com>
xtime: minor shuffling around of methods

Signed-off-by: Sam Whited <sam@samwhited.com>
xtime: remove unused type

Signed-off-by: Sam Whited <sam@samwhited.com>
xtime: allow unmarshaling times as XML attributes

Signed-off-by: Sam Whited <sam@samwhited.com>
all: use new UnmarshalIQ methods

See #117

Signed-off-by: Sam Whited <sam@samwhited.com>
xtime: add integration test

Adds a quick integration test against Prosody. The test couldn't be run
against Ejabberd due to a bug. See
https://github.com/processone/ejabberd/issues/3454 for more info.

Signed-off-by: Sam Whited <sam@samwhited.com>
xtime: fix unmarshaling by changing the Time type

Previously unmarshaling was broken because of some pointer/copying
issues. This changes the type to always unmarshal from the correct
element and fixes the round trip test to detect this sort of issue in
the future.

The refactor for this test also fixes the other place where we wanted to
refactor the roundtrip test to use ClientServer.

Fixes #84

Signed-off-by: Sam Whited <sam@samwhited.com>
xtime: minor fix to test failure comment

Previously a test error was copied from the ping package and still
mentioned handling pings.

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>
all: be strict about namespace validation

When decoding stanzas, be more strict about verifying the namespace.
Previously stanzas would have an empty namespace, but the session should
always setup the default namespace correctly now.

Signed-off-by: Sam Whited <sam@samwhited.com>
xtime: add new package

The xtime package contains functionality relating to time including
implementations of XEP-0202: Entity Time and XEP-0082: XMPP Date and
Time Profiles.

Signed-off-by: Sam Whited <sam@samwhited.com>