Merge "Handle exception deletion properly" into froyo
This commit is contained in:
commit
232b2dd9dc
@ -1416,6 +1416,8 @@ public class CalendarSyncAdapter extends AbstractSyncAdapter {
|
|||||||
cr.query(EVENTS_URI, null, DIRTY_OR_MARKED_TOP_LEVEL_IN_CALENDAR,
|
cr.query(EVENTS_URI, null, DIRTY_OR_MARKED_TOP_LEVEL_IN_CALENDAR,
|
||||||
mCalendarIdArgument, null), cr);
|
mCalendarIdArgument, null), cr);
|
||||||
ContentValues cidValues = new ContentValues();
|
ContentValues cidValues = new ContentValues();
|
||||||
|
String ourEmailAddress = mAccount.mEmailAddress;
|
||||||
|
|
||||||
try {
|
try {
|
||||||
boolean first = true;
|
boolean first = true;
|
||||||
while (eventIterator.hasNext()) {
|
while (eventIterator.hasNext()) {
|
||||||
@ -1434,6 +1436,8 @@ public class CalendarSyncAdapter extends AbstractSyncAdapter {
|
|||||||
// EAS 2.5 needs: BusyStatus DtStamp EndTime Sensitivity StartTime TimeZone UID
|
// EAS 2.5 needs: BusyStatus DtStamp EndTime Sensitivity StartTime TimeZone UID
|
||||||
// We can generate all but what we're testing for below
|
// We can generate all but what we're testing for below
|
||||||
String organizerEmail = entityValues.getAsString(Events.ORGANIZER);
|
String organizerEmail = entityValues.getAsString(Events.ORGANIZER);
|
||||||
|
boolean selfOrganizer = organizerEmail.equalsIgnoreCase(ourEmailAddress);
|
||||||
|
|
||||||
if (!entityValues.containsKey(Events.DTSTART)
|
if (!entityValues.containsKey(Events.DTSTART)
|
||||||
|| (!entityValues.containsKey(Events.DURATION) &&
|
|| (!entityValues.containsKey(Events.DURATION) &&
|
||||||
!entityValues.containsKey(Events.DTEND))
|
!entityValues.containsKey(Events.DTEND))
|
||||||
@ -1461,8 +1465,7 @@ public class CalendarSyncAdapter extends AbstractSyncAdapter {
|
|||||||
userLog("Deleting event with serverId: ", serverId);
|
userLog("Deleting event with serverId: ", serverId);
|
||||||
s.start(Tags.SYNC_DELETE).data(Tags.SYNC_SERVER_ID, serverId).end();
|
s.start(Tags.SYNC_DELETE).data(Tags.SYNC_SERVER_ID, serverId).end();
|
||||||
mDeletedIdList.add(eventId);
|
mDeletedIdList.add(eventId);
|
||||||
if (entityValues.getAsString(Events.ORGANIZER)
|
if (selfOrganizer) {
|
||||||
.equalsIgnoreCase(mAccount.mEmailAddress)) {
|
|
||||||
mSendCancelIdList.add(eventId);
|
mSendCancelIdList.add(eventId);
|
||||||
}
|
}
|
||||||
continue;
|
continue;
|
||||||
@ -1516,7 +1519,9 @@ public class CalendarSyncAdapter extends AbstractSyncAdapter {
|
|||||||
// attendees about it
|
// attendees about it
|
||||||
long exEventId = exValues.getAsLong(Events._ID);
|
long exEventId = exValues.getAsLong(Events._ID);
|
||||||
int flag;
|
int flag;
|
||||||
if (getInt(exValues, Events.STATUS) == Events.STATUS_CANCELED) {
|
if ((getInt(exValues, Events.DELETED) == 1) ||
|
||||||
|
(getInt(exValues, Events.STATUS) ==
|
||||||
|
Events.STATUS_CANCELED)) {
|
||||||
// Add the eventId of the exception to the proper list, so that
|
// Add the eventId of the exception to the proper list, so that
|
||||||
// the dirty bit is cleared or the event is deleted after the
|
// the dirty bit is cleared or the event is deleted after the
|
||||||
// sync has completed
|
// sync has completed
|
||||||
@ -1541,12 +1546,14 @@ public class CalendarSyncAdapter extends AbstractSyncAdapter {
|
|||||||
entityValues.getAsString(Events.EVENT_LOCATION));
|
entityValues.getAsString(Events.EVENT_LOCATION));
|
||||||
}
|
}
|
||||||
|
|
||||||
Message msg =
|
if (selfOrganizer) {
|
||||||
CalendarUtilities.createMessageForEntity(mContext,
|
Message msg =
|
||||||
exEntity, flag, clientId, mAccount);
|
CalendarUtilities.createMessageForEntity(mContext,
|
||||||
if (msg != null) {
|
exEntity, flag, clientId, mAccount);
|
||||||
userLog("Queueing exception update to " + msg.mTo);
|
if (msg != null) {
|
||||||
mOutgoingMailList.add(msg);
|
userLog("Queueing exception update to " + msg.mTo);
|
||||||
|
mOutgoingMailList.add(msg);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
s.end(); // EXCEPTION
|
s.end(); // EXCEPTION
|
||||||
@ -1562,8 +1569,6 @@ public class CalendarSyncAdapter extends AbstractSyncAdapter {
|
|||||||
// Send the meeting invite if there are attendees and we're the organizer AND
|
// Send the meeting invite if there are attendees and we're the organizer AND
|
||||||
// if the Event itself is dirty (we might be syncing only because an exception
|
// if the Event itself is dirty (we might be syncing only because an exception
|
||||||
// is dirty, in which case we DON'T send email about the Event)
|
// is dirty, in which case we DON'T send email about the Event)
|
||||||
boolean selfOrganizer = organizerEmail.equalsIgnoreCase(mAccount.mEmailAddress);
|
|
||||||
|
|
||||||
if (selfOrganizer &&
|
if (selfOrganizer &&
|
||||||
(getInt(entityValues, Events._SYNC_DIRTY) == 1)) {
|
(getInt(entityValues, Events._SYNC_DIRTY) == 1)) {
|
||||||
EmailContent.Message msg =
|
EmailContent.Message msg =
|
||||||
|
Loading…
Reference in New Issue
Block a user