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",
|
||||
"calendar-description",
|
||||
"owner",
|
||||
"calendar-color",
|
||||
]
|
||||
.iter(),
|
||||
);
|
||||
@@ -141,6 +142,22 @@ pub fn generate_propfind_calendar_response(
|
||||
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" => {
|
||||
writer
|
||||
.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)?;
|
||||
|
||||
let output = generate_multistatus(vec![Namespace::Dav, Namespace::CalDAV], |writer| {
|
||||
let output = generate_multistatus(
|
||||
vec![Namespace::Dav, Namespace::CalDAV, Namespace::ICal],
|
||||
|writer| {
|
||||
writer.write_event(quick_xml::events::Event::Text(BytesText::from_escaped(
|
||||
responses_string,
|
||||
)))?;
|
||||
Ok(())
|
||||
})
|
||||
},
|
||||
)
|
||||
.map_err(|_e| Error::InternalError)?;
|
||||
|
||||
Ok(HttpResponse::MultiStatus()
|
||||
|
||||
@@ -127,12 +127,15 @@ pub async fn route_propfind_principal<A: CheckAuthentication, C: CalendarStore>(
|
||||
.map_err(|_e| Error::InternalError)?,
|
||||
);
|
||||
|
||||
let output = generate_multistatus(vec![Namespace::Dav, Namespace::CalDAV], |writer| {
|
||||
let output = generate_multistatus(
|
||||
vec![Namespace::Dav, Namespace::CalDAV, Namespace::ICal],
|
||||
|writer| {
|
||||
for response in responses {
|
||||
writer.write_event(Event::Text(BytesText::from_escaped(response)))?;
|
||||
}
|
||||
Ok(())
|
||||
})
|
||||
},
|
||||
)
|
||||
.map_err(|_e| Error::InternalError)?;
|
||||
|
||||
println!("{}", &output);
|
||||
|
||||
@@ -33,6 +33,8 @@ pub struct Calendar {
|
||||
pub id: String,
|
||||
pub name: Option<String>,
|
||||
pub owner: String,
|
||||
pub description: Option<String>,
|
||||
pub color: Option<String>,
|
||||
pub ics: String,
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user