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

@ -8,7 +8,6 @@ use std::collections::HashMap;
use std::path::{Path, PathBuf};
use std::sync::Arc;
use tokio::sync::RwLock;
use tokio_xmpp::connect::ServerConnector;
pub use tokio_xmpp::parsers;
use tokio_xmpp::parsers::{disco::DiscoInfoResult, message::MessageType};
pub use tokio_xmpp::{
@ -19,8 +18,8 @@ pub use tokio_xmpp::{
use crate::{event_loop, message, muc, upload, Error, Event, RoomNick};
pub struct Agent<C: ServerConnector> {
pub(crate) client: TokioXmppClient<C>,
pub struct Agent {
pub(crate) client: TokioXmppClient,
pub(crate) default_nick: Arc<RwLock<String>>,
pub(crate) lang: Arc<Vec<String>>,
pub(crate) disco: DiscoInfoResult,
@ -33,8 +32,8 @@ pub struct Agent<C: ServerConnector> {
pub(crate) rooms_leaving: HashMap<BareJid, String>,
}
impl<C: ServerConnector> Agent<C> {
pub async fn disconnect(&mut self) -> Result<(), Error> {
impl Agent {
pub async fn disconnect(self) -> Result<(), Error> {
self.client.send_end().await
}