merge of '04f60742d08acd7e35bf71da06a72013e783118c'

and '594291b61ba62cd40f6c3250f748a5fe7b2514a3'

Monotone-Parent: 04f60742d08acd7e35bf71da06a72013e783118c
Monotone-Parent: 594291b61ba62cd40f6c3250f748a5fe7b2514a3
Monotone-Revision: 85bab6959b5681b31089aa2b3aec261a5e8b505f

Monotone-Author: ludovic@Sophos.ca
Monotone-Date: 2008-12-19T23:09:25
Monotone-Branch: ca.inverse.sogo
This commit is contained in:
Ludovic Marcotte
2008-12-19 23:09:25 +00:00

View File

@@ -200,7 +200,55 @@
NSString *iCalString;
object = [self _lookupEvent: [theEvent uid] forUID: theUID];
iCalString = [[theEvent parent] versitString];
// We must add an occurence to a non-existing event. We have
// to handle this with care, as in the postCalDAVEventRequestTo:from:
if ([object isNew] && [theEvent recurrenceId])
{
SOGoAppointmentObject *ownerEventObject;
NSArray *attendees;
iCalPerson *person;
SOGoUser *user;
BOOL found;
int i;
user = [SOGoUser userWithLogin: theUID roles: nil];
person = [iCalPerson elementWithTag: @"attendee"];
[person setCn: [user cn]];
[person setEmail: [[user allEmails] objectAtIndex: 0]];
[person setParticipationStatus: iCalPersonPartStatDeclined];
[person setRsvp: @"TRUE"];
[person setRole: @"REQ-PARTICIPANT"];
ownerEventObject = [self _lookupEvent: [theEvent uid] forUID: theOwner];
theEvent = [[[theEvent parent] events] objectAtIndex: 0];
attendees = [theEvent attendees];
found = NO;
// We check if the attendee that was added to a single occurence is
// present in the master component. If not, we add it with a participation
// status set to "DECLINED"
for (i = 0; i < [attendees count]; i++)
{
if ([[attendees objectAtIndex: i] hasSameEmailAddress: person])
{
found = YES;
break;
}
}
if (!found)
{
[theEvent addToAttendees: person];
iCalString = [[theEvent parent] versitString];
[ownerEventObject saveContentString: iCalString];
}
}
else
{
iCalString = [[theEvent parent] versitString];
}
[object saveContentString: iCalString];
}
}
@@ -783,15 +831,41 @@
else
hasChanged = NO;
}
else if (recurrenceId)
{
// We must add a recurrence to a non-existing event -- simply retrieve
NSArray *attendees;
unsigned int i;
BOOL found;
// We must add an occurence to a non-existing event -- simply retrieve
// the event from the organizer's calendar
if (ownerEventObject == nil)
ownerEventObject = [self _lookupEvent: [newEvent uid] forUID: ownerUID];
newEvent = [ownerEventObject component: NO secure: NO];
attendees = [newEvent attendees];
found = NO;
// We check if the attendee that was added to a single occurence is
// present in the master component. If not, we add it with a participation
// status set to "DECLINED"
for (i = 0; i < [attendees count]; i++)
{
if ([[attendees objectAtIndex: i] hasSameEmailAddress: person])
{
found = YES;
break;
}
}
if (!found)
{
[person setParticipationStatus: iCalPersonPartStatDeclined];
[person setRsvp: @"TRUE"];
[person setRole: @"REQ-PARTICIPANT"];
[newEvent addToAttendees: person];
[ownerEventObject saveContentString: [[newEvent parent] versitString]];
}
}
// We generate the updated iCalendar file and we save it