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
Jonas Schäfer
290460ba9d
xso: add support for ignoring unknown attributes
2024-10-26 17:37:32 +00:00
Jonas Schäfer
74c81b6a37
xso: add from_reader
2024-10-03 12:57:32 +02:00
Alvaro Parker
347e8d6f17
Impl Error for ReadError
2024-09-20 15:17:54 -03:00
Emmanuel Gil Peyrot
c24275c098
tokio-xmpp: Add support for kernel TLS
...
This drastically improve the debuggability of the network parts, by
moving the task of encrypting/decrypting TLS packets from userland to
the kernel. This makes them appear in clear in strace as sendto() and
recvfrom().
I introduced a new tls-rust-ktls feature which depends on both rustls
and ktls, but isn’t enabled by default since it probably isn’t available
on every computer. It requires the tls kernel module to be loaded,
which then can offload encryption/decryption to dedicated hardware if
available.
I have tested this change on Linux 6.11 on a rk3588.
2024-09-17 20:45:41 +00:00
Alvaro Parker
904bdeae11
add debug to StreamHeader
2024-09-17 12:07:06 -03:00
Emmanuel Gil Peyrot
ebfae4bddc
tokio-xmpp: Run rustfmt on that one example
...
It started breaking CI for some reason, probably a rustfmt update.
2024-09-16 23:32:49 +02:00
Alvaro Parker
2ff89a9e42
fix typos
2024-09-16 18:29:44 -03:00
Jonas Schäfer
a503c8534f
parsers: add support for handled-count-too-high error
2024-09-01 13:01:29 +02:00
Jonas Schäfer
0f0759b207
parsers: add support for <optional/> in stream management feature
2024-09-01 13:01:29 +02:00
Emmanuel Gil Peyrot
425be4bef4
tokio-xmpp: Improve highlight_xml()
...
First switch to LazyLock from OnceLock, to simplify the code.
Then concatenate the colour reset escape code instead of using
format!(), since the vast majority of those strings have more capacity
than their length it will avoid a reallocation in most cases.
2024-09-01 12:32:50 +02:00
Jonas Schäfer
263839a5f8
xmlstream: add tests to capture thingy
...
This would've caught the embarrassing error made in the previous commit.
2024-09-01 09:07:34 +00:00
Jonas Schäfer
c795921631
xmlstream: fix crash
...
This happened when (a bit too hastily) applying suggestions from a
review.
2024-09-01 09:07:34 +00:00
Jonas Schäfer
bfe723cf46
parsers: make stream errors more ergonomic for error processing
2024-09-01 08:54:50 +00:00
Jonas Schäfer
b39ad99ecd
parsers: add stream error XSO
2024-09-01 08:54:50 +00:00
Jonas Schäfer
ce4b739026
xmlstream: allow simplex stream shutdown
...
Unlike poll_close, poll_shutdown will only kill the sending side of the
stream. This is relevant to perform a fully clean shutdown procedure in
XMPP.
2024-09-01 10:02:36 +02: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
960fd782bd
xmlstream: fix clean shutdown sequence
...
Without the early return in XmlStream::poll_next in case of the stream
footer, the read state gets recreated and the logic at the top of that
function to actually handle stream shutdown gracefully is never
triggered.
Also that logic was incorrect; the correct behaviour is to wait for the
true EOF.
2024-09-01 10:02:36 +02:00
Jonas Schäfer
efc859abc0
xmlstream: re-introduce syntax-highlit logging of XML stream I/O
2024-09-01 10:02:36 +02:00
Jonas Schäfer
c01eb090b8
xso-proc: improve error messages on cast mismatch for extracts
...
The old error message was pointing at the `FromXml` / `AsXml` invocation
and not on the field which actually caused the problem. The new error
message points exactly at the type of the affected field.
2024-08-31 10:50:44 +02:00
Jonas Schäfer
51884eedf7
Fix missing copyright header
2024-08-30 15:40:32 +02:00