Commit graph

2102 commits

Author SHA1 Message Date
Emmanuel Gil Peyrot
5b6dcb6549 icu: Remove this obsolete attempt 2023-06-20 19:59:16 +02:00
Emmanuel Gil Peyrot
cea9c04507 xmpp: Update to the new jid crate 2023-06-20 18:59:26 +02:00
Emmanuel Gil Peyrot
3c9df12606 tokio-xmpp: Update to the new jid crate
This helps a bit thanks to fewer clones, but otherwise there are very
few changes.
2023-06-20 18:59:26 +02:00
Emmanuel Gil Peyrot
c7887efbc7 xmpp-parsers: Fix size tests on 32-bit 2023-06-20 18:59:26 +02:00
Emmanuel Gil Peyrot
91736ec0ed xmpp-parsers: Fix size tests on 64-bit 2023-06-20 18:59:26 +02:00
Emmanuel Gil Peyrot
022a920300 xmpp-parsers: Update to the new jid crate 2023-06-20 18:59:26 +02:00
Emmanuel Gil Peyrot
cdf4486e53 jid: Remove From<*Jid> for String
Use fmt::Display instead if you want this feature.
2023-06-20 18:59:26 +02:00
Emmanuel Gil Peyrot
ccf41fc1e8 jid: Rename errors to make them more consistent 2023-06-20 18:59:26 +02:00
Emmanuel Gil Peyrot
1904f0af6c jid: Rename error into Error
JidParseError is an ok name when imported elsewhere, but inside of this
crate it makes much more sense to name it Error.
2023-06-20 18:59:26 +02:00
xmppftw
2a3d393ad5 jid: Factorize length check for shorter code 2023-06-20 18:59:26 +02:00
Emmanuel Gil Peyrot
cf25bd3fee jid: Refactor all three JID types
The main reason for this refactor was to make common operations simpler,
for instance formatting a JID is now a simple clone of a String.

Instead of having three different String for each of node, domain and
resource, we now have a single String with offsets pointing to where the
at and slash are (if they are present).

This also reduces the size of a FullJid from 72 bytes to 32 bytes on
64-bit platforms (less so on 32-bit), and BareJid from 48 bytes to
32 bytes.  Jid is still 40 bytes instead of 32, but that can be improved
in a future version where InnerJid has been inlined into each struct.
2023-06-20 18:59:26 +02:00
Emmanuel Gil Peyrot
187e156b0b jid: Move JidParseError into its own module 2023-06-20 18:59:26 +02:00
Emmanuel Gil Peyrot
d867d8d7a1 jid: Replace icu with stringprep
This dependency is unmaintained, but it is written in pure Rust unlike
ICU, and doesn’t require a roundtrip through UTF-16, improving both
performances (perhaps?) and ease of compilation.
2023-06-20 18:59:26 +02:00
Emmanuel Gil Peyrot
a7dee0bef4 jid: Test for the size of our structs
This shows how big JIDs are represented on the stack and in other
structs.
2023-06-20 18:59:26 +02:00
Emmanuel Gil Peyrot
17335136fe tokio-xmpp: Add syntax highlighting to debug logs
This uses syntect, and has been checked to have zero overhead when it is
disabled.
2023-06-19 19:52:38 +02:00
99f3811c71 tokio-xmpp: Add debug for chosen DNS method
Signed-off-by: Maxime “pep” Buquet <pep@bouah.net>
2023-06-18 17:04:23 +02:00
f9d4419513
parsers: Document new MucUser helpers
Signed-off-by: Maxime “pep” Buquet <pep@bouah.net>
2023-06-07 19:17:06 +02:00
9fa8a9f6ba
parsers: Rename MucUser::with_status to with_statuses
Signed-off-by: Maxime “pep” Buquet <pep@bouah.net>
2023-06-07 19:16:55 +02:00
552848b3ed
xmpp: Revert part of 9c39e3 and fix code at the right place
Signed-off-by: Maxime “pep” Buquet <pep@bouah.net>
2023-06-07 19:10:45 +02:00
d52ace59a9
xmpp: add MucUser payload in send_room_private_message Messages
Signed-off-by: Maxime “pep” Buquet <pep@bouah.net>
2023-06-07 18:54:23 +02:00
b8ba74e336
parser: Add helpers on MucUser
Signed-off-by: Maxime “pep” Buquet <pep@bouah.net>
2023-06-07 18:44:37 +02:00
xmppftw
9c39e3c195 Event::RoomPrivateMessage does not expose sender FullJid ; add Agent::send_room_private_message method 2023-06-07 15:32:42 +00:00
xmppftw
6144a4c8b0 Event::RoomPrivateMessage for MUC PMs (#85) 2023-06-07 15:32:42 +00:00
4701f6bb69 jid: Rename Error::IcuError into Error::Stringprep
Avoir the "Error Error" pattern, and also use Stringprep instead of ICU

Signed-off-by: Maxime “pep” Buquet <pep@bouah.net>
2023-06-07 17:29:05 +02:00
xmppftw
2cafecb004 JID stringprep errors return a JidParseError instead of panic (#84) 2023-06-07 17:29:00 +02:00
d0ec8739d5 parsers: impl MessagePayload for MucUser
Signed-off-by: Maxime “pep” Buquet <pep@bouah.net>
2023-06-07 16:54:20 +02:00
6cd4addc1a parsers: Add with_payload/with_payloads helpers on Message
Signed-off-by: Maxime “pep” Buquet <pep@bouah.net>
2023-06-07 16:49:19 +02:00
xmppftw
c8dcf5e7a7 Fix expected struct sizes for nightly optimizations (no more CI warnings) 2023-06-06 09:37:16 +00:00
xmppftw
099b7356a6 Include libicu-dev in CI images 2023-06-06 01:07:19 +02:00
a74eeb2910 CI: Lighter docker images
Signed-off-by: Maxime “pep” Buquet <pep@bouah.net>
2023-06-05 18:01:51 +00:00
xmppftw
3ac741d666 RUST_LOG=debug can now be used in tokio-xmpp examples to see XMPP network traffic 2023-06-05 15:02:35 +00:00
ae67949e7a
tokio-xmpp: Ensure id is added only to stanza
The previous commit didn't fix a bug where @id would be added to
elements that didn't need it / where it was invalid (e.g., stream
management).

Signed-off-by: Maxime “pep” Buquet <pep@bouah.net>
2023-06-05 16:34:13 +02:00
bc73af1e5e
tokio-xmpp: @id wasn't correctly added to every stanza
This commit moves the code adding @id to AsyncClient and SimpleClient,
instead of on the lower level send_stanza helper, which seemed to only
be used internally.

Support is also added for Component.

This removes the addition of @id on elements like <auth/> or <bind/>,
which probably weren't required anyway?

Signed-off-by: Maxime “pep” Buquet <pep@bouah.net>
2023-06-04 19:07:56 +02:00
xmppftw
6fa6deddcb Message now has constructors for each type, and a with_body builder method (#78) 2023-06-03 12:39:55 +02:00
xmppftw
512c1d1aae Presence now has constructors for each type variant, and a with_payload builder method (closes #79) 2023-06-03 08:59:19 +00:00
72ddb8b851
xmpp: Update Changelog to mention ClientBuilder::new signature change
Signed-off-by: Maxime “pep” Buquet <pep@bouah.net>
2023-06-02 17:59:44 +02:00
xmppftw
209bab1441 tokio_xmpp::AsyncClient and xmpp::Agent take a fully parsed Jid (#72) 2023-06-01 16:55:53 +02:00
7064ef5c17 minidom/examples: silence warning on unused property in struct
Signed-off-by: Maxime “pep” Buquet <pep@bouah.net>
2023-06-01 16:25:38 +02:00
xmppftw
aafe341b25 Agent is now Send (closes #64) 2023-06-01 12:00:59 +02:00
1870a83424 tokio-xmpp: cleaner outgoing debug logs
Signed-off-by: Maxime “pep” Buquet <pep@bouah.net>
2023-05-31 00:51:58 +02:00
5256575512 tokio-xmpp: Add debug prints for incoming packets
Signed-off-by: Maxime “pep” Buquet <pep@bouah.net>
2023-05-31 00:51:58 +02:00
e8a7d909c1 parsers: derive PartialEq on Iq too
Signed-off-by: Maxime “pep” Buquet <pep@bouah.net>
2023-05-30 19:04:33 +02:00
xmppftw
8d9288ffd7 Implement From<&Jid> for String (close #69) 2023-05-28 22:27:40 +02:00
xmppftw
ce255d9602 Jid (de)serialization now uses untagged representation (close #66) 2023-05-28 19:54:51 +02:00
8c18eeecd1 Bump version to 0.4.0
Signed-off-by: Maxime “pep” Buquet <pep@bouah.net>
2023-05-18 17:05:20 +02:00
943a0afe9d tokio-xmpp: Bump version to 3.3.0
Signed-off-by: Maxime “pep” Buquet <pep@bouah.net>
2023-05-18 17:05:20 +02:00
5d62fc25ae
xmpp: Update homepage url
Signed-off-by: Maxime “pep” Buquet <pep@bouah.net>
2023-05-18 16:30:03 +02:00
48d5e19e9d
xmpp: Update changelog
Signed-off-by: Maxime “pep” Buquet <pep@bouah.net>
2023-05-18 16:25:45 +02:00
663b73f676
xmpp: Remove more useless features
They can be added directly via tokio-xmpp

Signed-off-by: Maxime “pep” Buquet <pep@bouah.net>
2023-05-18 16:25:22 +02:00
ad5806a358
xmpp: ensure cargo fetches 3.x updates for tokio-xmpp
Signed-off-by: Maxime “pep” Buquet <pep@bouah.net>
2023-05-18 16:12:52 +02:00