Merge "Fix #2457665 (Guests don't appear in Exchange events)"

This commit is contained in:
Marc Blank 2010-02-19 16:59:11 -08:00 committed by Android (Google) Code Review
commit c98a613153
1 changed files with 21 additions and 22 deletions

View File

@ -228,6 +228,7 @@ public class CalendarSyncAdapter extends AbstractSyncAdapter {
cv.put(Events._SYNC_ACCOUNT, mAccount.mEmailAddress);
cv.put(Events._SYNC_ACCOUNT_TYPE, Email.EXCHANGE_ACCOUNT_MANAGER_TYPE);
cv.put(Events._SYNC_ID, serverId);
cv.put(Events.HAS_ATTENDEE_DATA, 1);
int allDayEvent = 0;
String organizerName = null;
@ -280,7 +281,7 @@ public class CalendarSyncAdapter extends AbstractSyncAdapter {
break;
case Tags.CALENDAR_ATTENDEES:
// If eventId >= 0, this is an update; otherwise, a new Event
attendeesParser(ops, organizerName, organizerEmail, eventId);
attendeesParser(ops, eventId);
break;
case Tags.BASE_BODY:
cv.put(Events.DESCRIPTION, bodyParser());
@ -358,6 +359,24 @@ public class CalendarSyncAdapter extends AbstractSyncAdapter {
}
}
// Handle the organizer (who IS an attendee on device, but NOT in EAS)
if (organizerName != null || organizerEmail != null) {
ContentValues attendeeCv = new ContentValues();
if (organizerName != null) {
attendeeCv.put(Attendees.ATTENDEE_NAME, organizerName);
}
if (organizerEmail != null) {
attendeeCv.put(Attendees.ATTENDEE_EMAIL, organizerEmail);
}
attendeeCv.put(Attendees.ATTENDEE_RELATIONSHIP, Attendees.RELATIONSHIP_ORGANIZER);
attendeeCv.put(Attendees.ATTENDEE_TYPE, Attendees.TYPE_REQUIRED);
if (eventId < 0) {
ops.newAttendee(attendeeCv);
} else {
ops.updatedAttendee(attendeeCv, eventId);
}
}
// If there's no recurrence, set DTEND to the end time
if (!cv.containsKey(Events.RRULE)) {
cv.put(Events.DTEND, endTime);
@ -576,26 +595,7 @@ public class CalendarSyncAdapter extends AbstractSyncAdapter {
return categories.toString();
}
private String attendeesParser(CalendarOperations ops, String organizerName,
String organizerEmail, long eventId) throws IOException {
String body = null;
// First, handle the organizer (who IS an attendee on device, but NOT in EAS)
if (organizerName != null || organizerEmail != null) {
ContentValues cv = new ContentValues();
if (organizerName != null) {
cv.put(Attendees.ATTENDEE_NAME, organizerName);
}
if (organizerEmail != null) {
cv.put(Attendees.ATTENDEE_EMAIL, organizerEmail);
}
cv.put(Attendees.ATTENDEE_RELATIONSHIP, Attendees.RELATIONSHIP_ORGANIZER);
cv.put(Attendees.ATTENDEE_TYPE, Attendees.TYPE_REQUIRED);
if (eventId < 0) {
ops.newAttendee(cv);
} else {
ops.updatedAttendee(cv, eventId);
}
}
private void attendeesParser(CalendarOperations ops, long eventId) throws IOException {
while (nextTag(Tags.CALENDAR_ATTENDEES) != END) {
switch (tag) {
case Tags.CALENDAR_ATTENDEE:
@ -605,7 +605,6 @@ public class CalendarSyncAdapter extends AbstractSyncAdapter {
skipTag();
}
}
return body;
}
private void attendeeParser(CalendarOperations ops, long eventId) throws IOException {