some preparations for WebDav Push

This commit is contained in:
Lennart
2024-11-11 19:33:06 +01:00
parent b77a7f2a03
commit 6747fde623
8 changed files with 89 additions and 3 deletions

View File

@@ -5,6 +5,7 @@ use quick_xml::events::attributes::Attribute;
// Can also generate appropriate attributes for quick_xml
pub enum Namespace {
Dav,
DavPush,
CalDAV,
CardDAV,
ICal,
@@ -16,6 +17,7 @@ impl Namespace {
pub fn as_str(&self) -> &'static str {
match self {
Self::Dav => "DAV:",
Self::DavPush => "DAV:Push",
Self::CalDAV => "urn:ietf:params:xml:ns:caldav",
Self::CardDAV => "urn:ietf:params:xml:ns:carddav",
Self::ICal => "http://apple.com/ns/ical/",
@@ -28,6 +30,7 @@ impl Namespace {
pub fn xml_attr(&self) -> &'static str {
match self {
Self::Dav => "xmlns",
Self::DavPush => "xmlns:P",
Self::CalDAV => "xmlns:C",
Self::CardDAV => "xmlns:CARD",
Self::ICal => "xmlns:IC",

View File

@@ -79,6 +79,8 @@ pub struct MultistatusElement<PropType: Serialize, MemberPropType: Serialize> {
pub member_responses: Vec<ResponseElement<MemberPropType>>,
#[serde(rename = "@xmlns")]
pub ns_dav: &'static str,
#[serde(rename = "@xmlns:P")]
pub ns_davpush: &'static str,
#[serde(rename = "@xmlns:C")]
pub ns_caldav: &'static str,
#[serde(rename = "@xmlns:IC")]
@@ -97,6 +99,7 @@ impl<T1: Serialize, T2: Serialize> Default for MultistatusElement<T1, T2> {
responses: vec![],
member_responses: vec![],
ns_dav: Namespace::Dav.as_str(),
ns_davpush: Namespace::DavPush.as_str(),
ns_caldav: Namespace::CalDAV.as_str(),
ns_ical: Namespace::ICal.as_str(),
ns_calendarserver: Namespace::CServer.as_str(),