xmpp-parsers: Convert vcard to xso
This commit is contained in:
parent
dc0db38cf3
commit
a2ece705cc
1 changed files with 13 additions and 10 deletions
|
|
@ -13,11 +13,14 @@
|
||||||
//! For vCard updates defined in [XEP-0153](https://xmpp.org/extensions/xep-0153.html),
|
//! For vCard updates defined in [XEP-0153](https://xmpp.org/extensions/xep-0153.html),
|
||||||
//! see [`vcard_update`][crate::vcard_update] module.
|
//! see [`vcard_update`][crate::vcard_update] module.
|
||||||
|
|
||||||
use xso::{error::Error, AsXml, FromXml};
|
use xso::{
|
||||||
|
error::Error,
|
||||||
|
text::{Base64, StripWhitespace},
|
||||||
|
AsXml, FromXml,
|
||||||
|
};
|
||||||
|
|
||||||
use crate::iq::{IqGetPayload, IqResultPayload, IqSetPayload};
|
use crate::iq::{IqGetPayload, IqResultPayload, IqSetPayload};
|
||||||
use crate::ns;
|
use crate::ns;
|
||||||
use crate::util::text_node_codecs::{Codec, WhitespaceAwareBase64};
|
|
||||||
use minidom::Element;
|
use minidom::Element;
|
||||||
|
|
||||||
generate_element!(
|
generate_element!(
|
||||||
|
|
@ -41,14 +44,14 @@ pub struct Type {
|
||||||
pub data: String,
|
pub data: String,
|
||||||
}
|
}
|
||||||
|
|
||||||
generate_element!(
|
|
||||||
/// The binary data of the photo.
|
/// The binary data of the photo.
|
||||||
Binval, "BINVAL", VCARD,
|
#[derive(FromXml, AsXml, PartialEq, Debug, Clone)]
|
||||||
text: (
|
#[xml(namespace = ns::VCARD, name = "BINVAL")]
|
||||||
|
pub struct Binval {
|
||||||
/// The actual data.
|
/// The actual data.
|
||||||
data: WhitespaceAwareBase64
|
#[xml(text(codec = Base64<StripWhitespace>))]
|
||||||
)
|
pub data: Vec<u8>,
|
||||||
);
|
}
|
||||||
|
|
||||||
/// A `<vCard>` element; only the `<PHOTO>` element is supported for this legacy vCard ; the rest is ignored.
|
/// A `<vCard>` element; only the `<PHOTO>` element is supported for this legacy vCard ; the rest is ignored.
|
||||||
pub struct VCard {
|
pub struct VCard {
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue