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>
internal/xmpptest: set default stream namespace Previously test sessions did not have a default namespace. Setting the namespace ensures that IQ and Stanza name checks won't break in the future when we start being more strict about validating namespaces. Signed-off-by: Sam Whited <sam@samwhited.com>
xmpp: fix error reporting unexpected token type Previously the error reporting an unexpected token would always claim that the token was a start token (which is the expected type). Instead, report the unexpected token's type. Signed-off-by: Sam Whited <sam@samwhited.com>
all: mention Go license in readme Signed-off-by: Sam Whited <sam@samwhited.com>
xmpp: remove duplicate helper function The recent updates to attr.Get allow us to use it in place of the getID helper function which returned the value and index of the "id" attribute specifically. Signed-off-by: Sam Whited <sam@samwhited.com>
internal/attr: update Get to return the index Previously only the value was returned, however, if we are trying to conditionally update an attribute it would be helpful to know where in the slice of attributes the result was found. Signed-off-by: Sam Whited <sam@samwhited.com>
all: fix broken link in the readme Signed-off-by: Sam Whited <sam@samwhited.com>
docs: use single directory for documentation Signed-off-by: Sam Whited <sam@samwhited.com>
.builds: add DCO check Using a developer certificate of origin gives us a simple way to ask people to assert that they have the rights to submit their code without requiring cumbersome CLAs. 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>
ping: add ability to easily send and handle pings Signed-off-by: Sam Whited <sam@samwhited.com>
mux: let ServeMux register stanza handlers Previously the multiplexer was too generalized and only handled top level elements. To handle children different types of alternative muxers had to be registered. Instead, move all the functionality for matching against different stanza types into the main muxer and separate the stanza handlers from the generic top level handlers. Fixes #25 Signed-off-by: Sam Whited <sam@samwhited.com>
.builds: error if golint fails Signed-off-by: Sam Whited <sam@samwhited.com>
.builds: validate docs and import comments Signed-off-by: Sam Whited <sam@samwhited.com>
all: add missing canonical import comments 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.
design: add an open question to stanza mux
design: add new stanzamux design proposal The previous iqmux design was incomplete, and ended up being cumbersome in practice. This proposal aims to solve those issues.
mux: add IQ option types that take a func Previously there were only option shortcuts for regular handlers and not for the function adapter. This adds more shortcuts for the function adapter types to make registering handlers with inline functions easier.
mux: add IQ matcher Adding a separate IQ muxer to the mux package will allow us to easily match based on the payload of an IQ without requiring special handling in the standard muxer. See https://mellium.im/design/18_iqmux Fixes #18
mux: return wildcard handlers from Handler method Previously the Handler method would only return a handler if an exact match for the name was found, and would otherwise return the fallback handler. This change moves the logic for selecting wildcard handlers into Handler so that what Handler returns is always what would be selected if an incoming payload matching the name were handed to HandleXMPP.