Port everything over to AsXml

This commit is contained in:
Jonas Schäfer 2024-07-09 17:01:42 +02:00
commit ccf38cdf9b
64 changed files with 848 additions and 371 deletions

View file

@ -5,7 +5,7 @@
// License, v. 2.0. If a copy of the MPL was not distributed with this
// file, You can obtain one at http://mozilla.org/MPL/2.0/.
use xso::{FromXml, IntoXml};
use xso::{AsXml, FromXml};
use crate::data_forms::DataForm;
use crate::iq::{IqGetPayload, IqResultPayload, IqSetPayload};
@ -29,7 +29,7 @@ generate_element!(
);
/// An affiliation element.
#[derive(FromXml, IntoXml, PartialEq, Debug, Clone)]
#[derive(FromXml, AsXml, PartialEq, Debug, Clone)]
#[xml(namespace = ns::PUBSUB_OWNER, name = "affiliation")]
pub struct Affiliation {
/// The node this affiliation pertains to.
@ -77,7 +77,7 @@ generate_element!(
);
/// A redirect element.
#[derive(FromXml, IntoXml, PartialEq, Debug, Clone)]
#[derive(FromXml, AsXml, PartialEq, Debug, Clone)]
#[xml(namespace = ns::PUBSUB_OWNER, name = "redirect")]
pub struct Redirect {
/// The node this node will be redirected to.
@ -86,7 +86,7 @@ pub struct Redirect {
}
/// Request to clear a node.
#[derive(FromXml, IntoXml, PartialEq, Debug, Clone)]
#[derive(FromXml, AsXml, PartialEq, Debug, Clone)]
#[xml(namespace = ns::PUBSUB_OWNER, name = "purge")]
pub struct Purge {
/// The node to be cleared.
@ -108,7 +108,7 @@ generate_element!(
);
/// A subscription element, describing the state of a subscription.
#[derive(FromXml, IntoXml, PartialEq, Debug, Clone)]
#[derive(FromXml, AsXml, PartialEq, Debug, Clone)]
#[xml(namespace = ns::PUBSUB_OWNER, name = "subscription")]
pub struct SubscriptionElem {
/// The JID affected by this subscription.

View file

@ -6,7 +6,7 @@
use xso::{
error::{Error, FromElementError},
FromXml, IntoXml,
AsXml, FromXml,
};
use crate::data_forms::DataForm;
@ -34,7 +34,7 @@ generate_element!(
);
/// An affiliation element.
#[derive(FromXml, IntoXml, PartialEq, Debug, Clone)]
#[derive(FromXml, AsXml, PartialEq, Debug, Clone)]
#[xml(namespace = ns::PUBSUB, name = "affiliation")]
pub struct Affiliation {
/// The node this affiliation pertains to.
@ -56,7 +56,7 @@ generate_element!(
);
/// Request to create a new node.
#[derive(FromXml, IntoXml, PartialEq, Debug, Clone)]
#[derive(FromXml, AsXml, PartialEq, Debug, Clone)]
#[xml(namespace = ns::PUBSUB, name = "create")]
pub struct Create {
/// The node name to create, if `None` the service will generate one.
@ -222,7 +222,7 @@ impl From<SubscribeOptions> for Element {
}
/// A request to subscribe a JID to a node.
#[derive(FromXml, IntoXml, Debug, PartialEq, Clone)]
#[derive(FromXml, AsXml, Debug, PartialEq, Clone)]
#[xml(namespace = ns::PUBSUB, name = "subscribe")]
pub struct Subscribe {
/// The JID being subscribed.
@ -270,7 +270,7 @@ generate_element!(
);
/// An unsubscribe request.
#[derive(FromXml, IntoXml, Debug, PartialEq, Clone)]
#[derive(FromXml, AsXml, Debug, PartialEq, Clone)]
#[xml(namespace = ns::PUBSUB, name = "unsubscribe")]
pub struct Unsubscribe {
/// The JID affected by this request.