mirror of
https://github.com/M66B/FairEmail.git
synced 2025-01-01 04:35:57 +00:00
Process event attendee reply status
This commit is contained in:
parent
61eba3e652
commit
01d1b1070c
1 changed files with 23 additions and 7 deletions
|
@ -158,8 +158,9 @@ import javax.mail.internet.ParseException;
|
|||
import biweekly.Biweekly;
|
||||
import biweekly.ICalendar;
|
||||
import biweekly.component.VEvent;
|
||||
import biweekly.parameter.ParticipationStatus;
|
||||
import biweekly.property.Attendee;
|
||||
import biweekly.property.Method;
|
||||
import biweekly.property.Status;
|
||||
import ezvcard.VCard;
|
||||
import ezvcard.VCardVersion;
|
||||
import ezvcard.io.text.VCardWriter;
|
||||
|
@ -4453,12 +4454,27 @@ public class MessageHelper {
|
|||
else if (method == null || method.isRequest() || method.isReply()) {
|
||||
int status = CalendarContract.Events.STATUS_TENTATIVE;
|
||||
if (method != null && method.isReply()) {
|
||||
Status istatus = event.getStatus();
|
||||
if (istatus != null)
|
||||
if (Status.ACCEPTED.equals(istatus.getValue()))
|
||||
status = CalendarContract.Events.STATUS_CONFIRMED;
|
||||
else if (Status.CANCELLED.equals(istatus.getValue()))
|
||||
status = CalendarContract.Events.STATUS_CANCELED;
|
||||
List<Attendee> attendees = event.getAttendees();
|
||||
if (attendees != null && message.to != null)
|
||||
for (Attendee attendee : attendees) {
|
||||
String email = attendee.getEmail();
|
||||
for (Address to : message.to) {
|
||||
String recipient = ((InternetAddress) to).getAddress();
|
||||
if (!TextUtils.isEmpty(email) && email.equalsIgnoreCase(recipient)) {
|
||||
ParticipationStatus pstatus = attendee.getParticipationStatus();
|
||||
if (ParticipationStatus.ACCEPTED.equals(pstatus))
|
||||
status = CalendarContract.Events.STATUS_CONFIRMED;
|
||||
else if (ParticipationStatus.DECLINED.equals(pstatus))
|
||||
status = CalendarContract.Events.STATUS_CANCELED;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (status == CalendarContract.Events.STATUS_CANCELED) {
|
||||
CalendarHelper.delete(context, event, message);
|
||||
return;
|
||||
}
|
||||
|
||||
if (status == CalendarContract.Events.STATUS_TENTATIVE && !ical_tentative) {
|
||||
|
|
Loading…
Reference in a new issue