diff --git a/parsers/src/bookmarks.rs b/parsers/src/bookmarks.rs index efcd1fc3..c79af6b3 100644 --- a/parsers/src/bookmarks.rs +++ b/parsers/src/bookmarks.rs @@ -23,27 +23,30 @@ use jid::BareJid; pub use crate::bookmarks2::Autojoin; use crate::ns; -generate_element!( - /// A conference bookmark. - Conference, "conference", BOOKMARKS, - attributes: [ - /// Whether a conference bookmark should be joined automatically. - autojoin: Default = "autojoin", +/// A conference bookmark. +#[derive(FromXml, AsXml, PartialEq, Debug, Clone)] +#[xml(namespace = ns::BOOKMARKS, name = "conference")] +pub struct Conference { + /// Whether a conference bookmark should be joined automatically. + #[xml(attribute(default))] + pub autojoin: Autojoin, - /// The JID of the conference. - jid: Required = "jid", + /// The JID of the conference. + #[xml(attribute)] + pub jid: BareJid, - /// A user-defined name for this conference. - name: Option = "name", - ], - children: [ - /// The nick the user will use to join this conference. - nick: Option = ("nick", BOOKMARKS) => String, + /// A user-defined name for this conference. + #[xml(attribute(default))] + pub name: Option, - /// The password required to join this conference. - password: Option = ("password", BOOKMARKS) => String - ] -); + /// The nick the user will use to join this conference. + #[xml(extract(default, fields(text(type_ = String))))] + pub nick: Option, + + /// The password required to join this conference. + #[xml(extract(default, fields(text(type_ = String))))] + pub password: Option, +} impl Conference { /// Turns a XEP-0048 Conference element into a XEP-0402 "Bookmarks2" Conference element, in a