Skip to content

Commit 3e794d3

Browse files
Ppjet6linkmauve
authored andcommitted
xmpp: extend escape-hatch feature to the receiving part
Signed-off-by: Maxime “pep” Buquet <[email protected]>
1 parent fbdd5f7 commit 3e794d3

File tree

3 files changed

+7
-1
lines changed

3 files changed

+7
-1
lines changed

xmpp/ChangeLog

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,8 @@ XXXX-YY-ZZ [ RELEASER <admin@localhost> ]
3939
hibernating resources around.
4040
- New 'escape-hatch' feature: Allow sending tokio_xmpp::Stanza directly
4141
instead of having to go through xmpp-rs' API when it's lacking. This
42-
is meant to stay behind a feature.
42+
is meant to stay behind a feature. Also allows directly receiving
43+
TokioXmppEvent.
4344
- Added documentation on `Event` enum.
4445
* Fixes:
4546
- Use tokio::sync::RwLock not std::sync::RwLock (!432)

xmpp/src/event.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -112,4 +112,6 @@ pub enum Event {
112112
ServiceMessage(Option<MessageId>, BareJid, String, StanzaTimeInfo),
113113
/// A file has been uploaded over HTTP; contains the URL of the file.
114114
HttpUploadedFile(String),
115+
#[cfg(feature = "escape-hatch")]
116+
TokioXmppEvent(TokioXmppEvent),
115117
}

xmpp/src/event_loop.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,9 @@ pub async fn wait_for_events(agent: &mut Agent) -> Vec<Event> {
1717
if let Some(event) = agent.client.next().await {
1818
let mut events = Vec::new();
1919

20+
#[cfg(feature = "escape-hatch")]
21+
events.push(Event::TokioXmppEvent(event.clone()));
22+
2023
match event {
2124
TokioXmppEvent::Online { resumed: false, .. } => {
2225
let presence =

0 commit comments

Comments
 (0)