mirror of
https://github.com/inverse-inc/sogo.git
synced 2026-02-17 07:33:57 +00:00
fix(calendar): deleted occurence of repeated event could cause some troubles with other imrbicated occurences
The fix is within SOPE/NGCards/iCalRecurrenceCalculator.m:244, the others files are juste modified to make the code more readable
This commit is contained in:
@@ -159,28 +159,28 @@ static NGCardsSaxHandler *sax = nil;
|
||||
CardElement *newChild;
|
||||
|
||||
if (aChild)
|
||||
{
|
||||
childTag = [aChild tag];
|
||||
newChild = nil;
|
||||
mappedClass = [self classForTag: [childTag uppercaseString]];
|
||||
if (mappedClass)
|
||||
{
|
||||
if (![aChild isKindOfClass: mappedClass])
|
||||
{
|
||||
childTag = [aChild tag];
|
||||
newChild = nil;
|
||||
mappedClass = [self classForTag: [childTag uppercaseString]];
|
||||
if (mappedClass)
|
||||
{
|
||||
if (![aChild isKindOfClass: mappedClass])
|
||||
{
|
||||
//NSLog (@"warning: new child to entity '%@': '%@' converted to '%@'",
|
||||
// tag, childTag, NSStringFromClass(mappedClass));
|
||||
newChild = [aChild elementWithClass: mappedClass];
|
||||
}
|
||||
}
|
||||
}
|
||||
// else
|
||||
// NSLog (@"warning: no mapped class for tag '%@'",
|
||||
// childTag);
|
||||
|
||||
if (!newChild)
|
||||
newChild = aChild;
|
||||
[children addObject: newChild];
|
||||
[newChild setParent: self];
|
||||
}
|
||||
if (!newChild)
|
||||
newChild = aChild;
|
||||
[children addObject: newChild];
|
||||
[newChild setParent: self];
|
||||
}
|
||||
}
|
||||
|
||||
- (CardElement *) uniqueChildWithTag: (NSString *) aTag
|
||||
|
||||
@@ -235,19 +235,18 @@ static Class yearlyCalcClass = Nil;
|
||||
|
||||
dates = [[self _dates: exdates withinRange: limits startingWithDate: first] objectEnumerator];
|
||||
while ((currentDate = [dates nextObject]))
|
||||
{
|
||||
maxRanges = [ranges count];
|
||||
for (count = maxRanges; count > 0; count--)
|
||||
{
|
||||
currentRange = [ranges objectAtIndex: count - 1];
|
||||
compare = [[currentRange startDate] compare: currentDate];
|
||||
if ((compare == NSOrderedAscending || compare == NSOrderedSame) &&
|
||||
[[currentRange endDate] compare: currentDate] == NSOrderedDescending)
|
||||
{
|
||||
[ranges removeObjectAtIndex: count - 1];
|
||||
}
|
||||
}
|
||||
}
|
||||
{
|
||||
maxRanges = [ranges count];
|
||||
for (count = maxRanges; count > 0; count--)
|
||||
{
|
||||
currentRange = [ranges objectAtIndex: count - 1];
|
||||
compare = [[currentRange startDate] compare: currentDate];
|
||||
if ( compare == NSOrderedSame)
|
||||
{
|
||||
[ranges removeObjectAtIndex: count - 1];
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+ (NSArray *)
|
||||
@@ -255,7 +254,7 @@ static Class yearlyCalcClass = Nil;
|
||||
firstInstanceCalendarDateRange: (NGCalendarDateRange *) _fir
|
||||
recurrenceRules: (NSArray *) _rRules
|
||||
exceptionRules: (NSArray *) _exRules
|
||||
recurrenceDates: (NSArray *) _rDates
|
||||
recurrenceDates: (NSArray *) _rDates
|
||||
exceptionDates: (NSArray *) _exDates
|
||||
{
|
||||
NSMutableArray *ranges;
|
||||
@@ -264,14 +263,10 @@ static Class yearlyCalcClass = Nil;
|
||||
|
||||
if ([_rRules count] > 0 || [_rDates count] > 0)
|
||||
{
|
||||
[self _fillRanges: ranges fromRules: _rRules
|
||||
withinRange: _r startingWithDate: _fir];
|
||||
[self _fillRanges: ranges fromDates: _rDates
|
||||
withinRange: _r startingWithDate: _fir];
|
||||
[self _removeExceptionsFromRanges: ranges withRules: _exRules
|
||||
withinRange: _r startingWithDate: _fir];
|
||||
[self _removeExceptionDatesFromRanges: ranges withDates: _exDates
|
||||
withinRange: _r startingWithDate: _fir];
|
||||
[self _fillRanges: ranges fromRules: _rRules withinRange: _r startingWithDate: _fir];
|
||||
[self _fillRanges: ranges fromDates: _rDates withinRange: _r startingWithDate: _fir];
|
||||
[self _removeExceptionsFromRanges: ranges withRules: _exRules withinRange: _r startingWithDate: _fir];
|
||||
[self _removeExceptionDatesFromRanges: ranges withDates: _exDates withinRange: _r startingWithDate: _fir];
|
||||
}
|
||||
|
||||
return ranges;
|
||||
|
||||
Reference in New Issue
Block a user