Commit graph xmpp-rs/xmpp/src
Author SHA1 Message Date
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
pep
65c3e0dee7 xmpp: Remove noisy debug logs
skip-changelog

Signed-off-by: pep <pep@bouah.net>
2026-01-27 21:30:14 +00:00
pep
cff9195d6e
xmpp: Only send RoomSubject with empty body
Signed-off-by: pep <pep@bouah.net>
2026-01-27 22:04:33 +01:00
pep
22292c86cc
xmpp: Replace unimplemented! and panic! with info! calls
It's great for debugging for fast-paced implementations but the codebase
has been more or less the same for years now (in a state we don't
exactly like, but it is what it is) and this is hindering things more
than helping.

Keep it at the INFO level nonetheless to make it more or less obvious
these things are not implemented.

Signed-off-by: pep <pep@bouah.net>
2026-01-15 13:19:42 +01:00
pep
a2ed5026f0 xmpp: Allow resyncs in Agent::join_room
Signed-off-by: pep <pep@bouah.net>
2026-01-04 23:33:08 +01:00
pep
e22daa91f1 xmpp: make Agent.config accessible only via getter
It may not matter much for the moment as this struct shouldn't change
very much during the life of the client, but this prevents the lock from
being held too long.

Signed-off-by: pep <pep@bouah.net>
2025-11-30 16:36:58 +01:00
pep
a1a31ce11c xmpp: Merge Agent configuration into new Config struct
Signed-off-by: pep <pep@bouah.net>
2025-11-30 16:36:58 +01:00
pep
147b79ca52 xmpp: new Config struct for Agent, with bookmarks_autojoin for now
Signed-off-by: pep <pep@bouah.net>
2025-11-30 16:36:58 +01:00
pep
e503f016a3 xmpp: update to edition 2024
Signed-off-by: pep <pep@bouah.net>
2025-11-13 22:41:05 +01: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
Maxime “pep” Buquet
03c7310990 xmpp: Stop proxying tokio-xmpp event in escape-hatch, add our own variants
This was causing issues with Clone-ing tokio-xmpp Event-s as they
include Error-s which are typically not Clone-able. Event and Stanza
aren't Clone-able either so might as well do our own stuff here.

Signed-off-by: Maxime “pep” Buquet <pep@bouah.net>
2025-09-16 22:57:17 +00: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
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
PulkoMandy
2c81b6d96f xmpp: Add XEP-0070 authentification support 2025-08-29 11:40:25 +00:00
Jonas Schäfer
dc8c3eac4c parsers: port Iq to use the derive macros 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
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
Maxime “pep” Buquet
4346e4b940 xmpp::muc::room: reverse check for rooms_joined
skip-changelog, fixes bug introduced in the same release

Signed-off-by: Maxime “pep” Buquet <pep@bouah.net>
2025-04-27 16:28:02 +02:00
Maxime “pep” Buquet
477af3c895 xmpp: new 'escape-hatch' feature
Signed-off-by: Maxime “pep” Buquet <pep@bouah.net>
2025-04-20 13:41:56 +00:00
Jonas Schäfer
5172fb5e0f parsers: port Message to use the derive macros 2025-04-18 12:56:03 +02:00
Maxime “pep” Buquet
4780f89604 xmpp: new Agent::new method
Signed-off-by: Maxime “pep” Buquet <pep@bouah.net>
2025-04-07 18:26:27 +00:00
Link Mauve
5ae38545e4 xmpp: Shorten the default caps node to our main domain
We do own xmpp.rs, so let’s use that instead of gitlab.com.
2025-04-07 11:57:01 +02:00
Emmanuel Gil Peyrot
fa61f421bb xmpp-parsers: Use xso for pubsub events
Also split the PubSubEvent enum into Event and Payload.
2025-01-27 15:07:59 +01:00
Emmanuel Gil Peyrot
543d9eb590 xmpp-parsers: Convert http_upload::Header to xso
We can’t use generate_attribute!() for HeaderName because it has to be
case insensitive.
2025-01-27 14:45:17 +01:00
Emmanuel Gil Peyrot
f63b780089 xmpp-parsers: Simplify PubSub Item using xso
Now that we can have a single arbitrary payload, we can derive FromXml
and AsXml on the Item.
2025-01-26 16:40:05 +00:00
33098e6f2c Message and message_correct::Replace now has typed Id 2024-12-30 20:50:43 +00:00
bfac3e8893 xmpp: Receive message corrections, unchecked 2024-12-20 15:48:47 +00:00
Maxime “pep” Buquet
2e66f848f6
xmpp: Remove noisy info log
Signed-off-by: Maxime “pep” Buquet <pep@bouah.net>
2024-12-20 14:23:38 +01:00
668cc05445 xmpp: Replace std stuff with alloc/core stuff 2024-12-19 20:39:18 +01:00
c1a3c85556 xmpp: Implement Deref<Target=ResourcePart> for RoomNick 2024-12-18 21:55:03 +01:00
793b76d0d5 xmpp: More nicks are typed as RoomNick 2024-12-18 21:55:01 +01:00
48cb79b2d1 xmpp: Implement FromStr for RoomNick 2024-12-18 21:26:30 +01:00
b8f74e6bce xmpp: Common structure for imports 2024-12-18 19:26:40 +01:00
0ec9103b28 xmpp: Rewrite other messages with Agent::send_raw_message 2024-12-18 19:18:34 +01:00
b4d3252da4 xmpp: Add Agent::send_raw_message 2024-12-18 19:18:22 +01:00
e19a7988ed xmpp: Agent::send_message is only for normal messages 2024-12-18 19:17:55 +01:00
d98ed615a5 xmpp: Agent::send_room_private_message takes RoomPrivateMessageSettings 2024-12-18 19:17:39 +01:00
7991cef904 Add tests for crate exports ; add structure to imports/exports 2024-12-18 18:03:18 +00:00
3fd8285a29 xmpp: RoomNick is newtype wrapper for ResourcePart 2024-12-18 15:43:09 +00:00
5477cf1240 xmpp: Use ResourcePart for sender of room events 2024-12-18 15:43:09 +00:00
c16456f381 parsers/xmpp: MUC bookmarks have nickname typed as ResourcePart 2024-12-18 15:43:09 +00:00
Jonas Schäfer
35ce86243f client: use stanzastream! 2024-12-17 18:16:02 +01:00
8c3c8c7c97 hello_bot accepts a list of room JIDs to join to say hello 2024-12-17 00:27:50 +00:00
fdec34afde Add JoinRoomSettings, LeaveRoomSettings, and RoomMessageSettings 2024-12-17 00:27:50 +00:00
6d7a95b6ca Remove xmpp::Event::{JoinRoom,LeaveRoom,LeaveAllRooms} 2024-12-16 22:36:25 +01:00
Emmanuel Gil Peyrot
011585594f xmpp: Adapt to xmpp-parsers changes wrt autojoin
This attribute is now a simple bool instead of an enum.
2024-12-16 13:32:49 +00:00
Jonas Schäfer
4cfe4f8429 xmlstream: implement simple timeout logic
This allows to detect and handle dying streams without getting stuck
forever.

Timeouts are always wrong, though, so we put the burden of choosing the
right values (mostly) on the creator of a stream.
2024-09-01 10:02:36 +02:00
Jonas Schäfer
ab10e30ac0 Port crates to use new XSO-based xmlstream 2024-08-29 16:47:13 +02:00