iTIP: Include date properties in REPLY (#2102)

This commit is contained in:
mdecimus
2025-09-14 08:55:17 +02:00
parent a8e631e881
commit 5d0b51bcca
5 changed files with 98 additions and 56 deletions

View File

@@ -67,49 +67,54 @@ pub(crate) fn itip_export_component(
comp.add_uid(uid); comp.add_uid(uid);
for (entry_id, entry) in component.entries.iter().enumerate() { for (entry_id, entry) in component.entries.iter().enumerate() {
match &entry.name { match (&entry.name, &export_as) {
ICalendarProperty::Organizer | ICalendarProperty::Attendee => match &export_as { (
ItipExportAs::Organizer(partstat) => { ICalendarProperty::Organizer | ICalendarProperty::Attendee,
let mut new_entry = ICalendarEntry { ItipExportAs::Organizer(partstat),
name: entry.name.clone(), ) => {
params: Vec::with_capacity(entry.params.len()), let mut new_entry = ICalendarEntry {
values: entry.values.clone(), name: entry.name.clone(),
}; params: Vec::with_capacity(entry.params.len()),
let mut has_partstat = false; values: entry.values.clone(),
let mut rsvp = true; };
let mut has_partstat = false;
let mut rsvp = true;
for entry in &entry.params { for entry in &entry.params {
match entry { match entry {
ICalendarParameter::ScheduleStatus(_) ICalendarParameter::ScheduleStatus(_)
| ICalendarParameter::ScheduleAgent(_) | ICalendarParameter::ScheduleAgent(_)
| ICalendarParameter::ScheduleForceSend(_) => {} | ICalendarParameter::ScheduleForceSend(_) => {}
_ => { _ => {
match entry { match entry {
ICalendarParameter::Rsvp(false) => { ICalendarParameter::Rsvp(false) => {
rsvp = false; rsvp = false;
}
ICalendarParameter::Partstat(_) => {
has_partstat = true;
}
_ => {}
} }
ICalendarParameter::Partstat(_) => {
new_entry.params.push(entry.clone()) has_partstat = true;
}
_ => {}
} }
new_entry.params.push(entry.clone())
} }
} }
if !has_partstat && rsvp && entry.name == ICalendarProperty::Attendee {
new_entry
.params
.push(ICalendarParameter::Partstat((*partstat).clone()));
}
comp.entries.push(new_entry);
} }
ItipExportAs::Attendee(attendee_entry_ids)
if attendee_entry_ids.contains(&(entry_id as u16)) if !has_partstat && rsvp && entry.name == ICalendarProperty::Attendee {
|| entry.name == ICalendarProperty::Organizer => new_entry
.params
.push(ICalendarParameter::Partstat((*partstat).clone()));
}
comp.entries.push(new_entry);
}
(
ICalendarProperty::Organizer | ICalendarProperty::Attendee,
ItipExportAs::Attendee(attendee_entry_ids),
) => {
if attendee_entry_ids.contains(&(entry_id as u16))
|| entry.name == ICalendarProperty::Organizer
{ {
comp.entries.push(ICalendarEntry { comp.entries.push(ICalendarEntry {
name: entry.name.clone(), name: entry.name.clone(),
@@ -129,26 +134,36 @@ pub(crate) fn itip_export_component(
values: entry.values.clone(), values: entry.values.clone(),
}); });
} }
_ => {}
},
ICalendarProperty::RequestStatus
| ICalendarProperty::Dtstamp
| ICalendarProperty::Sequence
| ICalendarProperty::Uid => {}
_ => {
if matches!(export_as, ItipExportAs::Organizer(_))
|| matches!(entry.name, ICalendarProperty::RecurrenceId)
|| (is_todo
&& matches!(
entry.name,
ICalendarProperty::Status
| ICalendarProperty::PercentComplete
| ICalendarProperty::Completed
))
{
comp.entries.push(entry.clone());
}
} }
(
ICalendarProperty::RequestStatus
| ICalendarProperty::Dtstamp
| ICalendarProperty::Sequence
| ICalendarProperty::Uid,
_,
) => {}
(_, ItipExportAs::Organizer(_))
| (
ICalendarProperty::RecurrenceId
| ICalendarProperty::Dtstart
| ICalendarProperty::Dtend
| ICalendarProperty::Duration
| ICalendarProperty::Due
| ICalendarProperty::Description
| ICalendarProperty::Summary,
_,
) => {
comp.entries.push(entry.clone());
}
(
ICalendarProperty::Status
| ICalendarProperty::PercentComplete
| ICalendarProperty::Completed,
_,
) if is_todo => {
comp.entries.push(entry.clone());
}
_ => {}
} }
} }

View File

@@ -122,6 +122,9 @@ METHOD:REPLY
PRODID:-//Stalwart Labs LLC//Stalwart Server//EN PRODID:-//Stalwart Labs LLC//Stalwart Server//EN
VERSION:2.0 VERSION:2.0
BEGIN:VEVENT BEGIN:VEVENT
SUMMARY:Conference
DTEND:19970701T2100000Z
DTSTART:19970701T200000Z
ATTENDEE;RSVP=TRUE;CUTYPE=INDIVIDUAL;CN=B;PARTSTAT=ACCEPTED:mailto:b@example ATTENDEE;RSVP=TRUE;CUTYPE=INDIVIDUAL;CN=B;PARTSTAT=ACCEPTED:mailto:b@example
.com .com
ORGANIZER:mailto:a@example.com ORGANIZER:mailto:a@example.com
@@ -283,6 +286,9 @@ METHOD:REPLY
PRODID:-//Stalwart Labs LLC//Stalwart Server//EN PRODID:-//Stalwart Labs LLC//Stalwart Server//EN
VERSION:2.0 VERSION:2.0
BEGIN:VEVENT BEGIN:VEVENT
SUMMARY:Phone Conference
DTEND:19970701T190000Z
DTSTART:19970701T180000Z
ATTENDEE;PARTSTAT=DELEGATED;DELEGATED-TO="mailto:e@example.com":mailto:c@ex ATTENDEE;PARTSTAT=DELEGATED;DELEGATED-TO="mailto:e@example.com":mailto:c@ex
ample.com ample.com
ATTENDEE;RSVP=TRUE;DELEGATED-FROM="mailto:c@example.com":mailto:e@example.c ATTENDEE;RSVP=TRUE;DELEGATED-FROM="mailto:c@example.com":mailto:e@example.c
@@ -419,6 +425,9 @@ METHOD:REPLY
PRODID:-//Stalwart Labs LLC//Stalwart Server//EN PRODID:-//Stalwart Labs LLC//Stalwart Server//EN
VERSION:2.0 VERSION:2.0
BEGIN:VEVENT BEGIN:VEVENT
SUMMARY:Phone Conference
DTEND:19970701T190000Z
DTSTART:19970701T180000Z
ATTENDEE;PARTSTAT=DELEGATED;DELEGATED-TO="mailto:e@example.com":mailto:c@ex ATTENDEE;PARTSTAT=DELEGATED;DELEGATED-TO="mailto:e@example.com":mailto:c@ex
ample.com ample.com
ATTENDEE;RSVP=TRUE;DELEGATED-FROM="mailto:c@example.com";PARTSTAT=ACCEPTED: ATTENDEE;RSVP=TRUE;DELEGATED-FROM="mailto:c@example.com";PARTSTAT=ACCEPTED:
@@ -523,6 +532,9 @@ METHOD:REPLY
PRODID:-//Stalwart Labs LLC//Stalwart Server//EN PRODID:-//Stalwart Labs LLC//Stalwart Server//EN
VERSION:2.0 VERSION:2.0
BEGIN:VEVENT BEGIN:VEVENT
SUMMARY:Phone Conference
DTEND:19970701T190000Z
DTSTART:19970701T180000Z
ATTENDEE;PARTSTAT=DELEGATED;DELEGATED-TO="mailto:e@example.com":mailto:c@ex ATTENDEE;PARTSTAT=DELEGATED;DELEGATED-TO="mailto:e@example.com":mailto:c@ex
ample.com ample.com
ATTENDEE;RSVP=TRUE;DELEGATED-FROM="mailto:c@example.com";PARTSTAT=DECLINED: ATTENDEE;RSVP=TRUE;DELEGATED-FROM="mailto:c@example.com";PARTSTAT=DECLINED:

View File

@@ -107,6 +107,8 @@ PRODID:-//Stalwart Labs LLC//Stalwart Server//EN
VERSION:2.0 VERSION:2.0
BEGIN:VTODO BEGIN:VTODO
STATUS:IN-PROCESS STATUS:IN-PROCESS
DUE:19970722T170000Z
DTSTART:19970701T170000Z
ATTENDEE;PARTSTAT=ACCEPTED:mailto:b@example.com ATTENDEE;PARTSTAT=ACCEPTED:mailto:b@example.com
ORGANIZER:mailto:a@example.com ORGANIZER:mailto:a@example.com
UID:calsrv.example.com-873970198738777-00@example.com UID:calsrv.example.com-873970198738777-00@example.com
@@ -175,6 +177,8 @@ VERSION:2.0
BEGIN:VTODO BEGIN:VTODO
PERCENT-COMPLETE:75 PERCENT-COMPLETE:75
STATUS:IN-PROCESS STATUS:IN-PROCESS
DUE:19970722T170000Z
DTSTART:19970701T170000Z
ATTENDEE;PARTSTAT=IN-PROCESS:mailto:b@example.com ATTENDEE;PARTSTAT=IN-PROCESS:mailto:b@example.com
ORGANIZER:mailto:a@example.com ORGANIZER:mailto:a@example.com
UID:calsrv.example.com-873970198738777-00@example.com UID:calsrv.example.com-873970198738777-00@example.com
@@ -240,6 +244,8 @@ METHOD:REPLY
PRODID:-//Stalwart Labs LLC//Stalwart Server//EN PRODID:-//Stalwart Labs LLC//Stalwart Server//EN
VERSION:2.0 VERSION:2.0
BEGIN:VTODO BEGIN:VTODO
DUE:19970722T170000Z
DTSTART:19970701T170000Z
ATTENDEE;PARTSTAT=COMPLETED:mailto:d@example.com ATTENDEE;PARTSTAT=COMPLETED:mailto:d@example.com
ORGANIZER:mailto:a@example.com ORGANIZER:mailto:a@example.com
UID:calsrv.example.com-873970198738777-00@example.com UID:calsrv.example.com-873970198738777-00@example.com

View File

@@ -188,6 +188,9 @@ METHOD:REPLY
PRODID:-//Stalwart Labs LLC//Stalwart Server//EN PRODID:-//Stalwart Labs LLC//Stalwart Server//EN
VERSION:2.0 VERSION:2.0
BEGIN:VEVENT BEGIN:VEVENT
SUMMARY:Review Internet-Draft
DTEND;TZID=America/Montreal:20090601T160000
DTSTART;TZID=America/Montreal:20090601T150000
ATTENDEE;CN="Bernard Desruisseaux";CUTYPE=INDIVIDUAL;PARTSTAT=ACCEPTED;ROLE= ATTENDEE;CN="Bernard Desruisseaux";CUTYPE=INDIVIDUAL;PARTSTAT=ACCEPTED;ROLE=
REQ-PARTICIPANT;RSVP=TRUE:mailto:bernard@example.net REQ-PARTICIPANT;RSVP=TRUE:mailto:bernard@example.net
ORGANIZER;CN="Cyrus Daboo":mailto:cyrus@example.com ORGANIZER;CN="Cyrus Daboo":mailto:cyrus@example.com
@@ -197,6 +200,9 @@ SEQUENCE:1
REQUEST-STATUS:2.0;Success REQUEST-STATUS:2.0;Success
END:VEVENT END:VEVENT
BEGIN:VEVENT BEGIN:VEVENT
SUMMARY:Review Internet-Draft
DTEND;TZID=America/Montreal:20090602T160000
DTSTART;TZID=America/Montreal:20090602T150000
ATTENDEE;CN="Bernard Desruisseaux";CUTYPE=INDIVIDUAL;PARTSTAT=DECLINED;ROLE= ATTENDEE;CN="Bernard Desruisseaux";CUTYPE=INDIVIDUAL;PARTSTAT=DECLINED;ROLE=
REQ-PARTICIPANT;RSVP=TRUE:mailto:bernard@example.net REQ-PARTICIPANT;RSVP=TRUE:mailto:bernard@example.net
ORGANIZER;CN="Cyrus Daboo":mailto:cyrus@example.com ORGANIZER;CN="Cyrus Daboo":mailto:cyrus@example.com

View File

@@ -173,6 +173,9 @@ METHOD:REPLY
PRODID:-//Stalwart Labs LLC//Stalwart Server//EN PRODID:-//Stalwart Labs LLC//Stalwart Server//EN
VERSION:2.0 VERSION:2.0
BEGIN:VEVENT BEGIN:VEVENT
SUMMARY:Lunch
DTEND:20090602T170000Z
DTSTART:20090602T160000Z
ATTENDEE;CN="Wilfredo Sanchez Vega";CUTYPE=INDIVIDUAL;PARTSTAT=ACCEPTED;ROLE= ATTENDEE;CN="Wilfredo Sanchez Vega";CUTYPE=INDIVIDUAL;PARTSTAT=ACCEPTED;ROLE=
REQ-PARTICIPANT;RSVP=TRUE:mailto:wilfredo@example.com REQ-PARTICIPANT;RSVP=TRUE:mailto:wilfredo@example.com
ORGANIZER;CN="Cyrus Daboo":mailto:cyrus@example.com ORGANIZER;CN="Cyrus Daboo":mailto:cyrus@example.com