add jid to Event::Online

breaks the API
This commit is contained in:
Astro 2019-10-15 22:02:14 +02:00
commit 9a5c95694b
4 changed files with 18 additions and 6 deletions

View file

@ -1,10 +1,10 @@
use xmpp_parsers::Element;
use xmpp_parsers::{Element, Jid};
/// High-level event on the Stream implemented by Client and Component
#[derive(Debug)]
pub enum Event {
/// Stream is connected and initialized
Online,
Online(Jid),
/// Stream end
Disconnected,
/// Received stanza/nonza
@ -15,11 +15,19 @@ impl Event {
/// `Online` event?
pub fn is_online(&self) -> bool {
match *self {
Event::Online => true,
Event::Online(_) => true,
_ => false,
}
}
/// Get the server-assigned JID for the `Online` event
pub fn get_jid(&self) -> Option<&Jid> {
match *self {
Event::Online(ref jid) => Some(jid),
_ => None,
}
}
/// `Stanza` event?
pub fn is_stanza(&self, name: &str) -> bool {
match *self {