aboutsummaryrefslogblamecommitdiffstats
path: root/src/stanza/client/presence.rs
blob: 46194f384f0762756be63afc77a2f46131b1f99f (plain) (tree)















































                                                 
use peanuts::element::{FromElement, IntoElement};

use crate::JID;

use super::error::Error;

pub struct Presence {
    from: Option<JID>,
    id: Option<String>,
    to: Option<JID>,
    r#type: PresenceType,
    lang: Option<String>,
    // children
    show: Option<Show>,
    status: Option<Status>,
    priority: Option<Priority>,
    errors: Vec<Error>,
    // ##other
    // content: Vec<Box<dyn AsElement>>,
}

pub enum PresenceType {
    Error,
    Probe,
    Subscribe,
    Subscribed,
    Unavailable,
    Unsubscribe,
    Unsubscribed,
}

pub enum Show {
    Away,
    Chat,
    Dnd,
    Xa,
}

pub struct Status {
    lang: Option<String>,
    status: String1024,
}

// minLength 1 maxLength 1024
pub struct String1024(String);

// xs:byte
pub struct Priority(u8);