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 useful. 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 LICENSE file. 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 closed. 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 receipts. 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>
roster: fix iter bug in Go 1.13 Sometimes Go 1.13 leaks an io.EOF out of xml.Decoder's even when things worked successfully. Temporarily ignoring this error will allow tests to pass in Go 1.13 and the workaround can be removed when Go 1.15 comes out. For the removal timeline and any updates see: https://mellium.im/issue/29 Signed-off-by: Sam Whited <sam@samwhited.com>
receipts: new Message Delivery Receipts package This patch imlements XEP-0184: Message Delivery Receipts (https://xmpp.org/extensions/xep-0184.html). Signed-off-by: Sam Whited <sam@samwhited.com>
mux: close mux iterator An element iterator used in the muxer was previously unclosed. In this case, the close method will likely always be a noop, but just in case close it so that if we make changes later we don't introduce a lock contention or resource freeing issue. Signed-off-by: Sam Whited <sam@samwhited.com>
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>