Commit graph xmpp-rs/jid
Author SHA1 Message Date
pep
6624dffe25
jid: Allow for deserializers which cannot provide borrowed strings
skip-changelog: already in there.

Signed-off-by: pep <pep@bouah.net>
2026-01-03 21:28:49 +01:00
pep
89feaa0391
jid: Gate struct introduced in 60bf821c6 behind 'serde' feature
skip-changelog: Already updated

Signed-off-by: pep <pep@bouah.net>
2025-12-27 13:32:12 +01:00
Link Mauve
60bf821c63 jid: Fix JID parts serde deserialization
serde was bypassing the validation these types rely on, making them
completely unsound in an XMPP context.

Fixes #165.
2025-12-25 14:31:23 +01:00
pep
239a019174
jid: Bump to 0.12.1
Signed-off-by: pep <pep@bouah.net>
2025-11-02 01:28:30 +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
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
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
ff9c3dc88c Bump minidom version to 0.17.0 2025-09-17 19:15:41 +02:00
Maxime “pep” Buquet
b1c80f4071 jid: use "jid" instead of "::jid" in quote support
This causes issues in crates using it because they need to have "jid"
listed as a direct dependency when it's not always obvious (version
mismatch etc. when something already uses jid as a dep)

Signed-off-by: Maxime “pep” Buquet <pep@bouah.net>
2025-09-01 12:38:18 +00:00
Maxime “pep” Buquet
4c2fac0ac3 jid: clippy run
Signed-off-by: Maxime “pep” Buquet <pep@bouah.net>
2025-04-08 12:47:56 +02:00
Emmanuel Gil Peyrot
9f9eaba7c5 jid: Bump version to 0.12.0 and release it! 2025-02-25 00:00:59 +01:00
Emmanuel Gil Peyrot
cffef5d5f1 jid: Update ChangeLog 2025-02-25 00:00:32 +01:00
Emmanuel Gil Peyrot
7e260dd677 jid: Simplify *Part parsing
Reuse the main JID parsing blocks for the separate parts.
2025-02-12 18:23:26 +01:00
Emmanuel Gil Peyrot
bd17a2ffbf jid: Move node and resource validation to functions
This simplifies the flow of the checks.
2025-02-12 18:23:24 +01:00
Emmanuel Gil Peyrot
2a2f532c80 jid: Validate domains against idna
The idna crate validates against UTS 46, which supports domains using
either IDNA2003 or IDNA2008.  This allows us to support both old and
new internationalized domain names.

This dependency isn’t a new one in the tree, as hickory-proto, url and
tokio-xmpp all were already depending on it.

There are a bunch of other checks that have to be performed, this is
inspired by slixmpp’s JID implementation.
2025-02-12 18:21:20 +01:00
Emmanuel Gil Peyrot
f5f35eab20 jid: Test for too many @ before the resourcepart
This additionally should optimize the parsing a tiny bit by looking for
both @ and / at the same time and iterating on them, instead of one by
one.

Thanks nicoco for the report!
2025-02-12 17:14:04 +00:00
491264fe00 jid: serde support for JID parts 2024-12-20 13:06:05 +00:00
4ac792b4d4 jid: Replace std stuff with alloc/core stuff 2024-12-19 20:47:08 +01:00
7991cef904 Add tests for crate exports ; add structure to imports/exports 2024-12-18 18:03:18 +00:00
8c033a3fa0 xso: Implement FromXmlText and AsXmlText for NodePart,DomainPart,ResourcePart 2024-12-18 15:43:09 +00: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
df106dfbaf Relative dependencies 2024-08-12 10:39:09 +00:00
Emmanuel Gil Peyrot
9960cfd965 jid: Make Debug more readable on Jid
Jid("foo@bar/baz") instead of Jid { normalized: "foo@bar/baz", at:
Some(3), slash: Some(7) }, which I find much more readable.

Same for BareJid and FullJid.
2024-08-06 16:53:58 +02:00
fa99c09585 Indicate which feature flag for each module/type 2024-08-05 11:14:41 +02:00
Maxime “pep” Buquet
0ef646db86 jid: Bump version to 0.11.1
Signed-off-by: Maxime “pep” Buquet <pep@bouah.net>
2024-07-23 19:02:46 +02:00
Maxime “pep” Buquet
f35bbcb36d minidom: Bump version to 0.16
Signed-off-by: Maxime “pep” Buquet <pep@bouah.net>
2024-07-23 19:02:46 +02:00
Maxime “pep” Buquet
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
Maxime “pep” Buquet
93288307d3
jid: bump version to 0.11
Signed-off-by: Maxime “pep” Buquet <pep@bouah.net>
2024-07-23 18:06:03 +02:00
Maxime “pep” Buquet
318e5a19cc jid: Update Changelog
Signed-off-by: Maxime “pep” Buquet <pep@bouah.net>
2024-07-23 14:32:13 +02:00
Emmanuel Gil Peyrot
b4b0a7dbba jid: Simplify from_parts() a bit
By defining the variables in the parent scope, we can avoid one level of
indentation for the tuple, which makes things more readable.

Additionally, we don’t need to call .to_str() on the passed objects,
they automatically Deref to &str for the format!() call.
2024-07-15 18:27:35 +02:00
Emmanuel Gil Peyrot
ff588d834e jid: Fix a clippy warning
The other three are about missing Self in the new method’s return type,
but these return the Cow type instead so that’s how they’re meant to be.
2024-07-03 16:28:11 +02:00
Jonas Schäfer
9b2663a28b Add more specific into_* conversion functions to specific JID subtypes
This is necessary because `into_inner()` as implemented on Jid
consumes the value. That means it cannot be called through Deref
(because that only takes a reference).
2024-05-14 17:53:53 +02:00
Emmanuel Gil Peyrot
48f77acb69 jid: Make the crate no_std
Only std::error::Error is missing in this mode, but that’s only waiting
for its stabilisation, see this issue:
https://github.com/rust-lang/rust/issues/103765
2024-05-04 10:28:25 +00:00
Jonas Schäfer
1293e9a3eb jid: fix incorrect type on Jid::Full
This does not matter much because users need to replace usages of these
anyway, but it's better to have it right here to not cause additional
confusion.
2024-04-16 18:19:47 +02:00
Jonas Schäfer
054447d147 jid: add more testcases
Because why not!
2024-04-15 19:54:59 +02:00
Jonas Schäfer
c08946aa7c jid: skip at and slash in comparison operators
They only contain cached information and thus don't need to be included
in comparison and identity operators.

Fixes #123.
2024-04-15 19:35:02 +02:00
Jonas Schäfer
c895cb1009 jid: implement Borrow<Jid> on FullJid and BareJid
This allows to use them interchangably when looking up keys in hash sets
and dicts.
2024-04-15 18:21:24 +02:00
Jonas Schäfer
2e9c9411a3 jid: rewrite public types
This moves InnerJid into Jid and reformulates BareJid and FullJid in
terms of Jid.

Doing this has the key advantage that FullJid and BareJid can deref to
and borrow as Jid. This, in turn, has the advantage that they can be
used much more flexibly in HashMaps. However, this is (as we say in
Germany) future music; this commit only does the internal reworking.

Oh and also, it saves 20% memory on Jid objects.

Fixes #122 more thoroughly, or rather the original intent behind it.
2024-04-15 18:21:24 +02:00
Jonas Schäfer
2c701038cd Implement as_str on all Jid types
This is useful for printing with quotes without copying any data.
2024-03-10 10:51:53 +01:00
Jonas Schäfer
9608b59f60 Add more conversion/construction paths between Jid and part types 2024-03-10 10:51:53 +01:00
Jonas Schäfer
7fce1146e0 Offer {Resource,Node,Domain}Ref on Jid API
This provides a non-copying API, which is generally favourable. The
other accessors were removed, because the intent was to provide this
"most sensible" API via the "default" (i.e. shortest, most concisely
named) functions.
2024-03-10 10:51:01 +01:00
Jonas Schäfer
45f1567ff2 Use debug_tuple instead of string formatting
This provides standard-library-like output.
2024-03-09 09:00:22 +01:00
Jonas Schäfer
8238e81c66 Unify declaration of {Node,Domain,Resource}Part
This introduces a str-like type for each of these, which will allow
returning a ref instead of the copied data from various methods in
{Full,Bare}Jid.

The use of a macro ensures that all types are declared consistently.
2024-03-09 09:00:22 +01:00
141a40bc79 Derive PartialOrd/Ord for Jid types 2023-12-31 16:59:21 +00:00
ac4ffd2268 Use relative cargo paths when using local copy 2023-12-18 13:06:22 +01:00
119c04801c Fix cargo doc warnings in jid crate 2023-12-16 17:19:11 +01:00
Maxime “pep” Buquet
4089891f6c Update edition to 2021
- Remove TryFrom/Into and FromIterator imports
- Prevent impl_validator_using_provider macro in sasl crate from
  constructing trait object

Signed-off-by: Maxime “pep” Buquet <pep@bouah.net>
2023-12-15 19:40:09 +00:00
Aurabindo Pillai
12d102b39c Fix some clippy warnings 2023-12-04 01:01:19 +00:00
Maxime “pep” Buquet
e20bd9b1d2
jid: Update Changelog
Signed-off-by: Maxime “pep” Buquet <pep@bouah.net>
2023-11-11 13:24:26 +01:00