client: use stanzastream!

This commit is contained in:
Jonas Schäfer 2024-08-20 16:54:48 +02:00
commit 35ce86243f
29 changed files with 238 additions and 565 deletions

View file

@ -10,7 +10,6 @@ use reqwest::{
use std::path::PathBuf;
use tokio::fs::File;
use tokio_util::codec::{BytesCodec, FramedRead};
use tokio_xmpp::connect::ServerConnector;
use tokio_xmpp::{
jid::Jid,
minidom::Element,
@ -19,11 +18,11 @@ use tokio_xmpp::{
use crate::{Agent, Event};
pub async fn handle_upload_result<C: ServerConnector>(
pub async fn handle_upload_result(
from: &Jid,
iqid: String,
elem: Element,
agent: &mut Agent<C>,
agent: &mut Agent,
) -> impl IntoIterator<Item = Event> {
let mut res: Option<(usize, PathBuf)> = None;

View file

@ -6,7 +6,6 @@
use std::path::Path;
use tokio::fs::File;
use tokio_xmpp::connect::ServerConnector;
use tokio_xmpp::{
jid::Jid,
parsers::{http_upload::SlotRequest, iq::Iq},
@ -14,11 +13,7 @@ use tokio_xmpp::{
use crate::Agent;
pub async fn upload_file_with<C: ServerConnector>(
agent: &mut Agent<C>,
service: &str,
path: &Path,
) {
pub async fn upload_file_with(agent: &mut Agent, service: &str, path: &Path) {
let name = path.file_name().unwrap().to_str().unwrap().to_string();
let file = File::open(path).await.unwrap();
let size = file.metadata().await.unwrap().len();