(fix) avoid duplicating attendees when accepting event using a different identity over CalDAV

This commit is contained in:
Ludovic Marcotte
2015-12-15 11:08:59 -05:00
parent e94b4416f8
commit b4e4b9c29f
4 changed files with 59 additions and 4 deletions
+29 -1
View File
@@ -85,8 +85,8 @@ NSNumber *iCalDistantFutureNumber = nil;
- (iCalPerson *) userAsAttendee: (SOGoUser *) user
{
NSEnumerator *attendees;
iCalPerson *currentAttendee, *userAttendee;
NSEnumerator *attendees;
userAttendee = nil;
@@ -99,6 +99,34 @@ NSNumber *iCalDistantFutureNumber = nil;
return userAttendee;
}
- (NSString *) participationStatusForUser: (SOGoUser *) theUser
attendee: (iCalPerson *) theAttendee
{
iCalPerson *currentAttendee;
NSEnumerator *attendees;
NSMutableArray *a;
a = [NSMutableArray array];
attendees = [[self attendees] objectEnumerator];
while ((currentAttendee = [attendees nextObject]))
if ([theUser hasEmail: [currentAttendee rfc822Email]])
{
// If the attendee is the same but the partStat is
// different, we prioritize this one.
if ([[currentAttendee rfc822Email] caseInsensitiveCompare: [theAttendee rfc822Email]] == NSOrderedSame &&
[[currentAttendee partStat] caseInsensitiveCompare: [theAttendee partStat]] != NSOrderedSame)
[a insertObject: currentAttendee atIndex: 0];
else if ([[currentAttendee rfc822Email] caseInsensitiveCompare: [theAttendee rfc822Email]] != NSOrderedSame)
[a addObject: currentAttendee];
}
if ([a count] > 0)
return [[a objectAtIndex: 0] partStat];
return [theAttendee partStat];
}
- (BOOL) userIsOrganizer: (SOGoUser *) user
{
NSString *mail;