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 super::Agent;
use crate::Event;
use std::fs::{self, File};
use std::io::{self, Write};
use tokio_xmpp::connect::ServerConnector;
use tokio_xmpp::parsers::{
avatar::{Data, Metadata},
iq::Iq,
@ -21,9 +20,9 @@ use tokio_xmpp::parsers::{
},
};
pub(crate) async fn handle_metadata_pubsub_event<C: ServerConnector>(
pub(crate) async fn handle_metadata_pubsub_event(
from: &Jid,
agent: &mut Agent<C>,
agent: &mut Agent,
items: Vec<Item>,
) -> Vec<Event> {
let mut events = Vec::new();

View file

@ -11,7 +11,6 @@ use crate::{
};
use std::str::FromStr;
use tokio_xmpp::{
connect::ServerConnector,
jid::{BareJid, Jid},
minidom::Element,
parsers::{
@ -23,10 +22,10 @@ use tokio_xmpp::{
#[cfg(feature = "avatars")]
pub(crate) mod avatar;
pub(crate) async fn handle_event<C: ServerConnector>(
pub(crate) async fn handle_event(
#[cfg_attr(not(feature = "avatars"), allow(unused_variables))] from: &Jid,
elem: Element,
#[cfg_attr(not(feature = "avatars"), allow(unused_variables))] agent: &mut Agent<C>,
#[cfg_attr(not(feature = "avatars"), allow(unused_variables))] agent: &mut Agent,
) -> Vec<Event> {
// We allow the useless mut warning for no-default-features,
// since for now only avatars pushes events here.
@ -101,10 +100,10 @@ pub(crate) async fn handle_event<C: ServerConnector>(
events
}
pub(crate) async fn handle_iq_result<C: ServerConnector>(
pub(crate) async fn handle_iq_result(
#[cfg_attr(not(feature = "avatars"), allow(unused_variables))] from: &Jid,
elem: Element,
agent: &mut Agent<C>,
agent: &mut Agent,
) -> impl IntoIterator<Item = Event> {
// We allow the useless mut warning for no-default-features,
// since for now only avatars pushes events here.