xmpp: Stop proxying tokio-xmpp event in escape-hatch, add our own variants
Maxime “pep” Buquet
created
This was causing issues with Clone-ing tokio-xmpp Event-s as they
include Error-s which are typically not Clone-able. Event and Stanza
aren't Clone-able either so might as well do our own stuff here.
Signed-off-by: Maxime “pep” Buquet <pep@bouah.net>
@@ -40,7 +40,7 @@ XXXX-YY-ZZ [ RELEASER <admin@localhost> ]
- 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. Also allows directly receiving
- TokioXmppEvent.
+ stanzas.
- Added documentation on `Event` enum.
* Fixes:
- Use tokio::sync::RwLock not std::sync::RwLock (!432)
@@ -8,6 +8,8 @@ use tokio_xmpp::jid::BareJid;
#[cfg(feature = "avatars")]
use tokio_xmpp::jid::Jid;
use tokio_xmpp::parsers::roster::Item as RosterItem;
+#[cfg(feature = "escape-hatch")]
+use tokio_xmpp::parsers::{iq::Iq, message::Message, presence::Presence};
use crate::parsers::confirm::Confirm;
use crate::{delay::StanzaTimeInfo, Error, MessageId, RoomNick};
@@ -113,5 +115,15 @@ pub enum Event {
/// A file has been uploaded over HTTP; contains the URL of the file.
HttpUploadedFile(String),
#[cfg(feature = "escape-hatch")]
- TokioXmppEvent(TokioXmppEvent),
+ /// Variant only available when the "escape-hatch" feature is enabled. Proxies an Iq received
+ /// as a tokio-xmpp event.
+ Iq(Iq),
+ #[cfg(feature = "escape-hatch")]
+ /// Variant only available when the "escape-hatch" feature is enabled. Proxies a Message
+ /// received as a tokio-xmpp event.
+ Message(Message),
+ #[cfg(feature = "escape-hatch")]
+ /// Variant only available when the "escape-hatch" feature is enabled. Proxies a Presence
+ /// received as a tokio-xmpp event.
+ Presence(Presence),
}