~samwhited/xmpp

xmpp/doc.go -rw-r--r-- 7.3 KiB
xmpp: make stream config more flexible

Previously the stream config was a struct and the only thing that could
be changed between stream restarts was the features we advertised.
However, we may want to change other parts of the stream config between
restarts. For example, if we figure out the users JID after the first
step we may want to look them up in the database and set the default
stream language based on their preferences.

To accomplish this we now take a stream config function instead of
taking the struct directly (and the Features field has gone back to
being a slice and is no longer a function itself).
Each time we iterate we update the config by calling the function, which
can look up properties of the session before deciding what config needs
to change.

Fixes #106

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

This doesn't really change much, but I don't think we're going to do all
the various changes proposed right now. The docs are actually pretty
good and I don't see any obvious way to make them more consumable and
readable.

Fixes #144

Signed-off-by: Sam Whited <sam@samwhited.com>
xmpp: add Message and Presence send methods

Signed-off-by: Sam Whited <sam@samwhited.com>
xmpp: fix docs showing old API

The old stanza.WrapPresence function is now a method on the presence
itself (stanza.Presence{}.Wrap()).

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>
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>
all: allow setting session state up front

Previously we could only mark a session as secure or as a
server-to-server connection in the negotiator. However, this left us in
a weird spot where we had two different sources of information and where
the first run of a feature in the default negotiator wouldn't know about
the initial session bits without hacks that made it impossible to
implement the same negotiator outside of the xmpp package.
This provides us with a way to set the session bits before creating the
session or using the negotiator meaning that we can mark a connection as
secure when we pass the connection in and not at some later time. This
also gives us the ability to do partial negotiation and then resume
negotiating later with a different negotiator for some stream
initialization protocols.

Fixes #100

Signed-off-by: Sam Whited <sam@samwhited.com>
all: rework session negotiation functions

Signed-off-by: Sam Whited <sam@samwhited.com>
xmpp: rewrite some docs for new connection APIs

Signed-off-by: Sam Whited <sam@samwhited.com>
xmpp: fix StartTLS usage in docs

Signed-off-by: Sam Whited <sam@samwhited.com>
xmpp: fix function signature mismatch in docs

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>
xmpp: fix missing argument in package level docs
xmpp: fix handler argument types in docs
all: add new API to make writing tokens safe
xmpp, dial: split dialer out into own package
all: add and use new SendIQ API
all: remove unnecessary pointer in WrapPresence

And while we're testing the new API, clean up existing tests.
xmpp: tweak docs about SendElement and IQs
xmpp: minor update to Send example in docs
Next