Commit graph

42 commits

Author SHA1 Message Date
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
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
famfo
060088be29 Implement function to get stream features 2024-01-23 16:09:07 +01:00
moparisthebest
733d005f51
DNS/TLS deps are now optional, component now also uses ServerConnector 2024-01-01 02:09:41 -05:00
moparisthebest
e784b15402
ServerConnector and AsyncClient support channel binding, SimpleClient uses ServerConnector 2024-01-01 02:08:40 -05:00
moparisthebest
3cab603a4c
Add AsyncServerConnector to AsyncClient to be able to support any stream
Unfortunately API breaking unless we do some export mangling
2024-01-01 02:08:13 -05:00
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
Emmanuel Gil Peyrot
faabc2984a tokio-xmpp: Support channel binding on TLS 1.3
This is defined in RFC 9266, and relies on the Exported Keying Material
to be passed to the SASL implementation.
2023-10-25 20:03:11 +02:00
Emmanuel Gil Peyrot
c56dbe8903 tokio-xmpp: Remove unneeded clones 2023-10-25 00:16:28 +02:00
a16f670ee6 tokio-xmpp: Error out when both tls-native and tls-rust features are enabled
If the user enables the tls-rust feature and forgets to disable
default-features (which includes tls-native), tell them and bail out.

The code was made to work anyway when both are enabled, and here it
defaults to tls-native. It does seem better to have one explicitely
choose one though hence the compile_error! message.

Signed-off-by: Maxime “pep” Buquet <pep@bouah.net>
2023-10-24 16:51:08 +00:00
Guus der Kinderen
fc16b7919b fix: typo in AsyncConfig comment 2023-10-10 19:15:55 +02:00
xmppftw
4266368a98 JIDs now have typed and stringy methods for node/domain/resource access
Jid now has typed with_resource and stringy with_resource_str
Jid now has is_full, is_bare
2023-06-21 18:30:25 +02:00
Emmanuel Gil Peyrot
6ccc5ccace tokio-xmpp: Poll packets in a loop
This needs to be a loop in order to ignore packets we don’t care about,
or those we want to handle elsewhere.  Returning something isn’t correct
in those two cases because it would signal to tokio that the XMPPStream
is also done, while there could be additional packets waiting for us.

The proper solution is thus a loop which we exit once we have something
to return.

Fixes a deadlock when we ignore some packets.
2023-06-21 11:55:42 +00: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
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
209bab1441 tokio_xmpp::AsyncClient and xmpp::Agent take a fully parsed Jid (#72) 2023-06-01 16:55:53 +02:00
Paul Fariello
88ab74c92f Set tokio_xmpp::client::async_client::Config as public 2023-05-17 16:56:42 +00:00
Astro
d4a5a8247b minidom, tokio-xmpp: switch xml parsing to rxml 2022-04-19 20:42:30 +02:00
Astro
3901068717 tokio-xmpp: remove LocalSet from AsyncClient, making it Sync 2022-04-19 17:44:48 +02:00
moparisthebest
6fc016c006 Add into_inner() to tokio_xmpp::SimpleClient 2021-03-24 02:26:04 -04:00
Paul Fariello
ae52f6444d Add support for both rustls and tlsnative 2021-02-18 02:38:32 +00:00
Paul Fariello
5463a0aa99 Srv entry is no longer optional when using connect_with_srv 2021-01-12 23:17:34 +01:00
Paul Fariello
7b4a6e3ace Use ServerConfig enum for tokio-xmpp client config
And expose connect_to_host from happy_eyeballs to let clients explicitly
choose to use SRV or not. (Rename connect to connect_with_srv)
2021-01-12 23:17:34 +01:00
Paul Fariello
08e58e44b1 Fmt for tokio-xmpp Client initialisation 2021-01-12 23:17:34 +01:00
Paul Fariello
fb1b4cdbbc Use a Config struct for async_client 2021-01-12 23:17:34 +01:00
Paul Fariello
c6376e1d28 Add server and port to connect_with_jid method on async_client 2021-01-12 23:17:34 +01:00
Emmanuel Gil Peyrot
521bf6e7d7 tokio-xmpp: Bump sasl to 0.5 2021-01-12 19:26:21 +01:00
Emmanuel Gil Peyrot
a38ff39b77 tokio-xmpp: Bump tokio to 1.0 and replace tokio-tls with tokio-native-tls 2020-12-30 03:14:21 +01:00
Emmanuel Gil Peyrot
e1ff9da681 tokio-xmpp: Remove workaround for unknown broken server
This is so we can find and fix the server, instead of cargo culting this
workaround forever.
2020-12-26 16:25:34 +01:00
Astro
e501addb96 tokio-xmpp: use xmpp_parsers::ns everywhere 2020-05-30 01:25:06 +02:00
Astro
1e1f593233 tokio-xmpp: rustfmt 2020-05-30 00:45:22 +02:00
Astro
537b4825a8 tokio-xmpp: rename Client to AsyncClient 2020-05-30 00:43:53 +02:00
Astro
eb13634571 tokio-xmpp: rename OneshotClient to SimpleClient 2020-05-30 00:43:48 +02:00
Astro
2cd1ad217b tokio-xmpp: add onshot_client 2020-05-30 00:43:48 +02:00
Astro
c13712b158 tokio-xmpp client: condense fn connect(), refactor out into stream_features 2020-05-30 00:43:35 +02:00
Astro
4d24e6bebb tokio-xmpp: name Event::Online fields, add resumed flag 2020-05-29 18:21:31 +02:00
Astro
a4325c787a tokio-xmpp: doc 2020-03-16 00:34:46 +01:00
Astro
23cb34e026 tokio-xmpp: rewrite for futures-0.3 2020-03-06 18:01:31 +01:00
44eaa5a6ea tokio-xmpp: Prevent XmppCodec from producing invalid stanza
This bug was introduced by 2e97f4de2e, to
fix another bug where the parser would choke on whitespace.

The bug would manifest whenever a stanza was sent in different parts,
for example:
<< "<message "
<< "type='chat><body>foo</body></message>"

Would produce the following once parsed:
`<messagetype='chat'><body>foo</body></messagetype='chat'>`

This commit ensures this doesn't happen anymore (by not trimming
whitespaces before feeding the parser), and also ensures that
whitespaces are now handled at the correct layer.

The removal of xmpp_codec::test_lone_whitespace only happens because I'm
not sure if it's supposed to be here anymore. Maybe it should be at a
different layer? Or written differently?

Signed-off-by: Maxime “pep” Buquet <pep@bouah.net>
2020-01-22 01:25:15 +01:00
a104ebc3f6
Rustfmt pass, and rustfmt --check in CI"
Signed-off-by: Maxime “pep” Buquet <pep@bouah.net>
2019-10-23 01:36:02 +02:00
34aa710366
Prepare for merge: Move all tokio-xmpp files into tokio-xmpp/
Signed-off-by: Maxime “pep” Buquet <pep@bouah.net>
2019-10-18 14:16:01 +02:00