xmpp: new 'escape-hatch' feature

Signed-off-by: Maxime “pep” Buquet <pep@bouah.net>
This commit is contained in:
Maxime “pep” Buquet 2025-04-20 15:16:17 +02:00 committed by pep
commit 477af3c895
3 changed files with 13 additions and 0 deletions

View file

@ -7,6 +7,8 @@
use alloc::sync::Arc;
use std::collections::HashMap;
use std::path::{Path, PathBuf};
#[cfg(feature = "escape-hatch")]
use tokio::io;
use tokio::sync::RwLock;
use crate::{
@ -17,6 +19,8 @@ use crate::{
upload, Error, Event, RoomNick,
};
use tokio_xmpp::Client as TokioXmppClient;
#[cfg(feature = "escape-hatch")]
use tokio_xmpp::{stanzastream::StanzaToken, Stanza};
pub struct Agent {
pub(crate) client: TokioXmppClient,
@ -58,6 +62,11 @@ impl Agent {
self.client.send_end().await
}
#[cfg(feature = "escape-hatch")]
pub async fn send_stanza<S: Into<Stanza>>(&mut self, st: S) -> Result<StanzaToken, io::Error> {
self.client.send_stanza(st.into()).await
}
pub async fn join_room<'a>(&mut self, settings: muc::room::JoinRoomSettings<'a>) {
muc::room::join_room(self, settings).await
}