Same as the fix for the postCalDAVEventRequestTo:from: method.

Monotone-Parent: d0d94f5dbbc0725b57437eef5366686ec0842d97
Monotone-Revision: 594291b61ba62cd40f6c3250f748a5fe7b2514a3

Monotone-Author: ludovic@Sophos.ca
Monotone-Date: 2008-12-19T23:04:26
Monotone-Branch: ca.inverse.sogo
This commit is contained in:
Ludovic Marcotte
2008-12-19 23:04:26 +00:00
parent 7458bf8e37
commit 6ffc48d279

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];
}
}