Commit 78b32ee1 authored by Ricki Hirner's avatar Ricki Hirner 🐑

Handle attendees and reminders for exceptions of recurring events

parent 34399181
......@@ -58,7 +58,6 @@ import ezvcard.property.Uid;
import ezvcard.property.Url;
import lombok.Cleanup;
import lombok.Getter;
import lombok.Setter;
import lombok.ToString;
......
......@@ -30,7 +30,6 @@ import net.fortuna.ical4j.model.property.DtStart;
import net.fortuna.ical4j.model.property.Duration;
import net.fortuna.ical4j.model.property.ExDate;
import net.fortuna.ical4j.model.property.ExRule;
import net.fortuna.ical4j.model.property.LastModified;
import net.fortuna.ical4j.model.property.Location;
import net.fortuna.ical4j.model.property.Organizer;
import net.fortuna.ical4j.model.property.RDate;
......@@ -60,7 +59,6 @@ import at.bitfire.davdroid.DateUtils;
import lombok.Cleanup;
import lombok.Getter;
import lombok.NonNull;
import lombok.Setter;
public class Event extends iCalendar {
......
......@@ -603,7 +603,6 @@ public class LocalCalendar extends LocalCollection<Event> {
if (event.organizer != null) {
final URI uri = event.organizer.getCalAddress();
String email = null;
if (uri != null && "mailto".equalsIgnoreCase(uri.getScheme()))
email = uri.getSchemeSpecificPart();
......@@ -611,10 +610,11 @@ public class LocalCalendar extends LocalCollection<Event> {
iCalendar.Email emailParam = (iCalendar.Email)event.organizer.getParameter(iCalendar.Email.PARAMETER_NAME);
if (emailParam != null)
email = emailParam.getValue();
else
Log.w(TAG, "Got ORGANIZER without email address, using given URI instead (may cause Android to behave unexpectedly)");
}
builder.withValue(Events.ORGANIZER, email != null ? email : uri.toString());
if (email != null)
builder.withValue(Events.ORGANIZER, email);
else
Log.w(TAG, "Got ORGANIZER without email address which is not supported by Android, ignoring");
}
if (event.status!= null) {
......@@ -646,8 +646,11 @@ public class LocalCalendar extends LocalCollection<Event> {
for (VAlarm alarm : event.getAlarms())
pendingOperations.add(buildReminder(newDataInsertBuilder(Reminders.CONTENT_URI, Reminders.EVENT_ID, localID, backrefIdx), alarm).build());
// add exceptions
for (Event exception : event.getExceptions())
for (Event exception : event.getExceptions()) {
final int backrefIdxEx = pendingOperations.size(); // save exception ID as backref value
pendingOperations.add(buildException(newDataInsertBuilder(Events.CONTENT_URI, Events.ORIGINAL_ID, localID, backrefIdx), event, exception).build());
addDataRows(exception, -1, backrefIdxEx); // build attendees and reminders for exception
}
}
@Override
......@@ -684,10 +687,6 @@ public class LocalCalendar extends LocalCollection<Event> {
builder.withValue(Events.ORIGINAL_INSTANCE_TIME, date.getTime());
builder.withValue(Events.ORIGINAL_ALL_DAY, originalAllDay ? 1 : 0);
/* TODO reminders and attendees for exceptions are currently not built because
* there's no backref index available */
return builder;
}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment