diff --git a/NEWS b/NEWS index 509dbe8b3..a2ed8f1da 100644 --- a/NEWS +++ b/NEWS @@ -5,9 +5,12 @@ - pressing enter in the contact edition dialog will perform the creation/update operation - implemented more of the CalDAV specification for compatibility with Lightning 0.8 - added Italian translation, thanks to Marco Lertora -- improved restoration of drag hanldes state +- improved restoration of drag handles state - improved contextual menu handling of Address Book module -- fixed various bugs with Safari 3.1 +- fixed various bugs occuring with Safari 3.1 +- monthly events would not be returned properly +- bi-weekly events would appear every week instead +- weekly events with specified days of week would not appear on the correct days 0.9.0-20080208 (1.0 rc5) ------------------------ diff --git a/SOPE/NGCards/ChangeLog b/SOPE/NGCards/ChangeLog index 7abe74abe..434420f92 100644 --- a/SOPE/NGCards/ChangeLog +++ b/SOPE/NGCards/ChangeLog @@ -1,3 +1,13 @@ +2008-03-26 Wolfgang Sourdeau + + * iCalRecurrenceRule.m ([iCalRecurrenceRule -byMonthDay]): check + whether the "bymonthday" value is empty and returns an array only if + not, otherwise returns nil. + + * iCalRecurrenceCalculator.m ([iCalRecurrenceCalculator + +recurrenceRangesWithinCalendarDateRange:_rfirstInstanceCalendarDateRange:_firrecurrenceRules:_rRulesexceptionRules:_exRulesexceptionDates:_exDates]): + split method in many submethods for clarity. + 2008-03-10 Wolfgang Sourdeau * iCalTimeZonePeriod.m ([iCalTimeZonePeriod diff --git a/SOPE/NGCards/NGCardsSaxHandler.m b/SOPE/NGCards/NGCardsSaxHandler.m index f01097394..22aedebc3 100644 --- a/SOPE/NGCards/NGCardsSaxHandler.m +++ b/SOPE/NGCards/NGCardsSaxHandler.m @@ -23,6 +23,7 @@ #import #import +#import "NSString+NGCards.h" #import "NGCardsSaxHandler.h" #import "CardGroup.h" diff --git a/SOPE/NGCards/iCalMonthlyRecurrenceCalculator.m b/SOPE/NGCards/iCalMonthlyRecurrenceCalculator.m index e8a236312..913fbf6da 100644 --- a/SOPE/NGCards/iCalMonthlyRecurrenceCalculator.m +++ b/SOPE/NGCards/iCalMonthlyRecurrenceCalculator.m @@ -43,18 +43,21 @@ typedef BOOL NGMonthSet[12]; typedef BOOL NGMonthDaySet[32]; // 0 is unused -static void NGMonthDaySet_clear(NGMonthDaySet *daySet) { - register unsigned i; - - for (i = 1; i <= 31; i++) - (*daySet)[i] = NO; -} - -static void NGMonthDaySet_copyOrUnion(NGMonthDaySet *base, NGMonthDaySet *new, - BOOL doCopy) +static void +NGMonthDaySet_clear(NGMonthDaySet *daySet) { register unsigned i; + for (i = 0; i <= 31; i++) + (*daySet)[i] = NO; +} + +static void +NGMonthDaySet_copyOrUnion(NGMonthDaySet *base, NGMonthDaySet *new, + BOOL doCopy) +{ + register unsigned i; + if (doCopy) memcpy(base, new, sizeof(NGMonthDaySet)); else { @@ -265,7 +268,7 @@ static void NGMonthDaySet_fillWithByDayX(NGMonthDaySet *daySet, /* check whether the range to be processed is beyond the 'until' date */ - if (until != nil) { + if (until) { if ([until compare:rStart] == NSOrderedAscending) /* until before start */ return nil; if ([until compare:rEnd] == NSOrderedDescending) /* end before until */ @@ -275,7 +278,7 @@ static void NGMonthDaySet_fillWithByDayX(NGMonthDaySet *daySet, /* precalculate month days (same for all instances) */ - if (byMonthDay != nil) { + if (byMonthDay) { #if HEAVY_DEBUG NSLog(@"byMonthDay: %@", byMonthDay); #endif @@ -343,7 +346,7 @@ static void NGMonthDaySet_fillWithByDayX(NGMonthDaySet *daySet, didByFill = NO; - if (byMonthDay != nil) { /* list of days in the month */ + if (byMonthDay) { /* list of days in the month */ NGMonthDaySet_copyOrUnion(&monthDays, &byMonthDaySet, !didByFill); didByFill = YES; } diff --git a/SOPE/NGCards/iCalRecurrenceCalculator.m b/SOPE/NGCards/iCalRecurrenceCalculator.m index 4923639cb..c3e9b8ed3 100644 --- a/SOPE/NGCards/iCalRecurrenceCalculator.m +++ b/SOPE/NGCards/iCalRecurrenceCalculator.m @@ -48,19 +48,22 @@ @implementation iCalRecurrenceCalculator static Class NSCalendarDateClass = Nil; +static Class NSStringClass = Nil; static Class iCalRecurrenceRuleClass = Nil; static Class dailyCalcClass = Nil; static Class weeklyCalcClass = Nil; static Class monthlyCalcClass = Nil; static Class yearlyCalcClass = Nil; -+ (void)initialize { ++ (void) initialize +{ static BOOL didInit = NO; if (didInit) return; didInit = YES; NSCalendarDateClass = [NSCalendarDate class]; + NSStringClass = [NSString class]; iCalRecurrenceRuleClass = [iCalRecurrenceRule class]; dailyCalcClass = NSClassFromString(@"iCalDailyRecurrenceCalculator"); @@ -71,118 +74,12 @@ static Class yearlyCalcClass = Nil; /* factory */ -+ (id)recurrenceCalculatorForRecurrenceRule:(iCalRecurrenceRule *)_rrule - withFirstInstanceCalendarDateRange:(NGCalendarDateRange *)_range -{ - return [[[self alloc] initWithRecurrenceRule:_rrule - firstInstanceCalendarDateRange:_range] autorelease]; -} - -/* complex calculation convenience */ - -+ (NSArray *)recurrenceRangesWithinCalendarDateRange:(NGCalendarDateRange *)_r - firstInstanceCalendarDateRange:(NGCalendarDateRange *)_fir - recurrenceRules:(NSArray *)_rRules - exceptionRules:(NSArray *)_exRules - exceptionDates:(NSArray *)_exDates -{ - id rule; - iCalRecurrenceCalculator *calc; - NSMutableArray *ranges; - NSMutableArray *exDates; - unsigned i, count, rCount; - - ranges = [NSMutableArray arrayWithCapacity:64]; - - for (i = 0, count = [_rRules count]; i < count; i++) { - NSArray *rs; - - rule = [_rRules objectAtIndex:i]; - if (![rule isKindOfClass:iCalRecurrenceRuleClass]) - rule = [iCalRecurrenceRule recurrenceRuleWithICalRepresentation:rule]; - - calc = [self recurrenceCalculatorForRecurrenceRule:rule - withFirstInstanceCalendarDateRange:_fir]; - - rs = [calc recurrenceRangesWithinCalendarDateRange:_r]; - [ranges addObjectsFromArray:rs]; - } - - if ([ranges count] == 0) - return nil; - - /* test if any exceptions do match */ - - for (i = 0, count = [_exRules count]; i < count; i++) { - NSArray *rs; - - rule = [_exRules objectAtIndex:i]; - if (![rule isKindOfClass:iCalRecurrenceRuleClass]) - rule = [iCalRecurrenceRule recurrenceRuleWithICalRepresentation:rule]; - - calc = [self recurrenceCalculatorForRecurrenceRule:rule - withFirstInstanceCalendarDateRange:_fir]; - rs = [calc recurrenceRangesWithinCalendarDateRange:_r]; - [ranges removeObjectsInArray:rs]; - } - - if (![ranges isNotEmpty]) - return nil; - - /* exception dates */ - - if ((count = [_exDates count]) == 0) - return ranges; - - /* sort out exDates not within range */ - - exDates = [NSMutableArray arrayWithCapacity:count]; - for (i = 0; i < count; i++) { - id exDate; - - exDate = [_exDates objectAtIndex:i]; - if (![exDate isKindOfClass:NSCalendarDateClass]) - exDate = [NSCalendarDate calendarDateWithICalRepresentation:exDate]; - - if ([_r containsDate:exDate]) - [exDates addObject:exDate]; - } - - /* remove matching exDates from ranges */ - - if ((count = [exDates count]) == 0) - return ranges; - - for (i = 0, rCount = [ranges count]; i < count; i++) { - NSCalendarDate *exDate; - NGCalendarDateRange *r; - unsigned k; - - exDate = [exDates objectAtIndex:i]; - - for (k = 0; k < rCount; k++) { - unsigned rIdx; - - rIdx = (rCount - k) - 1; - r = [ranges objectAtIndex:rIdx]; - if ([r containsDate:exDate]) { - [ranges removeObjectAtIndex:rIdx]; - rCount--; - break; /* this is safe because we know that ranges don't overlap */ - } - } - } - return ranges; -} - - -/* init */ - -- (id)initWithRecurrenceRule:(iCalRecurrenceRule *)_rrule - firstInstanceCalendarDateRange:(NGCalendarDateRange *)_range ++ (id) recurrenceCalculatorForRecurrenceRule: (iCalRecurrenceRule *) _rrule + withFirstInstanceCalendarDateRange: (NGCalendarDateRange *) _range { iCalRecurrenceFrequency freq; - Class calcClass = Nil; + Class calcClass; + id calc; freq = [_rrule frequency]; if (freq == iCalRecurrenceFrequenceDaily) @@ -193,116 +90,261 @@ static Class yearlyCalcClass = Nil; calcClass = monthlyCalcClass; else if (freq == iCalRecurrenceFrequenceYearly) calcClass = yearlyCalcClass; - else { - [self errorWithFormat:@"unsupported rrule frequency: %@", _rrule]; + else calcClass = Nil; - [self release]; - return nil; - } - - [self autorelease]; // TODO: why autorelease? - if (calcClass == Nil) - return nil; - - if ((self = [[calcClass alloc] init]) != nil) { - self->rrule = [_rrule retain]; - self->firstRange = [_range retain]; - } + + if (calcClass) + { + calc = [[calcClass alloc] initWithRecurrenceRule:_rrule + firstInstanceCalendarDateRange: _range]; + [calc autorelease]; + } + else + { + [self errorWithFormat: @"unsupported rrule frequency: %@", _rrule]; + calc = nil; + } + + return calc; +} + +/* complex calculation convenience */ + ++ (void) _fillRanges: (NSMutableArray *) ranges + fromRules: (NSArray *) rrules + withinRange: (NGCalendarDateRange *) limits + startingWithDate: (NGCalendarDateRange *) first +{ + NSEnumerator *rules; + iCalRecurrenceRule *currentRule; + iCalRecurrenceCalculator *calc; + + rules = [rrules objectEnumerator]; + while ((currentRule = [rules nextObject])) + { + if ([currentRule isKindOfClass: NSStringClass]) + currentRule = + [iCalRecurrenceRule + recurrenceRuleWithICalRepresentation: (NSString *) currentRule]; + + calc = [self recurrenceCalculatorForRecurrenceRule: currentRule + withFirstInstanceCalendarDateRange: first]; + [ranges addObjectsFromArray: + [calc recurrenceRangesWithinCalendarDateRange: limits]]; + } +} + ++ (void) _removeExceptionsFromRanges: (NSMutableArray *) ranges + withRules: (NSArray *) exrules + withinRange: (NGCalendarDateRange *) limits + startingWithDate: (NGCalendarDateRange *) first +{ + NSEnumerator *rules; + iCalRecurrenceRule *currentRule; + iCalRecurrenceCalculator *calc; + + rules = [exrules objectEnumerator]; + while ((currentRule = [rules nextObject])) + { + if ([currentRule isKindOfClass: NSStringClass]) + currentRule = + [iCalRecurrenceRule + recurrenceRuleWithICalRepresentation: (NSString *) currentRule]; + + calc = [self recurrenceCalculatorForRecurrenceRule: currentRule + withFirstInstanceCalendarDateRange: first]; + [ranges removeObjectsInArray: + [calc recurrenceRangesWithinCalendarDateRange: limits]]; + } +} + ++ (NSArray *) _dates: (NSArray *) dateList + withinRange: (NGCalendarDateRange *) limits +{ + NSMutableArray *newDates; + NSEnumerator *dates; + NSCalendarDate *currentDate; + + newDates = [NSMutableArray array]; + + dates = [dateList objectEnumerator]; + while ((currentDate = [dates nextObject])) + { + if ([currentDate isKindOfClass: NSStringClass]) + currentDate + = [NSCalendarDate + calendarDateWithICalRepresentation: (NSString *) currentDate]; + if ([limits containsDate: currentDate]) + [newDates addObject: currentDate]; + } + + return newDates; +} + ++ (void) _removeExceptionDatesFromRanges: (NSMutableArray *) ranges + withDates: (NSArray *) exdates + withinRange: (NGCalendarDateRange *) limits + startingWithDate: (NGCalendarDateRange *) first +{ + NSEnumerator *dates; + NSCalendarDate *currentDate; + NGCalendarDateRange *currentRange; + int count, maxRanges; + + maxRanges = [ranges count]; + dates = [[self _dates: exdates withinRange: limits] objectEnumerator]; + while ((currentDate = [dates nextObject])) + for (count = (maxRanges - 1); count > -1; count++) + { + currentRange = [ranges objectAtIndex: count]; + if ([currentRange containsDate: currentDate]) + { + [ranges removeObjectAtIndex: count]; + maxRanges--; + } + } +} + ++ (NSArray *) + recurrenceRangesWithinCalendarDateRange: (NGCalendarDateRange *) _r + firstInstanceCalendarDateRange: (NGCalendarDateRange *) _fir + recurrenceRules: (NSArray *) _rRules + exceptionRules: (NSArray *) _exRules + exceptionDates: (NSArray *) _exDates +{ + NSMutableArray *ranges; + + ranges = [NSMutableArray arrayWithCapacity: 64]; + + if ([_rRules count] > 0) + { + [self _fillRanges: ranges fromRules: _rRules + withinRange: _r startingWithDate: _fir]; + [self _removeExceptionsFromRanges: ranges withRules: _exRules + withinRange: _r startingWithDate: _fir]; + [self _removeExceptionDatesFromRanges: ranges withDates: _exDates + withinRange: _r startingWithDate: _fir]; + } + + return ranges; +} + + +/* init */ + +- (id) initWithRecurrenceRule: (iCalRecurrenceRule *) _rrule + firstInstanceCalendarDateRange: (NGCalendarDateRange *) _range +{ + if ((self = [super init])) + { + rrule = [_rrule retain]; + firstRange = [_range retain]; + } + return self; } -- (void)dealloc { - [self->firstRange release]; - [self->rrule release]; +- (void) dealloc +{ + [firstRange release]; + [rrule release]; [super dealloc]; } /* helpers */ -- (unsigned)offsetFromSundayForJulianNumber:(long)_jn { - return (unsigned)((int)(_jn + 1.5)) % 7; +- (unsigned) offsetFromSundayForJulianNumber: (long) _jn +{ + return (unsigned)((int) (_jn + 1.5)) % 7; } -- (unsigned)offsetFromSundayForWeekDay:(iCalWeekDay)_weekDay { +- (unsigned) offsetFromSundayForWeekDay: (iCalWeekDay) _weekDay +{ unsigned offset; - switch (_weekDay) { - case iCalWeekDaySunday: offset = 0; break; - case iCalWeekDayMonday: offset = 1; break; - case iCalWeekDayTuesday: offset = 2; break; - case iCalWeekDayWednesday: offset = 3; break; - case iCalWeekDayThursday: offset = 4; break; - case iCalWeekDayFriday: offset = 5; break; - case iCalWeekDaySaturday: offset = 6; break; - default: offset = 0; break; - } + switch (_weekDay) + { + case iCalWeekDaySunday: + offset = 0; break; + case iCalWeekDayMonday: + offset = 1; break; + case iCalWeekDayTuesday: + offset = 2; break; + case iCalWeekDayWednesday: + offset = 3; break; + case iCalWeekDayThursday: + offset = 4; break; + case iCalWeekDayFriday: + offset = 5; break; + case iCalWeekDaySaturday: + offset = 6; break; + default: + offset = 0; break; + } + return offset; } -- (unsigned)offsetFromSundayForCurrentWeekStart { - return [self offsetFromSundayForWeekDay:[self->rrule weekStart]]; +- (unsigned) offsetFromSundayForCurrentWeekStart +{ + return [self offsetFromSundayForWeekDay: [rrule weekStart]]; } -- (iCalWeekDay)weekDayForJulianNumber:(long)_jn { - unsigned day; - iCalWeekDay weekDay; +- (iCalWeekDay) weekDayForJulianNumber: (long)_jn +{ + iCalWeekDay weekDays[] = {iCalWeekDaySunday, iCalWeekDayMonday, + iCalWeekDayTuesday, iCalWeekDayWednesday, + iCalWeekDayThursday, iCalWeekDayFriday, + iCalWeekDaySaturday}; - day = [self offsetFromSundayForJulianNumber:_jn]; - switch (day) { - case 0: weekDay = iCalWeekDaySunday; break; - case 1: weekDay = iCalWeekDayMonday; break; - case 2: weekDay = iCalWeekDayTuesday; break; - case 3: weekDay = iCalWeekDayWednesday; break; - case 4: weekDay = iCalWeekDayThursday; break; - case 5: weekDay = iCalWeekDayFriday; break; - case 6: weekDay = iCalWeekDaySaturday; break; - default: - [self errorWithFormat:@"got unexpected weekday: %d", day]; - weekDay = iCalWeekDaySunday; - break; /* keep compiler happy */ - } - return weekDay; + return weekDays[[self offsetFromSundayForJulianNumber: _jn]]; } /* calculation */ -- (NSArray *)recurrenceRangesWithinCalendarDateRange:(NGCalendarDateRange *)_r{ +- (NSArray *) + recurrenceRangesWithinCalendarDateRange: (NGCalendarDateRange *) _r +{ return nil; /* subclass responsibility */ } -- (BOOL)doesRecurrWithinCalendarDateRange:(NGCalendarDateRange *)_range { - NSArray *ranges; - ranges = [self recurrenceRangesWithinCalendarDateRange:_range]; - return (ranges == nil || [ranges count] == 0) ? NO : YES; +- (BOOL) doesRecurrWithinCalendarDateRange: (NGCalendarDateRange *) _range +{ + return ([[self recurrenceRangesWithinCalendarDateRange: _range] count] + > 0); } -- (NGCalendarDateRange *)firstInstanceCalendarDateRange { - return self->firstRange; +- (NGCalendarDateRange *) firstInstanceCalendarDateRange +{ + return firstRange; } -- (NGCalendarDateRange *)lastInstanceCalendarDateRange { +- (NGCalendarDateRange *) lastInstanceCalendarDateRange +{ NSCalendarDate *start, *end; + NGCalendarDateRange *range; - if ((start = [self lastInstanceStartDate]) == nil) - return nil; - - end = [start addTimeInterval:[self->firstRange duration]]; - return [NGCalendarDateRange calendarDateRangeWithStartDate:start - endDate:end]; + range = nil; + + start = [self lastInstanceStartDate]; + if (start) + { + end = [start addTimeInterval: [firstRange duration]]; + range = [NGCalendarDateRange calendarDateRangeWithStartDate: start + endDate: end]; + } + + return range; } -- (NSCalendarDate *)lastInstanceStartDate { - NSCalendarDate *until; - +- (NSCalendarDate *) lastInstanceStartDate +{ /* NOTE: this is horribly inaccurate and doesn't even consider the use of repeatCount. It MUST be implemented by subclasses properly! However, it does the trick for SOGo 1.0 - that's why it's left here. */ - if ((until = [self->rrule untilDate]) != nil) - return until; - - return nil; + return [rrule untilDate]; } @end /* iCalRecurrenceCalculator */ diff --git a/SOPE/NGCards/iCalRecurrenceRule.m b/SOPE/NGCards/iCalRecurrenceRule.m index 3ce38f1a6..53f9939ab 100644 --- a/SOPE/NGCards/iCalRecurrenceRule.m +++ b/SOPE/NGCards/iCalRecurrenceRule.m @@ -325,7 +325,16 @@ - (NSArray *) byMonthDay { - return [[self namedValue: @"bymonthday"] componentsSeparatedByString: @","]; + NSArray *byMonthDay; + NSString *byMonthDayStr; + + byMonthDayStr = [self namedValue: @"bymonthday"]; + if ([byMonthDayStr length]) + byMonthDay = [byMonthDayStr componentsSeparatedByString: @","]; + else + byMonthDay = nil; + + return byMonthDay; } - (BOOL) isInfinite @@ -363,11 +372,13 @@ foundDay = iCalWeekDayTuesday; else if (chars[1] == 'H') foundDay = iCalWeekDayThursday; + break; case 'S': if (chars[1] == 'A') foundDay = iCalWeekDaySaturday; else if (chars[1] == 'U') foundDay = iCalWeekDaySunday; + break; } } diff --git a/SOPE/NGCards/iCalWeeklyRecurrenceCalculator.m b/SOPE/NGCards/iCalWeeklyRecurrenceCalculator.m index eade01969..4c2dd0b3e 100644 --- a/SOPE/NGCards/iCalWeeklyRecurrenceCalculator.m +++ b/SOPE/NGCards/iCalWeeklyRecurrenceCalculator.m @@ -32,13 +32,13 @@ @interface iCalRecurrenceCalculator (PrivateAPI) -- (NSCalendarDate *)lastInstanceStartDate; +- (NSCalendarDate *) lastInstanceStartDate; -- (unsigned)offsetFromSundayForJulianNumber:(long)_jn; -- (unsigned)offsetFromSundayForWeekDay:(iCalWeekDay)_weekDay; -- (unsigned)offsetFromSundayForCurrentWeekStart; +- (unsigned) offsetFromSundayForJulianNumber:(long)_jn; +- (unsigned) offsetFromSundayForWeekDay:(iCalWeekDay)_weekDay; +- (unsigned) offsetFromSundayForCurrentWeekStart; -- (iCalWeekDay)weekDayForJulianNumber:(long)_jn; +- (iCalWeekDay) weekDayForJulianNumber:(long)_jn; @end @@ -48,7 +48,9 @@ */ @implementation iCalWeeklyRecurrenceCalculator -- (NSArray *)recurrenceRangesWithinCalendarDateRange:(NGCalendarDateRange *)_r { +- (NSArray *) + recurrenceRangesWithinCalendarDateRange: (NGCalendarDateRange *) _r +{ NSMutableArray *ranges; NSCalendarDate *firStart; long i, jnFirst, jnStart, jnEnd, startEndCount; diff --git a/SoObjects/Appointments/SOGoAppointmentFolder.m b/SoObjects/Appointments/SOGoAppointmentFolder.m index 27a2eb3bf..173b9c0f9 100644 --- a/SoObjects/Appointments/SOGoAppointmentFolder.m +++ b/SoObjects/Appointments/SOGoAppointmentFolder.m @@ -907,10 +907,10 @@ static NSNumber *sharedYes = nil; forRange: (NGCalendarDateRange *) _r intoArray: (NSMutableArray *) _ma { - NSMutableDictionary *row; + NSMutableDictionary *row, *fixedRow; NSDictionary *cycleinfo; NSCalendarDate *startDate, *endDate; - NGCalendarDateRange *fir; + NGCalendarDateRange *fir, *rRange; NSArray *rules, *exRules, *exDates, *ranges; unsigned i, count; NSString *content; @@ -918,47 +918,44 @@ static NSNumber *sharedYes = nil; content = [_row objectForKey: @"c_cycleinfo"]; if (![content isNotNull]) { - [self errorWithFormat:@"cyclic record doesn't have cycleinfo -> %@", _row]; + [self errorWithFormat:@"cyclic record doesn't have cycleinfo -> %@", + _row]; return; } cycleinfo = [content propertyList]; if (!cycleinfo) { - [self errorWithFormat:@"cyclic record doesn't have cycleinfo -> %@", _row]; + [self errorWithFormat:@"cyclic record doesn't have cycleinfo -> %@", + _row]; return; } row = [self fixupRecord:_row fetchRange: _r]; [row removeObjectForKey: @"c_cycleinfo"]; - [row setObject: sharedYes forKey:@"isRecurrentEvent"]; + [row setObject: sharedYes forKey: @"isRecurrentEvent"]; - startDate = [row objectForKey:@"startDate"]; - endDate = [row objectForKey:@"endDate"]; - fir = [NGCalendarDateRange calendarDateRangeWithStartDate:startDate - endDate:endDate]; - rules = [cycleinfo objectForKey:@"rules"]; - exRules = [cycleinfo objectForKey:@"exRules"]; - exDates = [cycleinfo objectForKey:@"exDates"]; + startDate = [row objectForKey: @"startDate"]; + endDate = [row objectForKey: @"endDate"]; + fir = [NGCalendarDateRange calendarDateRangeWithStartDate: startDate + endDate: endDate]; + rules = [cycleinfo objectForKey: @"rules"]; + exRules = [cycleinfo objectForKey: @"exRules"]; + exDates = [cycleinfo objectForKey: @"exDates"]; - ranges = [iCalRecurrenceCalculator recurrenceRangesWithinCalendarDateRange:_r - firstInstanceCalendarDateRange:fir - recurrenceRules:rules - exceptionRules:exRules - exceptionDates:exDates]; + ranges = [iCalRecurrenceCalculator recurrenceRangesWithinCalendarDateRange: _r + firstInstanceCalendarDateRange: fir + recurrenceRules: rules + exceptionRules: exRules + exceptionDates: exDates]; count = [ranges count]; - - for (i = 0; i < count; i++) { - NGCalendarDateRange *rRange; - id fixedRow; - - rRange = [ranges objectAtIndex:i]; - fixedRow = [self fixupCycleRecord:row cycleRange:rRange]; - if (fixedRow != nil) - { + for (i = 0; i < count; i++) + { + rRange = [ranges objectAtIndex:i]; + fixedRow = [self fixupCycleRecord: row cycleRange: rRange]; + if (fixedRow) [_ma addObject:fixedRow]; - } - } + } } - (NSArray *) fixupCyclicRecords: (NSArray *) _records @@ -966,19 +963,18 @@ static NSNumber *sharedYes = nil; { // TODO: is the result supposed to be sorted by date? NSMutableArray *ma; - unsigned i, count; - - if (_records == nil) return nil; - if ((count = [_records count]) == 0) - return _records; - - ma = [NSMutableArray arrayWithCapacity:count]; - for (i = 0; i < count; i++) { - id row; // TODO: what is the type of the record? - - row = [_records objectAtIndex:i]; - [self _flattenCycleRecord:row forRange:_r intoArray:ma]; - } + NSDictionary *row; + unsigned int i, count; + + count = [_records count]; + ma = [NSMutableArray arrayWithCapacity: count]; + if (count > 0) + for (i = 0; i < count; i++) + { + row = [_records objectAtIndex: i]; + [self _flattenCycleRecord: row forRange: _r intoArray: ma]; + } + return ma; } diff --git a/configure b/configure index eeb6af441..522a6f85f 100755 --- a/configure +++ b/configure @@ -120,6 +120,10 @@ validateGNUstepArgs() { ARG_GSMAKE="$HOME/GNUstep/Library/Makefiles/" elif test -f /usr/GNUstep/System/Library/Makefiles/GNUstep.sh; then ARG_GSMAKE="/usr/GNUstep/System/Library/Makefiles/" + elif test -f /usr/share/GNUstep/Makefiles/GNUstep.sh; then + ARG_GSMAKE="/usr/share/GNUstep/Makefiles/" + elif test -f $GNUSTEP_MAKEFILES/GNUstep.sh; then + ARG_GSMAKE="$GNUSTEP_MAKEFILES/" else echo "error: please specify a GNUstep make tree!" exit 1