xmpp: move SASL tests to xmpp_test package

I prefer to keep tests in a separate package from the main code where
possible to ensure that the public API is what ends up being tested.
This makes it less likely that tests only test small internal pieces and
not the behavior of the package as a whole.

Signed-off-by: Sam Whited <sam@samwhited.com>
docs: add Stripe username to FUNDING.yml

Signed-off-by: Sam Whited <sam@samwhited.com>
roster: fix panic when closing errored roster iter

When requesting the roster we create an iterator. If an error occurs, we
defer reporting the error until the iterator is used and the internal
xmlstream.Iter that it holds will be nil. Unfortunately, this caused a
panic if we defer a call to iter.Close. Closing a nil iterator is a noop
and is expected behavior, so don't report an error and don't panic in
this case.

Signed-off-by: Sam Whited <sam@samwhited.com>
design: create a formal proposal process

As I design more packages and features, I often find it helps to write
down what I think the solutions will be before actually implementing
them. Formalizing this process for others will give me a place to point
people if I have to ask them to write a design document.

Fixes #44

Signed-off-by: Sam Whited <sam@samwhited.com>
design: adds a design doc for integration testing

See #42

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

The Makefile was mostly PHONY rules that weren't very useful and it
rarely got updated. Just get rid of it until such a time as it's more

Signed-off-by: Sam Whited <sam@samwhited.com>
docs: fix broken links in contributing

The getting started issues label was incorrect as was the path to the

Signed-off-by: Sam Whited <sam@samwhited.com>
.builds: revert back to using FreeBSD for CI

This reverts commit 4630c5058e9a4abbbd0c120bdb7daa23fd736dd4.

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

Building the examples causes the xmlstream dependency to bump, so go
ahead and update their go.{mod,sum} files.

Signed-off-by: Sam Whited <sam@samwhited.com>
all: update BUG comments

Remove inaccurate BUG comments and update existing ones to contain a
link to their relavant issue so that they get removed if the issue is

Signed-off-by: Sam Whited <sam@samwhited.com>
internal/marshal: add TokenReader API

While thinking about whether or not it would be difficult to add
EncodeIQ and EncodeIQElement methods to Session I realized that I
wouldn't be able to implement them in terms of SendIQ and SendIQ element
because these use a token reader based API as opposed to the token
writer based API used by the functions in Marshal. However, internally
the marshal functions create a token reader and then copy from it into
the writer, so by exposing this functionality we can make it possible to
create reader or writer based functionality with the marshal package.

Signed-off-by: Sam Whited <sam@samwhited.com>
all: add missing copyright notices

Signed-off-by: Sam Whited <sam@samwhited.com>
all: use xmlstream.Iter and remove internal/iter

The internal/iter package previously contained an API for iterating over
child elements and decoding them lazily.

This is needed by any package that exposes an iterator such as the
roster package, and is mentioned in the documentation
(https://mellium.im/docs/extensions) as the API to use when creating
your own extensions, but it was internal and not actually usable by this
package. Its own doc comment said that it would eventually be exported
when the API stabalized. It hasn't been necessary to change the API
since creating it so it became time to let it graduate to the
mellium.im/xmlstream module where it can be more broadly useful.

This patch bumps the version of xmlstream used and makes the minor
changes necessary to use the xmlstream version of the iterator. It also
removes the old internal/iter package and updates the documentation to
mention its new location as part of xmlstream.

They grow up so fast!

Signed-off-by: Sam Whited <sam@samwhited.com>
docs: add issue templates

Adding issue templates will help guide users to submitting good bug
reports and feature requests that can be actioned without pestering the
OP for more information.

Signed-off-by: Sam Whited <sam@samwhited.com>
all: improve documentation about multiplexers

I noticed that the main package already contained documentation about
the Serve function and writing a handler, but did not mention the mux
package or its more granular handler types.
Similarly, the mux package itself didn't have much in the way of
description and one would be forgiven for thinking that you couldn't
write your own, compatible, muxer.

Improving this documentation will go a long way towards making it easier
to get started with this library.

Signed-off-by: Sam Whited <sam@samwhited.com>
receipts: fix broken doc comment

Fix some copy/pasta from the xtime package that had leaked into

Signed-off-by: Sam Whited <sam@samwhited.com>
all: prepare release v0.16.0

Signed-off-by: Sam Whited <sam@samwhited.com>
receipts: limit the amount of locking required

Limiting the amount of output stream locking required to just the actual
sending of the element means we don't have to block the entire output
stream while we wait for a response, which will likely lead to deadlock.

Signed-off-by: Sam Whited <sam@samwhited.com>
xmpp: use entire payload in SendElement

Previously Session.SendElement would only wrap the first element
encountered in the token stream and transmit it. However, you would
expect it to wrap the entire stream (even if it were multiple elements)
in the provided start element.

Signed-off-by: Sam Whited <sam@samwhited.com>
receipts: fix resource leak

Previously messages weren't removed from being tracked by the handler
after they were acked or after the context was canceled. This patch
makes sure they are removed, and adds a regression test to double check
that they're removed on context cancelation.

Signed-off-by: Sam Whited <sam@samwhited.com>
.builds: change CI to use OpenBSD temporarily

The FreeBSD image on SourceHut is broken and they have indicated that
they intend to wait for FreeBSD to issue a release instead of working
around the issue themselves. For now, change the builder to OpenBSD.

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