xmpp: HTTP File Upload

Implement XEP-0363 HTTP File Upload in xmpp-rs.

The current interface is as is because of a limitation of our libraries.
It is not possible to await on an IQ to get a result, so we have to
workaround it by storing data on the Agent and fetching it back when we
get the result.

The client will have to first call `upload_file_with` and then listen on
Event::HttpUploadedFile, which are decoupled actions, instead of
awaiting on upload_file_with and getting the URL as a result directly.

`upload_file_with` doesn't yet find the upload service by itself for the
same reason as above.

Signed-off-by: Maxime “pep” Buquet <pep@bouah.net>
This commit is contained in:
Maxime “pep” Buquet 2021-12-27 00:48:37 +01:00
commit a59c618ed0
2 changed files with 66 additions and 2 deletions

View file

@ -17,8 +17,10 @@ edition = "2018"
tokio-xmpp = "3.0.0"
xmpp-parsers = "0.19"
futures = "0.3"
tokio = "1"
tokio = { version = "1", features = ["full"] }
log = "0.4"
reqwest = { version = "0.11.8", features = ["stream"] }
tokio-util = { version = "0.6.9", features = ["codec"] }
[dev-dependencies]
env_logger = "0.8"