aboutsummaryrefslogtreecommitdiffstats
path: root/stanza/src/xep_0060/event.rs
diff options
context:
space:
mode:
Diffstat (limited to 'stanza/src/xep_0060/event.rs')
-rw-r--r--stanza/src/xep_0060/event.rs28
1 files changed, 23 insertions, 5 deletions
diff --git a/stanza/src/xep_0060/event.rs b/stanza/src/xep_0060/event.rs
index d2c150a..1be011d 100644
--- a/stanza/src/xep_0060/event.rs
+++ b/stanza/src/xep_0060/event.rs
@@ -8,6 +8,8 @@ use peanuts::{
};
use crate::xep_0004::X;
+#[cfg(feature = "xep_0084")]
+use crate::xep_0084;
#[cfg(feature = "xep_0172")]
use crate::xep_0172::{self, Nick};
@@ -219,8 +221,8 @@ impl IntoElement for Delete {
#[derive(Clone, Debug)]
pub struct Items {
- node: String,
- items: ItemsType,
+ pub node: String,
+ pub items: ItemsType,
}
impl FromElement for Items {
@@ -260,9 +262,9 @@ pub enum ItemsType {
#[derive(Clone, Debug)]
pub struct Item {
- id: Option<String>,
- publisher: Option<String>,
- item: Option<Content>,
+ pub id: Option<String>,
+ pub publisher: Option<String>,
+ pub item: Option<Content>,
}
impl FromElement for Item {
@@ -296,6 +298,10 @@ impl IntoElement for Item {
pub enum Content {
#[cfg(feature = "xep_0172")]
Nick(Nick),
+ #[cfg(feature = "xep_0084")]
+ AvatarData(xep_0084::Data),
+ #[cfg(feature = "xep_0084")]
+ AvatarMetadata(xep_0084::Metadata),
Unknown(Element),
}
@@ -304,6 +310,14 @@ impl FromElement for Content {
match element.identify() {
#[cfg(feature = "xep_0172")]
(Some(xep_0172::XMLNS), "nick") => Ok(Content::Nick(Nick::from_element(element)?)),
+ #[cfg(feature = "xep_0084")]
+ (Some(xep_0084::data::XMLNS), "data") => {
+ Ok(Content::AvatarData(xep_0084::Data::from_element(element)?))
+ }
+ #[cfg(feature = "xep_0084")]
+ (Some(xep_0084::metadata::XMLNS), "metadata") => Ok(Content::AvatarMetadata(
+ xep_0084::Metadata::from_element(element)?,
+ )),
_ => Ok(Self::Unknown(element)),
}
}
@@ -314,6 +328,10 @@ impl IntoElement for Content {
match self {
#[cfg(feature = "xep_0172")]
Content::Nick(nick) => nick.builder(),
+ #[cfg(feature = "xep_0084")]
+ Content::AvatarData(data) => data.builder(),
+ #[cfg(feature = "xep_0084")]
+ Content::AvatarMetadata(metadata) => metadata.builder(),
Content::Unknown(_e) => panic!("unknown content cannot be serialized"),
}
}