Commit graph

227 commits

Author SHA1 Message Date
Jonas Schäfer
2c5f1f096b xso: implement support for extracting data from child elements 2024-08-03 15:17:30 +02:00
Jonas Schäfer
6440209f95 xso: reject duplicate children
This was an oversight. Even though we apparently don't have tests for
this anywhere, it is what the old functional macros do.
2024-08-03 11:58:19 +00:00
Jonas Schäfer
2b346c4e87 parsers: port more things to derive macros 2024-08-03 13:05:37 +02:00
Jonas Schäfer
93ba2797be xso-proc: implement support for collections of children 2024-08-03 12:20:04 +02:00
Jonas Schäfer
5c3ed1435f parsers: delete now-unused generate_element_enum macro 2024-08-03 12:19:42 +02:00
Jonas Schäfer
6afd0ef52f parsers: port enums over to derive macros 2024-08-03 12:19:42 +02:00
Jonas Schäfer
c028c3b91a xso: implement exhaustive enums
These more closely mirror how enums work currently with the macros.
Non-exhaustive enums may be useful though and kind of were the natural
thing to implement.
2024-08-03 12:19:28 +02:00
Jonas Schäfer
2fe3c0cef2 xso-proc: add fancy hack to allow codec = Foo<Bar>
We can do this because we know that `x < y` cannot create a
`TextCodec<T>` for any `T`. This is because `<` is guaranteed to return
a boolean value, and we simply don't implement `TextCodec<T>` on bool.
2024-08-03 12:14:26 +02:00
Jonas Schäfer
271c31c9d4 xso: use values instead of types for text codecs
This allows stateful or configurable codecs without having to express
all configuration in the type name itself. For example, we could have a
Base64 type with configurable Base64 engines without having to duplicate
the Base64 type itself.

(Note that the different engines in the Base64 crate are values, not
types.)
2024-08-03 12:14:26 +02:00
xmppftw
5110d5fa96 Support <stream:features> in parsers 2024-08-02 18:25:32 +00:00
Jonas Schäfer
4845715add xso: implement support for enums 2024-08-01 15:28:22 +02:00
Jonas Schäfer
507a3df652 xso-proc: remove Span information from generated type names
By removing that, the lint won't trigger for identifiers with trailing
underscores (which become then embedded underscores which normally trips
the `non_camel_case_types` lint).
2024-08-01 12:53:20 +00:00
Jonas Schäfer
3089832090 xso-proc: remove stripping of trailing _ from type names
Users can now rename the generated types altogether, which means that we
do not need this anymore to avoid lints.
2024-08-01 12:53:20 +00:00
Jonas Schäfer
c90752aa51 xso: add support for overriding names of generated types
In 1265f4b, we introduced a change which may cause a conflict of type
names when deriving the traits on two different types. While a
workaround existed (use `mod`s to isolate the implementation), that is
ugly.

This commit allows overriding the choice of type names.
2024-08-01 12:53:20 +00:00
Emmanuel Gil Peyrot
d752d8c8fe xmpp-parsers: Convert Tune to xso
The Tune::new() constructor wasn’t pub before that.
2024-07-31 15:38:10 +00:00
Emmanuel Gil Peyrot
c85bde3d2e xmpp-parsers: Convert MetadataResponse to xso 2024-07-31 15:38:10 +00:00
Jonas Schäfer
819a869ffb parsers: replace some more generate_element! calls with derive macros 2024-07-27 09:39:13 +02:00
Jonas Schäfer
cd9f2033f3 xso: add support for boxed children
This allows building recursive tree structures.
2024-07-27 08:24:25 +02:00
Jonas Schäfer
01336802b4 xso-proc: add support for optional children 2024-07-27 08:24:25 +02:00
Jonas Schäfer
5d284bbd3a parsers: port some elements with children to derive macros 2024-07-26 22:31:42 +02:00
Jonas Schäfer
5bd36eccfc xso-proc: add support for child elements 2024-07-26 22:31:42 +02:00
Emmanuel Gil Peyrot
c0f1aa620e xmpp-parsers: Bump version to 0.21.0 2024-07-25 18:42:18 +02:00
Emmanuel Gil Peyrot
09c5ad5976 xmpp-parsers: Convert jingle_s5b’s Candidate to xso 2024-07-25 18:42:18 +02:00
Emmanuel Gil Peyrot
726801610f xmpp-parsers: Convert ibb to xso 2024-07-25 18:42:18 +02:00
Emmanuel Gil Peyrot
1a7dec6f1e xmpp-parsers: Convert sm’s Enable and Enabled to xso 2024-07-25 18:42:18 +02:00
Emmanuel Gil Peyrot
01a61c6099 xmpp-parsers: Convert pubsub’s Default to xso 2024-07-25 18:42:18 +02:00
Emmanuel Gil Peyrot
5b5df16ac9 xmpp-parsers: Convert jingle_rtp_hdrext to xso 2024-07-25 18:42:18 +02:00
Emmanuel Gil Peyrot
0b92061433 xmpp-parsers: Convert jingle_ibb to xso 2024-07-25 18:42:18 +02:00
Emmanuel Gil Peyrot
2eb6ca2f94 xmpp-parsers: Remove util::text_node_codecs
This codec system was useful for the previous parser style, but we have
converted them all to xso now!
2024-07-25 18:42:18 +02:00
Emmanuel Gil Peyrot
0c9e478994 xmpp-parsers: Convert media_element to xso
The API changed here, URI became Uri to be more in line with the coding
style.

Also we don’t attempt to trim them any more because that was only used
in the examples, and nowhere in the text of the specification did it say
that those had to be trimmed.
2024-07-25 18:42:18 +02:00
Emmanuel Gil Peyrot
4be297de11 xmpp-parsers: Convert component to xso 2024-07-25 18:42:18 +02:00
Emmanuel Gil Peyrot
e9b6fd5d8b xmpp-parsers: Convert avatar to xso 2024-07-25 18:42:18 +02:00
Emmanuel Gil Peyrot
a2ece705cc xmpp-parsers: Convert vcard to xso 2024-07-25 18:42:18 +02:00
Emmanuel Gil Peyrot
dc0db38cf3 xmpp-parsers: Convert jingle_dtls_srtp to xso 2024-07-25 18:42:18 +02:00
Emmanuel Gil Peyrot
8a48244bc3 xmpp-parsers: Convert vcard_update to xso 2024-07-25 18:42:18 +02:00
Emmanuel Gil Peyrot
387fccce4a xmpp-parsers: Write the ChangeLog for 0.21.0 2024-07-25 17:39:42 +02:00
Emmanuel Gil Peyrot
9346aedfac xmpp-parsers: Update the version in the DOAP
We are close to the release!
2024-07-25 17:39:42 +02:00
11d40bac94 Unify version string formats
https://doc.rust-lang.org/cargo/reference/specifying-dependencies.html#caret-requirements

"^1.2.3" is strictly equivalent to "1.2.3"

Signed-off-by: Maxime “pep” Buquet <pep@bouah.net>
2024-07-25 14:41:04 +00:00
Emmanuel Gil Peyrot
7b66de1166 xmpp-parsers: Stop reexporting extra symbols
Let’s continue reexporting jid and minidom, but not their inner pub
items, users of this crate can go one level deeper if they need that.

Only xso::error::Error is still useful to reexport, as this is part of
the public API of all of our parsers.
2024-07-25 14:36:09 +00:00
Jonas Schäfer
ab35c234c8 xso: Bump version to 0.1.0
Some checks failed
Build / lint (push) Has been cancelled
Build / test-stable (push) Has been cancelled
Build / test-nightly (push) Has been cancelled
2024-07-25 08:25:39 +00:00
Emmanuel Gil Peyrot
62b2966b9d xmpp-parsers: Simplify the page-flip logic for MAM
This only has to be a bool, no need for this Option<bool>.
2024-07-25 08:04:49 +00:00
Emmanuel Gil Peyrot
fa2846024f xmpp-parsers: Fix typos noticed by codespell 2024-07-25 07:54:30 +00:00
Jonas Schäfer
ccf38cdf9b Port everything over to AsXml 2024-07-24 16:05:06 +02:00
f35bbcb36d minidom: Bump version to 0.16
Some checks failed
Build / lint (push) Has been cancelled
Build / test-stable (push) Has been cancelled
Build / test-nightly (push) Has been cancelled
Signed-off-by: Maxime “pep” Buquet <pep@bouah.net>
2024-07-23 19:02:46 +02:00
cc123e3d93 parsers: Update jid to 0.11
Signed-off-by: Maxime “pep” Buquet <pep@bouah.net>
2024-07-23 18:52:44 +02:00
86c13611ba Remove unused paths in multiple Cargo.toml
Paths are already patched in the workspace's [patch.crates-io] block.
Not sure why this was added in the first place.

Signed-off-by: Maxime “pep” Buquet <pep@bouah.net>
2024-07-23 16:28:38 +00:00
Emmanuel Gil Peyrot
c631e4eff4 xmpp-parsers: Implement XEP-0386: Bind 2
This depends on XEP-0313 for its MAM metadata, and many others such as
XEP-0198, XEP-0280 and XEP-0352 for the inline features, but we
currently provide those as minidom Elements instead.
2024-07-03 23:11:23 +00:00
Emmanuel Gil Peyrot
69f480e709 xmpp-parsers: Fix most of the clippy warnings
Only the non-looping loop is kept for now, until we find a better
solution.
2024-07-03 16:28:11 +02:00
Emmanuel Gil Peyrot
b51d6cec3a xmpp-parsers: Reorder the XEP-0122 and XEP-0484 namespaces
We keep the list ordered by XEP number, so that it is easier to search
into.
2024-07-02 07:36:46 +00:00
Emmanuel Gil Peyrot
05651545f8 xmpp-parsers: Update XEP-0313 to its latest version
We didn’t have support for the <metadata/> element, which is a
requirement for XEP-0386: Bind 2.
2024-07-02 07:31:14 +00:00