Commit graph

2249 commits

Author SHA1 Message Date
xmppftw
50425617b5 parsers: Add Message::extract_valid_payload helper 2024-12-19 17:36:10 +01:00
xmppftw
c1a3c85556 xmpp: Implement Deref<Target=ResourcePart> for RoomNick 2024-12-18 21:55:03 +01:00
xmppftw
793b76d0d5 xmpp: More nicks are typed as RoomNick 2024-12-18 21:55:01 +01:00
xmppftw
48cb79b2d1 xmpp: Implement FromStr for RoomNick 2024-12-18 21:26:30 +01:00
Emmanuel Gil Peyrot
f8347165fd tokio-xmpp: Add forgotten ChangeLog entry for ktls support 2024-12-18 18:33:42 +00:00
xmppftw
b8f74e6bce xmpp: Common structure for imports 2024-12-18 19:26:40 +01:00
xmppftw
0ec9103b28 xmpp: Rewrite other messages with Agent::send_raw_message 2024-12-18 19:18:34 +01:00
xmppftw
b4d3252da4 xmpp: Add Agent::send_raw_message 2024-12-18 19:18:22 +01:00
xmppftw
e19a7988ed xmpp: Agent::send_message is only for normal messages 2024-12-18 19:17:55 +01:00
xmppftw
d98ed615a5 xmpp: Agent::send_room_private_message takes RoomPrivateMessageSettings 2024-12-18 19:17:39 +01:00
Emmanuel Gil Peyrot
897c2abe0b tokio-xmpp: Refactor to provide channel-binding for ktls
Instead of having a second method to fetch channel-binding from the
TlsStream, do it directly in the connect() method, since after that we
don’t have enough information to fetch it any longer when using ktls.
2024-12-18 18:05:36 +00:00
xmppftw
7991cef904 Add tests for crate exports ; add structure to imports/exports 2024-12-18 18:03:18 +00:00
Emmanuel Gil Peyrot
1b4a307919 xmpp-parsers: Convert DiscoInfoResult to xso
This disables some tests, but those were controversial anyway.

I was thinking about replacing the Feature struct with a plain String,
what do you think about it?
2024-12-18 18:50:50 +01:00
Emmanuel Gil Peyrot
893a2f8e47 xmpp-parsers: Convert Presence to xso
The two remaining issues, which led to two ignored tests, are that
priority now gets always serialized, and that we don’t reject duplicated
identical xml:lang in statuses.
2024-12-18 15:49:06 +00:00
xmppftw
3fd8285a29 xmpp: RoomNick is newtype wrapper for ResourcePart 2024-12-18 15:43:09 +00:00
xmppftw
5477cf1240 xmpp: Use ResourcePart for sender of room events 2024-12-18 15:43:09 +00:00
xmppftw
c16456f381 parsers/xmpp: MUC bookmarks have nickname typed as ResourcePart 2024-12-18 15:43:09 +00:00
xmppftw
8c033a3fa0 xso: Implement FromXmlText and AsXmlText for NodePart,DomainPart,ResourcePart 2024-12-18 15:43:09 +00:00
Emmanuel Gil Peyrot
3c77ee0cc7 xmpp-parsers: Add support for <alternative-session><sid/></>
This was previously unimplemented due to how the enum was treated, now
that we moved the reason element to xso we can describe it properly and
thus implement everything it supports.

This causes one regression on xml:lang validation, but we can live with
that until xso implements such verification.
2024-12-18 16:08:24 +01:00
Jonas Schäfer
7074344834 xso: correctly handle I/O errors during start event in from_reader
Without this, it'd panic, which is "not ideal", as they say.
2024-12-18 14:47:08 +00:00
Emmanuel Gil Peyrot
cd43aa2fcb xmpp-parsers: Convert the Actor enum into a struct
XEP-0045 doesn’t specify what to do in the case the actor contains both
a @jid and a @nick, so let’s not encode anything special about that
here.

In addition this converted it to use xso.

Supersedes !196.

Fixes #88.
2024-12-17 18:20:52 +01:00
Jonas Schäfer
ce57ee4b38 tokio_xmpp: add example to demonstrate stream management 2024-12-17 18:16:02 +01:00
Jonas Schäfer
35ce86243f client: use stanzastream! 2024-12-17 18:16:02 +01:00
Jonas Schäfer
80f899daa0 tokio_xmpp: implement high-level, resilient stanza stream 2024-12-17 18:16:02 +01:00
Jonas Schäfer
56ce57ecde xmlstream: use Stanza for XmppStreamElement
Oftentimes, Stanza is at hand anyway, so this saves some typing.
2024-12-17 16:12:56 +01:00
Jonas Schäfer
c6f928d5c8 xmlstream: make sink implementation generic
This allows to use any serialisable type. The advantage is that moves
and clones are avoided (which would otherwise be needed to construct
e.g. a XmppStreamElement from a Stanza or Message).
2024-12-17 16:12:56 +01:00
Jonas Schäfer
519718d9b5 xmlstream: add support for boxing the transport
This is useful in situations where we don't want to care about the
specific type of the underlying transport.
2024-12-17 16:12:56 +01:00
Jonas Schäfer
2388f23b4e xmlstream: support receiving stream errors 2024-12-17 16:12:56 +01:00
xmppftw
8c3c8c7c97 hello_bot accepts a list of room JIDs to join to say hello 2024-12-17 00:27:50 +00:00
xmppftw
fdec34afde Add JoinRoomSettings, LeaveRoomSettings, and RoomMessageSettings 2024-12-17 00:27:50 +00:00
Emmanuel Gil Peyrot
7fca02958b xmpp-parsers: Fix jingle thumbnails wrt the XEP changes
Version 0.4.2 added a restriction on width and height to be in the
0..65535 range.  The media-type attribute has always been optional as
well.
2024-12-17 00:27:15 +01:00
xmppftw
6d7a95b6ca Remove xmpp::Event::{JoinRoom,LeaveRoom,LeaveAllRooms} 2024-12-16 22:36:25 +01:00
Jonas Schäfer
fa039c588b xso: improve wording in AsXmlText and AsOptionalXmlText 2024-12-16 19:04:23 +01:00
xmppftw
580fdeffa9 Added a test for prosody bug 1664 workaround 2024-12-16 15:19:54 +00: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
Emmanuel Gil Peyrot
866991bda5 xmpp-parsers: Replace all instances of bool attributes with bool
These bring basically nothing, so we can throw them away alongside their
generator macro.
2024-12-16 13:32:49 +00:00
45be2b34f0 tokio-xmpp: Add 'component' feature
Signed-off-by: Maxime “pep” Buquet <pep@bouah.net>
2024-12-16 00:33:43 +00:00
Emmanuel Gil Peyrot
16b232523d xmpp-parsers: Convert vCard-temp to xso
This also keeps all additional elements in the vCard, so they get
serialized back on the wire instead of being dropped.
2024-12-15 17:38:56 +00:00
Emmanuel Gil Peyrot
aaf2dd7925 xmpp-parsers: Convert bookmarks2 to xso 2024-12-15 17:38:56 +00:00
Emmanuel Gil Peyrot
1c22e17955 xmpp-parsers: Convert Jingle File Transfer to xso 2024-12-15 17:38:56 +00:00
Emmanuel Gil Peyrot
af0bd35e7a xmpp-parsers: Implement XEP-0490: Message Displayed Synchronization
This XEP is used to synchronize where each client has stopped reading a
conversation, so that we can e.g. stop displaying a notification when
the user has read this particular message on a different device.
2024-12-15 17:30:24 +00:00
Emmanuel Gil Peyrot
d738939f89 xmpp-parsers: Simplify hash conversion to Vec
Use `GenericArray::to_vec()` and `slice::to_vec()` directly.
2024-12-15 17:17:01 +00:00
Emmanuel Gil Peyrot
e358bd405f sasl: Simplify hash conversion to Vec
Use `GenericArray::to_vec()` directly.
2024-12-15 17:17:01 +00:00
Emmanuel Gil Peyrot
57e6e98c6a xmpp-parsers: Add test for StartTLS
This tests each element we support, and also keep track of the sizes.

Additionally the copyright year was wrong.
2024-12-15 17:45:26 +01:00
Emmanuel Gil Peyrot
5e9635add3 rustfmt has changed, so update xso so CI is happy again 2024-12-15 16:26:05 +01:00
Emmanuel Gil Peyrot
c390af2b36 jid: Remove the std feature
Since Rust 1.81, std::error::Error has been moved to core::error::Error,
which we can use without depending on std.
2024-11-13 10:52:51 +01:00
Emmanuel Gil Peyrot
dc842c44d1 sasl: Make this crate no_std
We mostly had to import from alloc some structs that are part of the std
prelude, such as Vec and String.
2024-10-27 21:25:14 +01:00
Emmanuel Gil Peyrot
0267383803 sasl: Improve frame parsing
All keys only have a single char, so avoid allocating a whole String for
them.  Also move to a BTreeMap as this is more efficient on such keys.
2024-10-27 21:25:14 +01:00
Jonas Schäfer
7d8ffe45a7 xso: add support for ignoring unknown stuff in extracts 2024-10-26 17:37:32 +00:00
Jonas Schäfer
66233b0150 xso: add support for ignoring unknown children 2024-10-26 17:37:32 +00:00