mirror of
https://github.com/lennart-k/rustical.git
synced 2025-12-13 21:42:34 +00:00
Add calendar color and description
This commit is contained in:
@@ -110,6 +110,7 @@ pub fn generate_propfind_calendar_response(
|
|||||||
"getcontenttype",
|
"getcontenttype",
|
||||||
"calendar-description",
|
"calendar-description",
|
||||||
"owner",
|
"owner",
|
||||||
|
"calendar-color",
|
||||||
]
|
]
|
||||||
.iter(),
|
.iter(),
|
||||||
);
|
);
|
||||||
@@ -141,6 +142,22 @@ pub fn generate_propfind_calendar_response(
|
|||||||
el.write_empty()?;
|
el.write_empty()?;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
"calendar-color" => {
|
||||||
|
let el = writer.create_element("IC:calendar-color");
|
||||||
|
if let Some(color) = calendar.clone().color {
|
||||||
|
el.write_text_content(BytesText::new(&color))?;
|
||||||
|
} else {
|
||||||
|
el.write_empty()?;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
"calendar-description" => {
|
||||||
|
let el = writer.create_element("C:calendar-description");
|
||||||
|
if let Some(description) = calendar.clone().description {
|
||||||
|
el.write_text_content(BytesText::new(&description))?;
|
||||||
|
} else {
|
||||||
|
el.write_empty()?;
|
||||||
|
}
|
||||||
|
}
|
||||||
"supported-calendar-component-set" => {
|
"supported-calendar-component-set" => {
|
||||||
writer
|
writer
|
||||||
.create_element("C:supported-calendar-component-set")
|
.create_element("C:supported-calendar-component-set")
|
||||||
@@ -196,12 +213,15 @@ pub async fn route_propfind_calendar<A: CheckAuthentication, C: CalendarStore>(
|
|||||||
)
|
)
|
||||||
.map_err(|_e| Error::InternalError)?;
|
.map_err(|_e| Error::InternalError)?;
|
||||||
|
|
||||||
let output = generate_multistatus(vec![Namespace::Dav, Namespace::CalDAV], |writer| {
|
let output = generate_multistatus(
|
||||||
writer.write_event(quick_xml::events::Event::Text(BytesText::from_escaped(
|
vec![Namespace::Dav, Namespace::CalDAV, Namespace::ICal],
|
||||||
responses_string,
|
|writer| {
|
||||||
)))?;
|
writer.write_event(quick_xml::events::Event::Text(BytesText::from_escaped(
|
||||||
Ok(())
|
responses_string,
|
||||||
})
|
)))?;
|
||||||
|
Ok(())
|
||||||
|
},
|
||||||
|
)
|
||||||
.map_err(|_e| Error::InternalError)?;
|
.map_err(|_e| Error::InternalError)?;
|
||||||
|
|
||||||
Ok(HttpResponse::MultiStatus()
|
Ok(HttpResponse::MultiStatus()
|
||||||
|
|||||||
@@ -127,12 +127,15 @@ pub async fn route_propfind_principal<A: CheckAuthentication, C: CalendarStore>(
|
|||||||
.map_err(|_e| Error::InternalError)?,
|
.map_err(|_e| Error::InternalError)?,
|
||||||
);
|
);
|
||||||
|
|
||||||
let output = generate_multistatus(vec![Namespace::Dav, Namespace::CalDAV], |writer| {
|
let output = generate_multistatus(
|
||||||
for response in responses {
|
vec![Namespace::Dav, Namespace::CalDAV, Namespace::ICal],
|
||||||
writer.write_event(Event::Text(BytesText::from_escaped(response)))?;
|
|writer| {
|
||||||
}
|
for response in responses {
|
||||||
Ok(())
|
writer.write_event(Event::Text(BytesText::from_escaped(response)))?;
|
||||||
})
|
}
|
||||||
|
Ok(())
|
||||||
|
},
|
||||||
|
)
|
||||||
.map_err(|_e| Error::InternalError)?;
|
.map_err(|_e| Error::InternalError)?;
|
||||||
|
|
||||||
println!("{}", &output);
|
println!("{}", &output);
|
||||||
|
|||||||
@@ -33,6 +33,8 @@ pub struct Calendar {
|
|||||||
pub id: String,
|
pub id: String,
|
||||||
pub name: Option<String>,
|
pub name: Option<String>,
|
||||||
pub owner: String,
|
pub owner: String,
|
||||||
|
pub description: Option<String>,
|
||||||
|
pub color: Option<String>,
|
||||||
pub ics: String,
|
pub ics: String,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user