~samwhited/xmpp

Release v0.18.0

Signed-off-by: Sam Whited <sam@samwhited.com>
xmpp: strip duplicate XMLNS attributes

This is a temporary workaround for some issues with Go's encoding/xml
package that can cause invalid duplicate xmlns attributes.

See #75

Signed-off-by: Sam Whited <sam@samwhited.com>
xmpp: strip empty "from" attribute from stanzas

This lets empty from attributes be handled the same way as a missing
from attribute so that a default value can be set (if applicable).
This is to work around the "omitempty" tag not being respected for JIDs.

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

This document provides a high-level architectural overview of the
mellium.im/xmpp module. Its target audience is contributors looking to
familiarize themselves with the codebase.

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

Tweak the main docs to better describe the various Send/Encode methods,
mention the important stanza package up front, and fix other minor
issues.

Signed-off-by: Sam Whited <sam@samwhited.com>
jid: remove redundancy in Escape/Unescape docs

Minor tweak to remove some redundant wording in the Escape/Unescape
transformer documentation.

Signed-off-by: Sam Whited <sam@samwhited.com>
xmpp: update docs to point to new chat room

Signed-off-by: Sam Whited <sam@samwhited.com>
xmpp: set to/from on response stream headers

Previously this was being left unset when going from empty to/from to
the JID being set because the previous (empty) origin/location would
continue to be used.

Fixes #107

Signed-off-by: Sam Whited <sam@samwhited.com>
internal/stream: clarify argument name on Send

These are not actually the origin/location JIDs, they are the "to" and
"from" attributes (which may be the origin or the location depending on
whether we are receiving end or the sending end).

Signed-off-by: Sam Whited <sam@samwhited.com>
xmpp: fix broken LocalAddr and RemoteAddr methods

These were deliberately broken by the changes to how we handle to/from
attributes. Fixing them is one of the last things that needs to be done
for handling virtual hosts as well because we can now get the current
local address in the feature negotiation callback from the stream header
and use it to determine what features to offer.

Fixes #105
Updates #61

Signed-off-by: Sam Whited <sam@samwhited.com>
xmpp: validate to and from attributes on streams

Ensure that the to and from attributes on stream restarts don't change
from previous streams to avoid any authentication bypasses where a
client tries to change its from address, for example.

Fixes #102
Updates #105

Signed-off-by: Sam Whited <sam@samwhited.com>
internal/stream: fix missing ID error

Previously the ID said that the initiating entity must set the stream
ID, but the error occured when the receiving entity did not set a stream
ID (which is what is required by RFC 6120 § 4.7.3).

Signed-off-by: Sam Whited <sam@samwhited.com>
internal/xmpptest: use valid stream headers

Previously the stream header was a dummy one that didn't include several
values. However, soon we will validate parts of the stream info meaning
that sessions negotiated with xmpptest will begin to cause failures
since the info was never set properly.

Signed-off-by: Sam Whited <sam@samwhited.com>
all: update negotiator API to handle stream info

Previously we were special casing this in our negotiator implementation,
meaning you couldn't actually implement the negotiator in another
package. This fixes the API so that it could in theory be moved to its
own package (if we could do so and avoid import loops somehow).
This also moves us a step closer to supporting virtual hosts by making
sure the input/output stream info is set before the negotiate call is
made.

See #61

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

This reflects the changes to the session negotiation functions.

Signed-off-by: Sam Whited <sam@samwhited.com>
all: move internal stream info into stream package

This is prep for allowing the neogtiator to return the stream info
between calls to negotiate so that we can set internal session state
from the returned value instead of our negotiator being magic and
modifying internal session state that it normally wouldn't be able to
touch except that it's in the same package.

Signed-off-by: Sam Whited <sam@samwhited.com>
xmpp: don't add from/to to stream headers if empty

Previously an empty from/to attribute would be written, which some
clients appear to treat differently from a missing from/to attribute
despite the fact that they are the same thing in XML land (I think?).

Signed-off-by: Sam Whited <sam@samwhited.com>
all: change stream features to a callback

Previously the stream features were set before the session was
negotiated, meaning that we couldn't send a stream feature only for a
particular JID (eg. based on a server virtual host configuration).
Making them a callback allows for greater flexibility and brings us one
step closer to supporting virtual hosts in a clean way.

See #61

Signed-off-by: Sam Whited <sam@samwhited.com>
stream: rename ErrorNS to NSError

Signed-off-by: Sam Whited <sam@samwhited.com>
xmpp: add DialSession method

This completes the (New|Receive|Dial)(Client|Server)?Session set of
methods for conveniently creating a new session regardless of whether it
is a C2S or S2S session or whether we need to dial a connection first.

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