diff --git a/tokio-xmpp/src/client/mod.rs b/tokio-xmpp/src/client/mod.rs index b774b803..29e83964 100644 --- a/tokio-xmpp/src/client/mod.rs +++ b/tokio-xmpp/src/client/mod.rs @@ -193,7 +193,10 @@ impl Stream for Client { Poll::Ready(Ok(Ok(stream))) => { let bound_jid = stream.jid.clone(); self.state = ClientState::Connected(stream); - Poll::Ready(Some(Event::Online(bound_jid))) + Poll::Ready(Some(Event::Online { + bound_jid, + resumed: false, + })) } Poll::Ready(Ok(Err(e))) => { self.state = ClientState::Disconnected; diff --git a/tokio-xmpp/src/event.rs b/tokio-xmpp/src/event.rs index db9f4059..2550f593 100644 --- a/tokio-xmpp/src/event.rs +++ b/tokio-xmpp/src/event.rs @@ -5,7 +5,18 @@ use xmpp_parsers::{Element, Jid}; #[derive(Debug)] pub enum Event { /// Stream is connected and initialized - Online(Jid), + Online { + /// Server-set Jabber-Id for your session + /// + /// This may turn out to be a different JID resource than + /// expected, so use this one instead of the JID with which + /// the connection was setup. + bound_jid: Jid, + /// Was this session resumed? + /// + /// Not yet implemented for the Client + resumed: bool, + }, /// Stream end Disconnected(Error), /// Received stanza/nonza @@ -16,7 +27,7 @@ impl Event { /// `Online` event? pub fn is_online(&self) -> bool { match *self { - Event::Online(_) => true, + Event::Online { .. } => true, _ => false, } } @@ -24,7 +35,7 @@ impl Event { /// Get the server-assigned JID for the `Online` event pub fn get_jid(&self) -> Option<&Jid> { match *self { - Event::Online(ref jid) => Some(jid), + Event::Online { ref bound_jid, .. } => Some(bound_jid), _ => None, } }