Commit graph

2,428 commits

Author SHA1 Message Date
Maxime “pep” Buquet
6fa9b83c59 README: Update project description
Signed-off-by: Maxime “pep” Buquet <pep@bouah.net>
2025-09-16 21:30:32 +00:00
Maxime “pep” Buquet
99f900558c minidom: Include prefixes in serialization when using Element::from_reader_with_prefixes
Signed-off-by: Maxime “pep” Buquet <pep@bouah.net>
2025-09-16 21:56:24 +02:00
Adrien Destugues
0cf06f0caf xmpp: Allow <confirm/> in message with empty body
skip-changelog: bugfix for previous not yet released change
2025-09-12 14:00:00 +02:00
Link Mauve
9d91b02dfd Revert "xmpp-parsers: Remove optional child from sm element"
This reverts commit 0a1b291574 once again.

This is currently required to connect to Prosody, otherwise the parser
will choke on the extra undocumented child.

I still wonder if required (4e0cd5d96b)
would be useful to support then, as it might also be found in the wild.
2025-09-08 11:37:24 +02:00
Maxime “pep” Buquet
3e794d3f50 xmpp: extend escape-hatch feature to the receiving part
Signed-off-by: Maxime “pep” Buquet <pep@bouah.net>
2025-09-01 17:37:07 +00:00
Maxime “pep” Buquet
fbdd5f7b54 xmpp: document 'escape-hatch' feature
Signed-off-by: Maxime “pep” Buquet <pep@bouah.net>
2025-09-01 17:37:07 +00:00
Maxime “pep” Buquet
b1c80f4071 jid: use "jid" instead of "::jid" in quote support
This causes issues in crates using it because they need to have "jid"
listed as a direct dependency when it's not always obvious (version
mismatch etc. when something already uses jid as a dep)

Signed-off-by: Maxime “pep” Buquet <pep@bouah.net>
2025-09-01 12:38:18 +00:00
PulkoMandy
2c81b6d96f xmpp: Add XEP-0070 authentification support 2025-08-29 11:40:25 +00:00
PulkoMandy
155ad9b670 parsers: Add Confirm from XEP-0070 2025-08-29 11:40:25 +00:00
PulkoMandy
1052aaf010 parsers: fix documentation typo 2025-08-29 11:40:25 +00:00
Link Mauve
0a1b291574 xmpp-parsers: Remove optional child from sm element
When the required child was added and subsequently reverted, it was
noted that optional and required were never defined, and only appeared
in old XEP-0198 examples.  The XEP has been fixed already[1].

This basically reverts 0f0759b207.

[1] https://github.com/xsf/xeps/pull/1447
2025-08-29 12:48:55 +02:00
Maxime “pep” Buquet
621c5882cf
parsers: re-export xso::error::FromElementError
Signed-off-by: Maxime “pep” Buquet <pep@bouah.net>
2025-08-14 15:24:09 +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
Link Mauve
4f270bff7a sasl: Bump getrandom to 0.3
They renamed getrandom::getrandom() to getrandom::fill().
2025-07-28 14:21:58 +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
bdae845b14 xso: relax the feature = "std" requirement for xso::dynxso 2025-07-13 11:10:51 +00:00
Jonas Schäfer
345209bce9 xso: add specialized Xso<dyn Trait> container 2025-07-13 11:10:51 +00:00
Jonas Schäfer
7f5542e8d4 xso: add support for dynamically typed XSOs 2025-07-13 11:10:51 +00:00
Jonas Schäfer
59af49c691 xso-proc: provide FromXml::xml_name_matcher on derived impls
That way, derived implementations can also make use of the performance
benefits.
2025-07-13 11:10:51 +00:00
Jonas Schäfer
126588b47d xso: allow FromXml implementations to provide matching hints
That way, callers can put multiple candidate implementations in, for
example, a sorted vector and more efficiently select candidates to try
when looking at a new element.
2025-07-13 11:10:51 +00:00
Jonas Schäfer
d7b62488dc xso: add type-erased and dyn-compatible variant of AsXml
That way, we don't need to know the specific type of iterator or even
iteree anymore. This can turn out useful when working with `Box<dyn _>`,
that is, in contexts where we don't know the (possible or actual) types
at compile time.
2025-07-13 11:10:51 +00:00
Jonas Schäfer
ee9ffb2d9c xso: make FromEventsBuilder implementations around Box more versatile
By removing the implicit `Sized` bound, they can be used with `dyn _`.
The `Sized` bound is unnecessary for a boxed value, so it is a
superfluous restriction. Also, the use with `dyn _` may turn out useful
in the future when we want to allow type-erased XSOs.
2025-07-13 11:10:51 +00:00
Jonas Schäfer
1262b560e9 Fix parsing of stream errors
skip-changelog, because there's no release with the stream_error module
yet.
2025-07-13 12:53:43 +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
af7e47a791 Add changelog entry for starttls nonzas
They have been added in 54e1a98cd already.
2025-07-09 17:18:31 +02:00
Jonas Schäfer
c229ab0127 Add support for <failure xmlns=starttls/>
Specified in RFC 6120 §5.4.2.2
2025-07-09 17:18:13 +02:00
Maxime “pep” Buquet
dc2477eec3 Revert "xmpp-parsers: Support required in SM feature"
This reverts commit 4e0cd5d96b.
2025-06-03 23:18:10 +02:00
Link Mauve
4e0cd5d96b xmpp-parsers: Support required in SM feature
This was forgotten in 0f0759b207.

That element is only specified in the XML schema, its semantics aren’t
defined anywhere, but we can guess them anyway.
2025-06-03 23:03:13 +02:00
Link Mauve
74f67b9585 xmpp-parsers: Port Jingle MI to use the derive macros
The only missing check is that #[xml(element)] doesn’t support filtering
on elements with a specific name yet.

skip-changelog: This isn’t a user-visible change.
2025-05-19 20:05:14 +02:00
Link Mauve
3920ad3819 xmpp-parsers: Use the new lang meta everywhere
Stop parsing xml:lang manually, instead use the #[xml(lang)] meta which
tracks it using the XML semantics, inheriting it from the most recent
ancestor.

skip-changelog: This isn’t a user-facing change.
2025-05-14 02:09:26 +02:00
Jonas Schäfer
dc8c3eac4c parsers: port Iq to use the derive macros 2025-05-13 12:01:21 +00:00
Jonas Schäfer
8d8a19380a xso-proc: avoid an ambiguous_associated_items error
rustc forbids cases where an enum variant and an associated type of a
trait conflict for a while now [1].

We must thus avoid referring to associated items on types we do not
control in the macros. There was only one case I found, and it was in
the TryFrom implementation, and could be easily resolved by explicitly
spelling out Self::Error.

   [1]: https://github.com/rust-lang/rust/issues/57644
2025-05-13 12:01:21 +00:00
dae6e49cce
Add more documentation
Signed-off-by: Maxime “pep” Buquet <pep@bouah.net>
2025-05-12 02:27:03 +02:00
Maxime “pep” Buquet
5d6759caa1 xmpp: Move single changelog entry to breaking
Signed-off-by: Maxime “pep” Buquet <pep@bouah.net>
2025-05-11 20:25:04 +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
8c7b503f12 xso: reorganise the code a little
The main lib.rs is getting a bit cluttered, so I'm trying to bring some
order into the chaos by moving some things into other modules.

skip-changelog, because there are no user-facing changes (names which
have been moved are doc(inline)'d and pub use'd in the main lib, and
other things (trait implementations) aren't addressable by users).
2025-05-06 07:42:57 +02:00