Commit graph xmpp-rs/parsers
Author SHA1 Message Date
Link Mauve
3107259337 xmpp-parsers: Use #[xml(extract)] for the two values
This simplifies the API, and avoids extra newtypes.
2026-02-21 11:38:01 +01:00
Link Mauve
dbe7925d83 xmpp-parsers: Use #[xml(flag)] for rtcp-mux
Also test that it gets deserialized correctly.
2026-02-21 11:36:35 +01:00
Link Mauve
4d6e1363db xmpp-parsers: Replace bind::Required with an #[xml(flag)]
This makes the code simpler to read.
2026-02-21 11:36:34 +01:00
Link Mauve
ca6e04f931 xmpp-parsers: Simplify StreamFeatures::sasl_mechanisms
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.
2026-02-21 11:34:05 +01:00
Jonas Schäfer
0c6772aa7d parsers: derive Default for ibr::LegacyQuery
Very useful when composing a query.
2026-02-21 08:49:56 +00:00
Link Mauve
cc3f22d418 xmpp-parsers: Import FromStr from core
This was needlessly imported from std.

skip-changelog: This is no public change whatsoever.
2026-02-18 19:48:49 +00:00
Link Mauve
67ef9654dc xmpp-parsers: Use Borrow and Cow from core and alloc
These were needlessly imported from std.

skip-changelog: This is no public change whatsoever.
2026-02-18 19:48:49 +00:00
Link Mauve
4f11d2fe5c xmpp-parsers: Implement XEP-0507: Jingle Content Category
This gives the semantic of each video contents in a Jingle session.
2026-02-18 18:00:20 +00:00
Link Mauve
58ed1592f0 xmpp-parsers: Parse the ibr feature in StreamFeatures
This was surprisingly missing before.
2026-01-09 00:49:34 +01:00
Link Mauve
d0062d9931 xmpp-parsers: Split ibr::Query into multiple structs
This introduces FieldsQuery, RemoveQuery, LegacyQuery and FormsQuery,
making this module reflect more accurately how it gets used on XMPP.
2026-01-09 00:49:17 +01:00
Link Mauve
f1e5ac6ac8 xmpp-parsers: Make Priority’s inner i8 pub
We forgot to make it pub before, but should have.

This was a regression from 893a2f8e47,
when we converted it to xso.

Fixes #166.
2025-12-25 01:17:11 +01:00
Link Mauve
8c2b1df7f7 xmpp-parsers: Fix the type of jingle_rtp/ssrc to u32
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.
2025-12-03 12:26:30 +01:00
Link Mauve
5ed958582b Fix all typos using the typos tool
See https://github.com/crate-ci/typos
2025-11-22 21:48:21 +00:00
Link Mauve
3eb8a2ae11 xmpp-parsers: Run rustfmt
Sorry, I made a mistake and pushed directly to main. T_T
2025-11-22 22:47:20 +01:00
Link Mauve
9b77b968a9 xmpp-parsers: Simplify with String::split_once() instead of splitn(2)
This directly returns a 2-uple, instead of a Vec which has to be matched
again as if we didn’t know it would return up to two elements.
2025-11-22 22:40:53 +01:00
Link Mauve
4d1838d6cc xmpp-parsers: Use ToString::to_string as a map() argument
It’s more readable than using a closure for the same thing.
2025-11-22 22:20:06 +01:00
pep
7a1dde7cfb parsers: Bump to 0.22.0
Signed-off-by: pep <pep@bouah.net>
2025-11-01 17:34:37 +01:00
pep
e95f884e44 parsers: clippy
Signed-off-by: pep <pep@bouah.net>
2025-11-01 16:30:22 +01:00
pep
30b049a7d4 Bump xso to 0.3.0
Signed-off-by: pep <pep@bouah.net>
2025-10-28 13:06:51 +01:00
pep
bd986f5e5e minidom: Bump version to 0.18
Signed-off-by: pep <pep@bouah.net>
2025-10-28 13:06:51 +01:00
Link Mauve
0c253b8c4e xmpp-parsers: Deny more warnings lib-wide
All warnings denied in macro tests can actually be denied in the whole
crate.
2025-10-25 18:38:45 +02:00
pep
15ac51829f minidom: loosen type requirement on Element::attr{,_ns} getters
Signed-off-by: pep <pep@bouah.net>
2025-10-22 18:51:42 +02:00
Maxime “pep” Buquet
19865e5f1e minidom: breaking: Allow getting Element attributes by namespace
- 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>
2025-10-22 18:51:39 +02:00
pep
7d47173318 parsers/stanza_error: fix tests behind 'component' feature
Signed-off-by: pep <pep@bouah.net>
2025-10-21 23:40:00 +02:00
pep
061ccecb3f parsers: get_best_body test: Add missing @xml:lang under component feature
Signed-off-by: pep <pep@bouah.net>
2025-10-21 23:40:00 +02:00
pep
e7845d0fbc parsers: gate unused import
Signed-off-by: pep <pep@bouah.net>
2025-10-21 23:40:00 +02:00
Jonas Schäfer
ccdf27117d Fix docs build with current nightly
skip-changelog, we don't officially support nightly.

See-Also: https://github.com/rust-lang/rfcs/pull/3631
See-Also: https://github.com/rust-lang/rust/pull/138907
2025-10-08 13:03:39 +02:00
Jonas Schäfer
3ffff2614a Bump xso version to 0.2.0 2025-09-17 20:03:18 +02:00
Jonas Schäfer
ff9c3dc88c Bump minidom version to 0.17.0 2025-09-17 19:15:41 +02:00
Link Mauve
9d91b02dfd Revert "xmpp-parsers: Remove optional child from sm element"
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.
2025-09-08 11:37:24 +02:00
PulkoMandy
155ad9b670 parsers: Add Confirm from XEP-0070 2025-08-29 11:40:25 +00:00
PulkoMandy
1052aaf010 parsers: fix documentation typo 2025-08-29 11:40:25 +00:00
Link Mauve
0a1b291574 xmpp-parsers: Remove optional child from sm element
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
2025-08-29 12:48:55 +02:00
Maxime “pep” Buquet
621c5882cf
parsers: re-export xso::error::FromElementError
Signed-off-by: Maxime “pep” Buquet <pep@bouah.net>
2025-08-14 15:24:09 +02:00
Saarko
7c87d879d8 parsers: fix text field namespacing in StreamError
skip-changelog
2025-08-07 12:43:21 +00:00
Jonas Schäfer
59af49c691 xso-proc: provide FromXml::xml_name_matcher on derived impls
That way, derived implementations can also make use of the performance
benefits.
2025-07-13 11:10:51 +00:00
Jonas Schäfer
1262b560e9 Fix parsing of stream errors
skip-changelog, because there's no release with the stream_error module
yet.
2025-07-13 12:53:43 +02:00
Jonas Schäfer
e438813fb2 tokio_xmpp: properly process <stream:error/> while waiting for features
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.
2025-07-13 12:53:43 +02:00
Jonas Schäfer
af7e47a791 Add changelog entry for starttls nonzas
They have been added in 54e1a98cd already.
2025-07-09 17:18:31 +02:00
Jonas Schäfer
c229ab0127 Add support for <failure xmlns=starttls/>
Specified in RFC 6120 §5.4.2.2
2025-07-09 17:18:13 +02:00
Maxime “pep” Buquet
dc2477eec3 Revert "xmpp-parsers: Support required in SM feature"
This reverts commit 4e0cd5d96b.
2025-06-03 23:18:10 +02:00
Link Mauve
4e0cd5d96b xmpp-parsers: Support required in SM feature
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.
2025-06-03 23:03:13 +02:00
Link Mauve
74f67b9585 xmpp-parsers: Port Jingle MI to use the derive macros
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.
2025-05-19 20:05:14 +02:00
Link Mauve
3920ad3819 xmpp-parsers: Use the new lang meta everywhere
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.
2025-05-14 02:09:26 +02:00
Jonas Schäfer
dc8c3eac4c parsers: port Iq to use the derive macros 2025-05-13 12:01:21 +00:00
Link Mauve
7f0a7b2247 xmpp-parsers: Switch to #[xml(lang)] wherever it’s possible
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.
2025-05-03 10:07:54 +02:00
Link Mauve
3f873d2b42 xmpp-parsers: Remove some unneeded clones 2025-05-03 10:06:59 +02:00
Jonas Schäfer
c0262fbafb xso: add support for attribute-switched enums
skip-changelog, because enums have been introduced in the same release,
so this is merely an addition to the already changelogged enum feature.
2025-04-27 18:34:48 +00:00
Jonas Schäfer
67f3ffaced xso: re-implement #[xml(lang)] on top of #[xml(attribute)]
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.
2025-04-27 14:19:31 +02:00
Jonas Schäfer
c4de8725fc xso: deprecate try_from_element
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.
2025-04-27 13:44:06 +02:00