Commit graph

2,344 commits

Author SHA1 Message Date
Jonas Schäfer
134255d1de parsers: port data_forms to use derive macros 2025-04-18 10:49:26 +02:00
Jonas Schäfer
8e81c41f59 xso: add support for post-deserialization callback 2025-04-18 10:49:26 +02:00
Maxime “pep” Buquet
da219d4fed
xmpp: handle SIGINT (^C) in hello_bot example
Signed-off-by: Maxime “pep” Buquet <pep@bouah.net>
2025-04-13 21:16:17 +02:00
Maxime “pep” Buquet
23c947d081 tokio-xmpp: clippy run
skip-changelog

Signed-off-by: Maxime “pep” Buquet <pep@bouah.net>
2025-04-08 13:57:21 +02:00
Maxime “pep” Buquet
1b635854ad parsers: clippy run
Signed-off-by: Maxime “pep” Buquet <pep@bouah.net>
2025-04-08 13:57:21 +02: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
Maxime “pep” Buquet
4994ac20f9 xso-proc: clippy run
Caught a bug hidden behind #[cfg(not(feature = "minidom"))]

Signed-off-by: Maxime “pep” Buquet <pep@bouah.net>
2025-04-08 12:47:56 +02:00
Maxime “pep” Buquet
5b62672541 xso: clippy run
Signed-off-by: Maxime “pep” Buquet <pep@bouah.net>
2025-04-08 12:47:56 +02:00
Maxime “pep” Buquet
2555bedaa8
CI: add .show-version block in docs job
skip-changelog

Signed-off-by: Maxime “pep” Buquet <pep@bouah.net>
2025-04-08 12:43:30 +02:00
Maxime “pep” Buquet
a1247a0e3c parsers: Add support for XEP-0335: JSON Containers
Signed-off-by: Maxime “pep” Buquet <pep@bouah.net>
2025-04-07 18:35:43 +00:00
Maxime “pep” Buquet
ab7e6de3e1 xso: Add support for serde_json::Value
Signed-off-by: Maxime “pep” Buquet <pep@bouah.net>
2025-04-07 18:35:43 +00:00
Maxime “pep” Buquet
4780f89604 xmpp: new Agent::new method
Signed-off-by: Maxime “pep” Buquet <pep@bouah.net>
2025-04-07 18:26:27 +00:00
Link Mauve
5ae38545e4 xmpp: Shorten the default caps node to our main domain
We do own xmpp.rs, so let’s use that instead of gitlab.com.
2025-04-07 11:57:01 +02:00
Jonas Schäfer
84c4b5731c parsers: port stanza_error over to derive macros 2025-04-06 08:36:15 +02:00
Jonas Schäfer
b05ee0280a xso: add support for selectively discarding text and attributes 2025-04-06 08:36:15 +02:00
R T
fd97f9f31c fix presence serialization name 2025-04-05 17:26:33 +00:00
Jonas Schäfer
7faa6dc15b parsers: port time over to derive macros 2025-04-03 21:42:02 +02:00
Emmanuel Gil Peyrot
d203a348cb minidom: Make the whole crate almost no_std
Only std::io is still missing, maybe we should consider using a crate
implementing its API on top of no_std?
2025-03-30 12:46:39 +02:00
Colin Kinloch
8e375aea66 minidom: Specify XML subset restrictions in readme
skip-changelog: It's just a readme
2025-03-27 11:40:47 +00:00
Emmanuel Gil Peyrot
af14717ddc minidom: Fix most issues reported by clippy
This improves some of our internals.

skip-changelog: These changes are purely internal.
2025-03-27 11:19:56 +00:00
Saarko
932575c8d6 xmpp_parsers: Add Push Notifications (XEP-0357)
Add support for Push Notification parsing according to https://xmpp.org/extensions/xep-0357.html version 0.4.1.
2025-02-25 14:47:08 +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
Maxime “pep” Buquet
ca241faf7d PrintRawXml: Add changelog entry
Signed-off-by: Maxime “pep” Buquet <pep@bouah.net>
2025-02-14 18:02:13 +01:00
Maxime “pep” Buquet
947d84c0d2 parsers: add xso test module
Separate from the macro_tests module because it doesn't actually test
macros, it uses it as a convenience.

Signed-off-by: Maxime “pep” Buquet <pep@bouah.net>
2025-02-14 18:02:13 +01:00
Maxime “pep” Buquet
b89d3ab04d xso: Add PrintRawXml helper struct with Display
Add a helper struct to be able to display Raw Xml, useful for debug
logs.

Signed-off-by: Maxime “pep” Buquet <pep@bouah.net>
2025-02-12 20:17:41 +01:00
Emmanuel Gil Peyrot
356ad0d46e xso: Fix all failing clippy tests
They are all sensible to me.

skip-changelog: Internal changes.
2025-02-12 19:11:32 +00:00
Emmanuel Gil Peyrot
5cbe5936a6 xmpp-parsers: Use xso for pubsub owner
Also merge its direct children into its enum fields.
2025-02-12 20:06:29 +01:00
Emmanuel Gil Peyrot
26dd6a2a29 minidom: Remove unused lifetimes
These can be elided just fine.

skip-changelog: This is purely internal change.
2025-02-12 18:08:05 +00:00
Emmanuel Gil Peyrot
205857e59c xmpp-parsers: Remove MIX support
This protocol has failed to gain any traction in the XMPP ecosystem and
is actively being replaced with better alternatives based on MUC.
2025-02-12 18:56:40 +01:00
Emmanuel Gil Peyrot
e7395b7ed8 xmpp-parsers: Add a lang property to Presence
This is a workaround for rxml not handling @xml:lang properly yet.
2025-02-12 17:48:04 +00: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
Emmanuel Gil Peyrot
772a326053 xmpp-parsers: Add missing size tests for MUC
skip-changelog: This is just about testing.
2025-02-11 12:27:07 +01:00
Emmanuel Gil Peyrot
c497967b1c xmpp-parsers: Reduce component handshake allocations
This function always appends to an existing string, so by passing it a
String directly we can avoid superfluous allocations.

Also tokio-xmpp was doing a bunch of &str to String for no reason around
there, let’s remove that too.
2025-02-10 17:06:15 +00:00
Emmanuel Gil Peyrot
b8f64037a9 tokio-xmpp: Fix build on insecure-tcp
insecure-tcp requires the io-util feature of tokio, so let’s enable it
there.

Fixes this error:
5   | use tokio::{io::BufStream, net::TcpStream};
    |             ^^^^^^^^^^^^^ no `BufStream` in `io`
2025-02-10 15:40:53 +01:00
Jonas Schäfer
4148e9d165 xso-proc: hide generated FromXml / AsXml types
They really clutter the documentation, because they show up in the
module's index. Downside is that users can't inspect the documentation
of those types anymore, but it's not useful anyway: the parts are
private and they just impl some traits.
2025-01-28 18:26:55 +01:00
Emmanuel Gil Peyrot
fa61f421bb xmpp-parsers: Use xso for pubsub events
Also split the PubSubEvent enum into Event and Payload.
2025-01-27 15:07:59 +01:00
Emmanuel Gil Peyrot
543d9eb590 xmpp-parsers: Convert http_upload::Header to xso
We can’t use generate_attribute!() for HeaderName because it has to be
case insensitive.
2025-01-27 14:45:17 +01:00
Emmanuel Gil Peyrot
40808b883d xmpp-parsers: Add missing size tests for http_upload 2025-01-27 14:41:14 +01:00
Emmanuel Gil Peyrot
c245b3fa84 xmpp-parsers: Simplify SubscribeOptions using #[xml(flag)]
skip-changelog: This is not a user-visible change.
2025-01-27 13:35:09 +00:00
Emmanuel Gil Peyrot
d092b6affa xmpp-parsers: Convert mam::Query to xso
skip-changelog: This is not a user-visible change.
2025-01-27 03:29:29 +01:00
Emmanuel Gil Peyrot
f63b780089 xmpp-parsers: Simplify PubSub Item using xso
Now that we can have a single arbitrary payload, we can derive FromXml
and AsXml on the Item.
2025-01-26 16:40:05 +00:00
Emmanuel Gil Peyrot
1823afbc71 xso-proc: Add the default flag to the element meta
This allows the payload to be absent, and requires the field type to be
Option<minidom::Element>.
2025-01-26 16:40:05 +00:00
Emmanuel Gil Peyrot
c72cf3ddd1 xso-proc: Add n = 1 flag to element meta
This allows exactly one arbitrary payload in any element, and is handled
after every other element with a more specific matcher has been parsed.

Both the #[xml(element(n = 1))] meta and its shortcut #[xml(element)]
are allowed and treated the exact same way.
2025-01-26 16:40:05 +00:00
Jonas Schäfer
057306fba1 ci: use shallow fetch
No need to fetch the entire history. The merge base is likely within the
last couple commits because we require it to be so anyway, because the
repo requires fast-forward merges currently.

skip-changelog, because this doesn't touch library code.
2025-01-26 17:36:51 +01:00
Jonas Schäfer
6bed0f27ec ci: ensure that main branch is fetched for changelog check job
skip-changelog, as this doesn't touch library code.
2025-01-26 17:32:34 +01:00
Jonas Schäfer
8a4d548d9a tokio_xmpp: implement IQ tracking 2025-01-26 17:15:41 +01:00