This was already just a wrapper around a Vec<String>, but we can do away
with the wrapper thanks to #[xml(extract)].
I’ve also replaced Vec with BTreeSet, since that corresponds better to
how the mechanisms are.
XEP-0167 has been updated to version 1.2.3, to change the type of the
'ssrc' attribute to u32 (from String). This is in accordance with
RFC 3550 (RTP), which defines it as a randomly-chosen 32-bit unsigned
integer.
Additionally, the docstring was completely wrong.
- Move Element.attributes to `AttrMap`, slowly using rxml's features and
unrolling our own.
- Add Element::attr_ns that requires the attribute namespace.
Element:attr defaults to rxml::Namespace::none() but the interface
changes nonetheless for a &NcNameStr. Similar changes on
`ElementBuilder` methods.
- Remove iterator structs for attributes, return a ref on the AttrMap
directly as we don't need to keep attributes' internals hidden
anymore.
- Enable rxml's `macros` feature within tests to access the `xml_ncname`
macro.
Signed-off-by: pep <pep@bouah.net>
This reverts commit 0a1b291574 once again.
This is currently required to connect to Prosody, otherwise the parser
will choke on the extra undocumented child.
I still wonder if required (4e0cd5d96b)
would be useful to support then, as it might also be found in the wild.
When the required child was added and subsequently reverted, it was
noted that optional and required were never defined, and only appeared
in old XEP-0198 examples. The XEP has been fixed already[1].
This basically reverts 0f0759b207.
[1] https://github.com/xsf/xeps/pull/1447
Before this, a stream error would not be readable by user code, as the
`recv_features()` function would not even attempt to parse it. This
change allows application code to react to stream errors which are
received before stream features are received.
skip-changelog, because there's no release with the xmlstream module
yet.
This was forgotten in 0f0759b207.
That element is only specified in the XML schema, its semantics aren’t
defined anywhere, but we can guess them anyway.
The only missing check is that #[xml(element)] doesn’t support filtering
on elements with a specific name yet.
skip-changelog: This isn’t a user-visible change.
Stop parsing xml:lang manually, instead use the #[xml(lang)] meta which
tracks it using the XML semantics, inheriting it from the most recent
ancestor.
skip-changelog: This isn’t a user-facing change.
So far this new meta doesn’t work for the BTreeMap<Lang, String>
pattern, which is often used to provide multiple versions of a payload.
skip-changelog: This isn’t a user-facing change.
This gives us all the goodies of `default`, `type_` and `codec` without
having to duplicate lots of code (and I think the `match`-iness of the
new macro code is still within limits).
However, we still keep them as separate `#[xml(..)]` attributes, because
their semantics are very different and it is sensible to make them stand
out.
skip-changelog, because `#[xml(lang)]` was introduced in this version.
It is not necessary anymore, because we switched from `IntoXml` to
`AsXml`, allowing `transform` to work with a reference instead of
consuming its input.
Before that, `try_from_element` was the only way to fallibly attempt to
parse something from `Element` without having to clone the entire DOM.
Because this attribute may occur in random places, it makes no sense
failing on it. We discard it after attribute processing though, so it
can still be captured by structs which are explicitly interested in it.