Commit graph

302 commits

Author SHA1 Message Date
xmppftw
50425617b5 parsers: Add Message::extract_valid_payload helper 2024-12-19 17:36:10 +01: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
c16456f381 parsers/xmpp: MUC bookmarks have nickname typed as 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
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
80f899daa0 tokio_xmpp: implement high-level, resilient stanza stream 2024-12-17 18:16:02 +01: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
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
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
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
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
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
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
xmppftw
df106dfbaf Relative dependencies 2024-08-12 10:39:09 +00:00
Jonas Schäfer
54e1a98cde parsers: add starttls XSOs 2024-08-12 12:35:26 +02:00
Jonas Schäfer
3c78310272 parsers: add umbrella enum for SASL elements
This is useful if, for example during stream negotiation, you want to
parse SASL elements and nothing else. It is also useful if you want to
write down an enum of all XMPP-related stream-level elements you accept
and don't want to loose your fingers typing all the SASL options.
2024-08-12 12:32:12 +02:00
Jonas Schäfer
fc68a57757 parsers: provide stub FromXml/AsXml implementations on Presence 2024-08-12 12:32:12 +02:00
Jonas Schäfer
b931af3c25 parsers: provide stub FromXml/AsXml implementations on Iq 2024-08-12 12:32:12 +02:00
xmppftw
e153468117 Link is link, remove doc warning 2024-08-11 17:22:31 +00:00
Jonas Schäfer
cbc4648b3c parsers: port SASL over to derive macros
You may note that I removed the `exhaustive` flag on the
DefinedCondition enum. This is because other elements in the same
namespace may occur as siblings of that enum, hence using `exhaustive`
may cause incorrect parse errors.

(If parsing attempts to process the `<text/>` child as DefinedCondition
first, DefinedCondition will return a fatal parser error if it is set as
exhaustive because no condition matches `text`.)
2024-08-11 07:58:13 +02:00
Jonas Schäfer
1ecb95881c xso: add support for extracting tuples 2024-08-11 07:58:12 +02:00
Jonas Schäfer
2ff81b3923 xso: add support for fallible parsing and serialisation 2024-08-11 07:45:05 +02:00
Emmanuel Gil Peyrot
d706b318c3 xmpp-parsers: Remove the generate_element!() macro
The last users have now been converted to xso.
2024-08-09 16:08:26 +02:00
Emmanuel Gil Peyrot
4f81411410 xmpp-parsers: Convert Jingle to xso 2024-08-09 16:08:26 +02:00
Emmanuel Gil Peyrot
cb2c4133fe xmpp-parsers: Convert Forwarded to xso 2024-08-09 16:08:26 +02:00
Emmanuel Gil Peyrot
6b167ed677 xmpp-parsers: Convert disco#info identity to xso 2024-08-09 16:08:26 +02:00
Emmanuel Gil Peyrot
2690e62060 xmpp-parsers: Convert roster item to xso 2024-08-09 16:08:26 +02:00
Emmanuel Gil Peyrot
d4f6812386 xmpp-parsers: Convert cert_management to xso
This introduces a breaking change by moving from a bool to an
Option<NoCertManagement>, which will be reverted eventually once we add
support for #[xml(flag)] types of children.
2024-08-09 16:08:26 +02:00
Jonas Schäfer
fb80bb7532 xso: add support for dynamic enums 2024-08-08 15:25:40 +00:00
Emmanuel Gil Peyrot
8e16ae1cbb xmpp-parsers: Integrate sasl2 and sasl_cb into stream:features 2024-08-08 13:52:01 +00:00
Emmanuel Gil Peyrot
7238ebc35e xmpp-parsers: Integrate bind2 and sm into sasl2 2024-08-08 13:52:01 +00:00
Emmanuel Gil Peyrot
27e4499153 xmpp-parsers: Simplify SASL mechanisms type
These can be a simple String for now.
2024-08-08 13:52:01 +00:00
Emmanuel Gil Peyrot
d8e08df464 xmpp-parsers: Implement XEP-0478: Stream Limits Advertisement
This allows servers to communicate their maximum stanza limit, as well
as idle time limit.
2024-08-07 20:59:30 +02:00
Emmanuel Gil Peyrot
3f61050944 xmpp-parsers: Implement XEP-0388: Extensible SASL Profile 2024-08-06 16:36:11 +02:00
Emmanuel Gil Peyrot
de2ba97f79 xmpp-parsers: Implement XEP-0440: SASL Channel-Binding Type Capability 2024-08-06 16:36:10 +02:00
Emmanuel Gil Peyrot
f16fb6a6ef xmpp-parsers: Convert the remaining bind2 elements to xso 2024-08-06 16:36:10 +02:00
Emmanuel Gil Peyrot
f0f4299b02 xmpp-parsers: Parse the bind feature in its module, with required
This is different from the bind query or the bind response, despite all
three having the same element namespace and name…  Annoying!
2024-08-06 16:14:42 +02:00