xmpp-parsers: Convert sm’s Enable and Enabled to xso
This commit is contained in:
parent
01a61c6099
commit
1a7dec6f1e
1 changed files with 31 additions and 28 deletions
|
@ -32,19 +32,19 @@ generate_attribute!(
|
|||
bool
|
||||
);
|
||||
|
||||
generate_element!(
|
||||
/// Client request for enabling stream management.
|
||||
#[derive(Default)]
|
||||
Enable, "enable", SM,
|
||||
attributes: [
|
||||
#[derive(FromXml, AsXml, PartialEq, Debug, Clone, Default)]
|
||||
#[xml(namespace = ns::SM, name = "enable")]
|
||||
pub struct Enable {
|
||||
/// The preferred resumption time in seconds by the client.
|
||||
// TODO: should be the infinite integer set ≥ 1.
|
||||
max: Option<u32> = "max",
|
||||
#[xml(attribute(default))]
|
||||
pub max: Option<u32>,
|
||||
|
||||
/// Whether the client wants to be allowed to resume the stream.
|
||||
resume: Default<ResumeAttr> = "resume",
|
||||
]
|
||||
);
|
||||
#[xml(attribute(default))]
|
||||
pub resume: ResumeAttr,
|
||||
}
|
||||
|
||||
impl Enable {
|
||||
/// Generates a new `<enable/>` element.
|
||||
|
@ -70,25 +70,28 @@ generate_id!(
|
|||
StreamId
|
||||
);
|
||||
|
||||
generate_element!(
|
||||
/// Server response once stream management is enabled.
|
||||
Enabled, "enabled", SM,
|
||||
attributes: [
|
||||
#[derive(FromXml, AsXml, PartialEq, Debug, Clone)]
|
||||
#[xml(namespace = ns::SM, name = "enabled")]
|
||||
pub struct Enabled {
|
||||
/// A random identifier used for stream resumption.
|
||||
id: Option<StreamId> = "id",
|
||||
#[xml(attribute(default))]
|
||||
pub id: Option<StreamId>,
|
||||
|
||||
/// The preferred IP, domain, IP:port or domain:port location for
|
||||
/// resumption.
|
||||
location: Option<String> = "location",
|
||||
#[xml(attribute(default))]
|
||||
pub location: Option<String>,
|
||||
|
||||
/// The preferred resumption time in seconds by the server.
|
||||
// TODO: should be the infinite integer set ≥ 1.
|
||||
max: Option<u32> = "max",
|
||||
#[xml(attribute(default))]
|
||||
pub max: Option<u32>,
|
||||
|
||||
/// Whether stream resumption is allowed.
|
||||
resume: Default<ResumeAttr> = "resume",
|
||||
]
|
||||
);
|
||||
#[xml(attribute(default))]
|
||||
pub resume: ResumeAttr,
|
||||
}
|
||||
|
||||
generate_element!(
|
||||
/// A stream management error happened.
|
||||
|
|
Loading…
Reference in a new issue