Commit graph xmpp-rs/tokio-xmpp
Author SHA1 Message Date
famfo
d84cb261e4 tokio-xmpp: add StreamFeatures to Online event 2026-05-24 17:07:56 +00:00
famfo
8f03661acb tokio-xmpp: split StanzaStream into Sender and Receiver 2026-05-24 17:07:56 +00:00
Link Mauve
58735d6a70 Bump all outdated dependencies
skip-changelog: This isn’t a user-facing change.
2026-05-21 13:26:08 +02:00
famfo
697d4d3bef
tokio-xmpp: update hickory-dns to 0.26 2026-05-21 13:21:46 +02:00
Jonas Schäfer
e2dcd8ac66 Stop being pedantic by default
Up to now, the xmpp-rs projects have been very strict about incoming
data. This has served us, as developers of the libraries, well,
uncovering bugs in our and remote implementations which we could then
get fixed.

However, this behaviour is unexpected to users of the library. In the
XMPP world, unexpected child elements and attributes are generally
expected to be ignored. While this could be opted-into previously, the
feature flag for that sounded more dangerous than it was
("disable-validation"). In addition, the tribal knowledge needed to know
about that feature flag may not have reached some people who tried the
library and gave up because of that.

With this change, we make the non-pedantic behaviour the default. For
development and debugging purposes, users can always opt into the
pedantic behaviour as needed, using the newly-introduced `pedantic`
feature flags on all affected crates.
2026-03-27 12:51:51 +01:00
Link Mauve
bc88134c41 xmpp-parsers: Make DiscoInfoResult::features a BTreeSet
Features must never be duplicated, so we can use a BTreeSet instead of a
Vec to be nicer for users.

It makes the internal API for computing caps and ecaps2 a bit worse,
because it was expecting a slice directly, so for now let’s collect the
BTreeSet into a Vec when computing the thing.  A refactor to use
Iterator might make it better eventually, but I won’t work on that
before profiling it.
2026-02-21 20:58:33 +01:00
Link Mauve
946d96d7c8 xmpp-parsers: Remove Feature from disco#info
This was just a newtype for a String, but in general using it was harder
than without it.  This simplifies the public API.
2026-02-21 20:19:07 +01:00
Jonas Schäfer
bb02836097 Bump rxml to 0.14.0 2026-02-21 13:56:50 +01:00
Link Mauve
ca6e04f931 xmpp-parsers: Simplify StreamFeatures::sasl_mechanisms
This was already just a wrapper around a Vec<String>, but we can do away
with the wrapper thanks to #[xml(extract)].

I’ve also replaced Vec with BTreeSet, since that corresponds better to
how the mechanisms are.
2026-02-21 11:34:05 +01:00
famfo
628c2113d0 tokio-xmpp: add option to disable xmpp_parsers validation 2026-02-18 16:53:38 +00:00
famfo
4316bb02a5 tokio-xmpp: implicitly add bound_jid on received IQs 2026-02-18 17:33:31 +01:00
Jonas Schäfer
a1ade974b0 stanzastream: actually count stanzas in stream management
Looks like a horrible oversight. And this will need tests, but I'm short
on time right now.

Fixes #170.
2026-02-11 10:10:46 +01:00
Jonas Schäfer
3bda04124e tokio-xmpp: publish auth method 2026-02-11 08:23:29 +01:00
famfo
f7931e95b6 tokio-xmpp: implicitly add bound_jid to IQs 2026-01-27 21:23:51 +00:00
pep
d910cb9944
tokio-xmpp: Update Changelog for AsRawFd
Signed-off-by: pep <pep@bouah.net>
2026-01-25 16:41:57 +01:00
Alexander Brook Perry
b046d36424 tokio-xmpp: gate AsRawFd behind ktls feature
`AsRawFd` was breaking compilation on Windows.

skip-changelog: ktls support hasn't been released yet

Signed-off-by: pep <pep@bouah.net>
2026-01-25 08:21:39 +00:00
pep
77acd92c62 tokio-xmpp: Ignore missing "version" stream attribute for 0114 components
From the prosody@ room:
- 0114 doesn't mention the removal of @version on the stream, and it
  refers to 3920 which has it as a MUST.
- 0114 streams have historically never used @version="1.0"
- @version="1.0" implies stream features which 0114 doesn't have.
- There was a proposal years ago to fix this but a new XEP was preferred
  (0225).

The change here uses a compile-time check, and may have to change when
support for 0225 arrives if it's still gated behind the "component"
feature (even though it may be weird to have both under the same
feature). We'll see when we get there.

Signed-off-by: pep <pep@bouah.net>
2025-11-30 16:21:28 +01:00
Link Mauve
5ed958582b Fix all typos using the typos tool
See https://github.com/crate-ci/typos
2025-11-22 21:48:21 +00:00
pep
0e7ac066d4 tokio-xmpp: Bump to 5.0.0
Signed-off-by: pep <pep@bouah.net>
2025-11-01 17:34:37 +01:00
pep
7a1dde7cfb parsers: Bump to 0.22.0
Signed-off-by: pep <pep@bouah.net>
2025-11-01 17:34:37 +01:00
pep
30b049a7d4 Bump xso to 0.3.0
Signed-off-by: pep <pep@bouah.net>
2025-10-28 13:06:51 +01:00
pep
db0ce5859b tokio-xmpp: Document TlsStream type behind 'ktls' feature
Signed-off-by: pep <pep@bouah.net>
2025-10-21 23:40:00 +02:00
pep
e526b49636 tokio-xmpp: Remove warning when rustls-any-backend feature isn't enabled
Signed-off-by: pep <pep@bouah.net>
2025-10-21 23:40:00 +02:00
lemonsh
468171517a
update changelogs 2025-10-12 22:20:29 +02:00
lemonsh
de564a53b0
use thiserror in tokio-xmpp and minidom 2025-10-12 00:31:48 +02:00
Jonas Schäfer
ccdf27117d Fix docs build with current nightly
skip-changelog, we don't officially support nightly.

See-Also: https://github.com/rust-lang/rfcs/pull/3631
See-Also: https://github.com/rust-lang/rust/pull/138907
2025-10-08 13:03:39 +02:00
Jonas Schäfer
3ffff2614a Bump xso version to 0.2.0 2025-09-17 20:03:18 +02:00
Maxime “pep” Buquet
653a10b170
tokio-xmpp: impl PartialEq on event::Stanza
skip-changelog: Stanza hasn't been in a release yet.

Signed-off-by: Maxime “pep” Buquet <pep@bouah.net>
2025-08-12 15:30:34 +02:00
Saarko
7c87d879d8 parsers: fix text field namespacing in StreamError
skip-changelog
2025-08-07 12:43:21 +00:00
Maxime “pep” Buquet
0ebc3ca04c tokio_xmpp/examples: Use server arg in echo_component
skip-changelog: not yet released? Not so much important anyway

Signed-off-by: Maxime “pep” Buquet <pep@bouah.net>
2025-08-07 12:08:07 +00:00
Maxime “pep” Buquet
9803546795
tokio-xmpp: Re-export xso::error::FromElementError
skip-changelog: code requiring xso hasn't been released yet

Signed-off-by: Maxime “pep” Buquet <pep@bouah.net>
2025-08-07 13:39:34 +02:00
Link Mauve
a58fb7e2f9 tokio-xmpp: Bump rustls-native-certs and webpki-roots
skip-changelog: This is just a dependency bump.
2025-07-28 15:20:01 +02:00
Link Mauve
e70dd957f4 tokio-xmpp: Bump hickory-resolver to 0.25 2025-07-28 14:59:11 +02:00
Link Mauve
c11075d1d4 tokio-xmpp: Bump rand to 0.9 2025-07-28 14:39:48 +02:00
Saarko
e3b167687f tokio-xmpp: remove code duplicates for direct tls and starttls connectors 2025-07-25 18:50:44 +02:00
Saarko
c674c14597 tokio-xmpp/client: add directTLS connection method 2025-07-25 18:50:30 +02:00
Maxime “pep” Buquet
02a70edf99
Fix 'elided lifetime' warning from nightly
Nightly 1.90. The fix passes on stable 1.88.

Signed-off-by: Maxime “pep” Buquet <pep@bouah.net>
2025-07-20 16:01:44 +02:00
Jonas Schäfer
e438813fb2 tokio_xmpp: properly process <stream:error/> while waiting for features
Before this, a stream error would not be readable by user code, as the
`recv_features()` function would not even attempt to parse it. This
change allows application code to react to stream errors which are
received before stream features are received.

skip-changelog, because there's no release with the xmlstream module
yet.
2025-07-13 12:53:43 +02:00
Jonas Schäfer
dc8c3eac4c parsers: port Iq to use the derive macros 2025-05-13 12:01:21 +00:00
Maxime “pep” Buquet
6fe7f92e7d tokio-xmpp: derive Debug on multiple structures
Signed-off-by: Maxime “pep” Buquet <pep@bouah.net>
2025-05-10 22:11:12 +02:00
Jonas Schäfer
e3a4aae42d tokio-xmpp: simplify examples by requiring specific TLS features 2025-05-10 22:02:40 +02:00
Jonas Schäfer
fc8b581593 Clean up tls-related feature flags
This provides a clear and consistent interface for selecting TLS-related
features on both (xmpp and tokio-xmpp) crates. All feature checks have
been revamped. All working combinations have been tested (including a
connectivity test + --all-features docs build) using:

```
set -xeuo pipefail
features=(aws_lc_rs ring ktls,aws_lc_rs ktls,ring aws_lc_rs,ring aws_lc_rs,ring,ktls native-tls rustls-any-backend)
export RUSTFLAGS=" -D warnings"
cargo test --no-default-features
cargo test
for feature in ${features[@]}; do
  echo ">>> BUILDING with $feature" 2>&1
  # Running code or building examples cannot succeed with rustls-any-backend.
  features="starttls,$feature"
  if [ "$feature" != 'rustls-any-backend' ]; then
    if ! cargo test --no-default-features --features="$features"; then
      echo ">>> BUILD FAILED for tls feature set: $features" >&2
      exit 1
    fi
    set +e
    timeout -sINT -p -k 2 3 cargo run --no-default-features --features="$features" --example keep_connection -- test@hub.sotecware.net "$(pass xmpp/test@hub.sotecware.net)"
    status="$?"
    set -e
    if [ $status -ne 0 ]; then
      echo ">>> keep_connection did not shut down cleanly! (status: $status)" >&2
      exit 1
    fi
  else
    if ! cargo build --no-default-features --features="$feature"; then
      echo ">>> BUILD FAILED for tls feature set: $features" >&2
      exit 1
    fi
  fi
done
RUSTDOCFLAGS="--cfg docsrs" RUSTFLAGS="--cfg xmpprs_doc_build" cargo +nightly doc -Zrustdoc-map --all-features
```
2025-05-10 22:02:39 +02:00
Jonas Schäfer
35a30b0486 tokio-xmpp: fix running examples with native-tls
The dev-dependencies of tokio-xmpp accidentally pulled in the rustls
feature by default, causing attempts to run it with native-tls to
fail.
2025-05-10 11:39:21 +02:00
Jonas Schäfer
4e9e18444c Avoid enabling multiple rustls backends by accident
For this, we had to:

- Make the choice(s) of backend explicit in tokio-xmpp features
- Avoid picking a backend through transitive dependencies in xmpp
  (reqwest->hyper->rustls).

In addition, we choose the default rustls backend by default and adapt
the examples so that they can cope with either situation.
2025-05-10 11:39:21 +02:00
Jonas Schäfer
025e09aca6 tokio-xmpp: explicitly set default CryptoProvider in all examples
This way, we don't end up with breakage if rustls is built with more
than one provider enabled. This can (and does) happen if a transitive
dependency (such as reqwest *hinthint*) depends on a specific,
non-default rustls backend.
2025-05-10 11:39:18 +02:00
Jonas Schäfer
78714475b2 tokio-xmpp: re-export rustls if using rustls backend
The user may have to call some global rustls functions depending on the
exact feature set of rustls enabled. Hence, we have to expose it.

Concretely, if the user somehow ends up with more than one rustls
backend, they have to configure one of the backends as default backend
at startup.
2025-05-10 11:09:58 +02:00
Jonas Schäfer
51ce661f8d tokio-xmpp: do not discard XmlLangStack when boxing the stream
The stream may have read some data already (such as the stream
header). When initially writing this code, I had missed that we do
actually also carry the parser state over: I misread the
AsyncReader::wrap(..) command as something like AsyncReader::new, i.e.
starting off with fresh parser state, so I assumed that we need a fresh
XmlLangStack, too.

This is wrong: `p` comes from `self.parser.into_inner()` above and is
the parser state, so we need to carry the lang stack along, as well.

This fixes:

```
thread 'tokio-runtime-worker' panicked at […]/rxml-0.13.1/src/xml_lang.rs:87:13:
pop from empty XmlLangStack
```

happening during stream shutdown. The panic was first reported by
@ppjet6, so thanks for that and the keen eye.

skip-changelog, because the bug has not been released yet.
2025-05-03 17:41:13 +02:00
Jonas Schäfer
cffb5e7e65 xso: make Context use a builder-like pattern
That way, we can (hopefully) add more fields in the future without
breaking stuff.

I don't yet know what such fields could be, though.
2025-04-27 14:08:38 +02:00
Jonas Schäfer
d9a21dd8c9 Track xml:lang throughout parsing 2025-04-22 17:55:44 +02:00
Jonas Schäfer
70d635b0fb Bump rxml to 0.13.1
rxml 0.13.0 changed the quoting style to make it consistent, so we have
to patch up all affected places where we match exact strings.
2025-04-22 17:47:45 +02:00