Commit graph

1986 commits

Author SHA1 Message Date
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
fb63ac8e50 Update rxml to 0.10.0
See release notes [1] for details.

   [1]: https://codeberg.org/jssfr/rxml/releases/tag/v0.10.0
2024-03-16 17:39:55 +01:00
Werner Kroneman
65c91439f8 Used Element::append_text instead of append_text_node in TreeBuilder::process_text to prevent weird splitting of text when there is no element in between. 2024-03-10 10:46:30 +00:00
Werner Kroneman
f54776ca0a Added Element::append_text 2024-03-10 10:46:30 +00: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
Jonas Schäfer
e7fa6460f4 Update size tests
This seems to be related to an update of chrono. 32-bit sizes verified
using `cargo test --target i686-unknown-linux-gnu`.
2024-03-08 16:04:55 +01:00
Jonas Schäfer
2f7d5edb8a Make TryFrom<Element> chainable
This allows constructs like:

```rust
let residual = match Iq::try_from(stanza) {
  Ok(iq) => return handle_iq(..),
  Err(Error::TypeMismatch(_, _, v)) => v,
  Err(other) => return handle_parse_error(..),
};
let residual = match Message::try_from(stanza) {
  ..
};
let residual = ..
log::warn!("unhandled object: {:?}", residual);
```

The interesting part of this is that this could be used in a loop over a
Vec<Box<dyn FnMut(Element) -> ControlFlow<SomeResult, Element>>, i.e. in
a parsing loop for a generic XML/XMPP stream.

The advantage is that the stanza.is() check runs only once (in
check_self!) and doesn't need to be duplicated outside, and it reduces
the use of magic strings.
2024-03-03 14:50:29 +00:00
Jonas Schäfer
3b3a4ff0c8 Do not .clone() Element in code generated with generate_element
This should improve performance a little.
2024-03-03 15:05:11 +01:00
Jonas Schäfer
6f6f8abb53 Add fields for Result Set Management in disco#items
Note that this is a breaking change, as it changes the struct definition
and now requires additional fields when constructing the struct.
2024-03-03 14:54:30 +01:00
Emmanuel Gil Peyrot
1bab5c3cd9 Remove redundant imports
These became warnings in a recent nightly.

The TryFrom/TryInto imports were missed in
4089891f6c, but the rest are truly
redundant.
2024-02-27 22:57:18 +01:00
Emmanuel Gil Peyrot
6df8062867 Fix size tests on latest Rust release
Since Rust 1.76, and some much older nightly, there have been
improvements to the niche computation, which leads to smaller types
which can encode the same amount of data, variants, and such.

This fixes the tests on this compiler version.
2024-02-27 12:27:31 +01:00
Paul Fariello
1ecfaeb2bf Fix multiple error text lang handling in stanza_error 2024-02-27 08:53:19 +01:00
Werner Kroneman
87164b01ee Added xep-0264 to doap.xml 2024-02-08 16:07:41 +00:00
Werner Kroneman
78158edc3e Added jingle_thumbnails mod to lib.rs. 2024-02-08 16:07:41 +00:00
Werner Kroneman
611c09a8a2 Added jingle_thumbnails module. 2024-02-08 16:07:41 +00:00
Werner Kroneman
b541f8a809 Added ns::JINGLE_THUMBNAILS 2024-02-08 16:07:41 +00:00
famfo
b2ba646fd4 Implement empty before for QuerySet 2024-02-06 12:29:37 +01:00
99036735a3
xmpp: Rename ClientBuilder::new_with_server to new_with_connector
Signed-off-by: Maxime “pep” Buquet <pep@bouah.net>
2024-02-06 01:14:50 +01:00
famfo
a292e19314 Fix 32bit Qurey struct size 2024-02-05 22:19:22 +00:00
famfo
6daf0e906e Implement flip-page for MAM 2024-02-05 22:19:22 +00:00
099747f2e4 CONTRIBUTING: Split in categories
Signed-off-by: Maxime “pep” Buquet <pep@bouah.net>
2024-02-02 22:26:00 +01:00
xmpp ftw
2e0a90f447 CI: Deny future warnings
Signed-off-by: Maxime “pep” Buquet <pep@bouah.net>
2024-01-27 17:44:48 +00:00
xmpp ftw
9d5019ecdd Fix last cargo doc warnings
Signed-off-by: Maxime “pep” Buquet <pep@bouah.net>
2024-01-27 17:44:48 +00:00
famfo
28ab91f46a Add Sync to ServerConnectError 2024-01-27 17:26:07 +00:00
xmppftw
0949acb750 Update the MR docs base URL 2024-01-26 15:22:12 +01:00
xmppftw
b42b498a8b Parallel docs build ; don't doc deps ; push to docs.xmpp.rs 2024-01-25 17:24:20 +01:00
xmppftw
818a87802f Post comment to MR target not MR source project 2024-01-24 23:18:05 +01:00
xmppftw
5bf2ef12eb Generate docs on commits / MRs, upload to Gitlab Pages and post link in comment 2024-01-23 21:21:54 +01:00
famfo
060088be29 Implement function to get stream features 2024-01-23 16:09:07 +01:00
45c19690a8
README: Mention new CoC
Signed-off-by: Maxime “pep” Buquet <pep@bouah.net>
2024-01-22 15:20:50 +01:00
cad2e152cb
Code of Conduct
Heavily based on JoinJabber.org's CoC.

Signed-off-by: Maxime “pep” Buquet <pep@bouah.net>
2024-01-21 21:50:31 +01:00
xmppftw@kl.netlib.re
1ce8145a7d Fix unused variable warnings when avatars disabled 2024-01-21 13:55:39 +01:00
xmppftw@kl.netlib.re
25274e2f11 Deny warnings in github/gitea/forgejo CI and act local runner 2024-01-21 13:55:39 +01:00
xmppftw@kl.netlib.re
7fc46968be Deny warnings in gitlab CI 2024-01-21 13:55:39 +01:00
xmppftw@kl.netlib.re
a6f4600a19 Reexport hashes from parsers 2024-01-16 15:18:26 +01:00
Werner Kroneman
83d0d1bdfd Updated doap.xml for vCard avatars 2024-01-10 23:34:52 +01:00
Werner Kroneman
10b204093e Added vCard update to parsers 2024-01-10 23:34:50 +01:00
Werner Kroneman
c0cf672131 Added vCard avatars (XEP-0054) to parsers. 2024-01-10 21:50:34 +01:00
Werner Kroneman
18cb6f6e2d Refactored the "helpers" so that they use a common Codec trait; this makes them composable as well. 2024-01-10 19:49:53 +00:00
Werner Kroneman
e36b8d4fb9 Exposed bound_jid on Agent. 2024-01-10 17:12:59 +01:00
Emmanuel Gil Peyrot
3f90e84c5b xmpp-parsers: Add a hexadecimal codec
That one accepts both uppercase and lowercase hexadecimal input, and
outputs in lowercase.

It requires no separator between bytes, unlike ColonSeparatedHex.
2024-01-05 17:36:43 +01:00
moparisthebest
54de8d9951
Fix building xmpp with no-default-features 2024-01-03 20:01:05 -05:00
moparisthebest
019450ff4b
Add disabled-by-default insecure-tcp feature to tokio-xmpp for use by component connections 2024-01-03 19:34:03 -05:00