Commit graph

2152 commits

Author SHA1 Message Date
Jonas Schäfer
675907ba20 pubsub: provide accessor function for event's source node's name
Some checks are pending
Build / lint (push) Waiting to run
Build / test-stable (push) Blocked by required conditions
Build / test-nightly (push) Blocked by required conditions
Handy if you want to prefilter or distribute events based on the source
node's name.
2024-05-13 17:16:57 +00:00
Lucas Kent
1449d300dd Fix clippy lints for sasl crate
Some checks are pending
Build / lint (push) Waiting to run
Build / test-stable (push) Blocked by required conditions
Build / test-nightly (push) Blocked by required conditions
2024-05-13 16:03:48 +00:00
Lucas Kent
f4c3238798 Swap sasl crate from sha-1 crate -> sha1 crate
sha-1 has been deprecated in favor of sha1 and has an identical API.
2024-05-13 13:03:33 +10:00
Jonas Schäfer
384b366f5f Add Message::extract_payload function
This should simplify access to message payloads significantly.
2024-05-06 09:40:08 +00:00
Lucas Kent
a291ab2e83 Remove an allocation in client::mechanisms::scram::Scram::initial 2024-05-06 08:25:24 +10:00
Emmanuel Gil Peyrot
f725994fe0 Bump all dependencies but rustls and webpki-roots
The latter have changed their API a bit, while everything else is still
compatible.
2024-05-04 12:42: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
fcadccfbab parsers::vcard: allow linebreaks in binval data
[RFC 2426][1] says:

> The binary data MUST be encoded using the "B" encoding format.
> Long lines of encoded binary data SHOULD BE folded to 75 characters
> using the folding method defined in [MIME-DIR].

That implies that whitespace may occur in binval data and we thus must
be able to parse this correctly.

   [1]: https://datatracker.ietf.org/doc/html/rfc2426#section-2.4.1
2024-05-04 10:02:53 +00:00
Astro
6c3081d656 tokio-xmpp: let happy_eyeballs connect to records in parallel 2024-05-02 22:24:54 +02:00
Astro
598ffdbecf tokio-xmpp: set resolve ip_strategy to Ipv4AndIpv6
The happy_eyeballs implementation should try to connect on both address
families. The default of Ipv4thenIpv6 wouldn't query for AAAA if it got
A.
2024-05-02 22:24:54 +02:00
Jonas Schäfer
37481fb8f6 parsers: do not do extensive XEP-0030 validation with disable-validation
Other additional checks are already gated by the absence of this
feature. As the MR to remove these checks altogether is still blocked,
this should serve as at least as an intermediate solution to anyone
affected by buggy remote implementations.
2024-04-28 10:48:35 +02:00
Jonas Schäfer
0298caf97a tokio-xmpp: allow docs build with --all-features
This affects only the docs and is quite an ugly hack, but seems to be
the only way for now.
2024-04-23 19:22:04 +02:00
Jonas Schäfer
b648b4668b Fix broken build with tls-native feature 2024-04-23 19:22:04 +02:00
Jonas Schäfer
e53fa6c50c Emit feature flag tags in CI doc build, too
This doesn't do anything useful yet, because we can't build with
--all-features because of the conflicting rustls/openssl features...
2024-04-23 19:22:04 +02:00
Jonas Schäfer
13be111de1 sasl: make docs.rs emit nice feature tags on feature-gated items 2024-04-23 19:22:04 +02: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
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
Some checks failed
Build / lint (push) Has been cancelled
Build / test-stable (push) Has been cancelled
Build / test-nightly (push) Has been cancelled
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