diff --git a/xmpp/ChangeLog b/xmpp/ChangeLog index 1a7c673e..a479ac31 100644 --- a/xmpp/ChangeLog +++ b/xmpp/ChangeLog @@ -39,7 +39,8 @@ XXXX-YY-ZZ [ RELEASER ] hibernating resources around. - New 'escape-hatch' feature: Allow sending tokio_xmpp::Stanza directly instead of having to go through xmpp-rs' API when it's lacking. This - is meant to stay behind a feature. + is meant to stay behind a feature. Also allows directly receiving + TokioXmppEvent. - Added documentation on `Event` enum. * Fixes: - Use tokio::sync::RwLock not std::sync::RwLock (!432) diff --git a/xmpp/src/event.rs b/xmpp/src/event.rs index 53edf226..32f5db22 100644 --- a/xmpp/src/event.rs +++ b/xmpp/src/event.rs @@ -112,4 +112,6 @@ pub enum Event { ServiceMessage(Option, BareJid, String, StanzaTimeInfo), /// A file has been uploaded over HTTP; contains the URL of the file. HttpUploadedFile(String), + #[cfg(feature = "escape-hatch")] + TokioXmppEvent(TokioXmppEvent), } diff --git a/xmpp/src/event_loop.rs b/xmpp/src/event_loop.rs index 86a97776..cced3ab2 100644 --- a/xmpp/src/event_loop.rs +++ b/xmpp/src/event_loop.rs @@ -17,6 +17,9 @@ pub async fn wait_for_events(agent: &mut Agent) -> Vec { if let Some(event) = agent.client.next().await { let mut events = Vec::new(); + #[cfg(feature = "escape-hatch")] + events.push(Event::TokioXmppEvent(event.clone())); + match event { TokioXmppEvent::Online { resumed: false, .. } => { let presence =