Check range before adding single occurrences

pull/218/merge
Francis Lachapelle 2017-10-25 15:18:28 -04:00
parent 70dbba877a
commit 9d45d57cb2
2 changed files with 19 additions and 3 deletions

View File

@ -1238,11 +1238,24 @@ firstInstanceCalendarDateRange: (NGCalendarDateRange *) fir
// contains ONLY one or more vevent with recurrence-id set for each of them. This can happen if
// an organizer invites an attendee only to one or many occurences of a repetitive event.
iCalCalendar *c;
NSDictionary *record;
c = [iCalCalendar parseSingleFromSource: [theRecord objectForKey: @"c_content"]];
[theRecords addObjectsFromArray: [self _fixupRecords: [c quickRecordsFromContent: [theRecord objectForKey: @"c_content"]
container: nil
nameInContainer: [theRecord objectForKey: @"c_name"]]]];
components = [self _fixupRecords:
[c quickRecordsFromContent: [theRecord objectForKey: @"c_content"]
container: nil
nameInContainer: [theRecord objectForKey: @"c_name"]]];
max = [components count];
for (count = 0; count < max; count++)
{
record = [components objectAtIndex: count];
oneRange = [NGCalendarDateRange calendarDateRangeWithStartDate: [record objectForKey: @"startDate"]
endDate: [record objectForKey: @"endDate"]];
if ([theRange doesIntersectWithDateRange: oneRange])
{
[theRecords addObject: record];
}
}
return;
}

View File

@ -31,6 +31,9 @@
- (iCalEvent *) eventWithRecurrenceID: (NSString *) recID;
- (iCalToDo *) todoWithRecurrenceID: (NSString *) recID;
- (NSArray *) quickRecordsFromContent: (NSString *) theContent
container: (id) theContainer
nameInContainer: (NSString *) nameInContainer;
@end