mirror of
https://github.com/lennart-k/rustical.git
synced 2025-12-14 07:02:24 +00:00
caldav: add support for calendar subscriptions
This commit is contained in:
@@ -70,7 +70,7 @@ pub trait Resource: Clone + 'static {
|
||||
type Error: ResponseError + From<crate::Error>;
|
||||
type PrincipalResource: Resource;
|
||||
|
||||
fn get_resourcetype() -> &'static [&'static str];
|
||||
fn get_resourcetype(&self) -> &'static [&'static str];
|
||||
|
||||
fn list_props() -> Vec<&'static str> {
|
||||
[Self::PropName::VARIANTS, CommonPropertiesPropName::VARIANTS].concat()
|
||||
@@ -84,7 +84,7 @@ pub trait Resource: Clone + 'static {
|
||||
) -> Result<CommonPropertiesProp, Self::Error> {
|
||||
Ok(match prop {
|
||||
CommonPropertiesPropName::Resourcetype => {
|
||||
CommonPropertiesProp::Resourcetype(Resourcetype(Self::get_resourcetype()))
|
||||
CommonPropertiesProp::Resourcetype(Resourcetype(self.get_resourcetype()))
|
||||
}
|
||||
CommonPropertiesPropName::CurrentUserPrincipal => {
|
||||
CommonPropertiesProp::CurrentUserPrincipal(
|
||||
|
||||
@@ -35,7 +35,7 @@ impl<PR: Resource> Resource for RootResource<PR> {
|
||||
type Error = PR::Error;
|
||||
type PrincipalResource = PR;
|
||||
|
||||
fn get_resourcetype() -> &'static [&'static str] {
|
||||
fn get_resourcetype(&self) -> &'static [&'static str] {
|
||||
&["collection"]
|
||||
}
|
||||
|
||||
|
||||
@@ -83,6 +83,8 @@ pub struct MultistatusElement<PropType: Serialize, MemberPropType: Serialize> {
|
||||
pub ns_caldav: &'static str,
|
||||
#[serde(rename = "@xmlns:IC")]
|
||||
pub ns_ical: &'static str,
|
||||
#[serde(rename = "@xmlns:CS")]
|
||||
pub ns_calendarserver: &'static str,
|
||||
#[serde(rename = "@xmlns:CARD")]
|
||||
pub ns_carddav: &'static str,
|
||||
#[serde(skip_serializing_if = "Option::is_none")]
|
||||
@@ -97,6 +99,7 @@ impl<T1: Serialize, T2: Serialize> Default for MultistatusElement<T1, T2> {
|
||||
ns_dav: Namespace::Dav.as_str(),
|
||||
ns_caldav: Namespace::CalDAV.as_str(),
|
||||
ns_ical: Namespace::ICal.as_str(),
|
||||
ns_calendarserver: Namespace::CServer.as_str(),
|
||||
ns_carddav: Namespace::CardDAV.as_str(),
|
||||
sync_token: None,
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user