From 37d2db576f8aee5553b0a9773a3008b3f809379a Mon Sep 17 00:00:00 2001 From: helge Date: Mon, 19 Sep 2005 23:01:20 +0000 Subject: [PATCH] improved byday (failure) handling git-svn-id: http://svn.opengroupware.org/SOPE/trunk@1120 e4a50df8-12e2-0310-a44c-efbce7f8a7e3 --- sope-ical/NGiCal/ChangeLog | 3 +++ sope-ical/NGiCal/Version | 2 +- sope-ical/NGiCal/iCalMonthlyRecurrenceCalculator.m | 10 ++++++++-- sope-ical/NGiCal/iCalRecurrenceCalculator.m | 12 +++++++----- 4 files changed, 19 insertions(+), 8 deletions(-) diff --git a/sope-ical/NGiCal/ChangeLog b/sope-ical/NGiCal/ChangeLog index 27203741..84247db3 100644 --- a/sope-ical/NGiCal/ChangeLog +++ b/sope-ical/NGiCal/ChangeLog @@ -1,5 +1,8 @@ 2005-09-20 Helge Hess + * iCalMonthlyRecurrenceCalculator.m: stop calculation if a byday part + was detected in the rule (v4.5.64) + * iCalRecurrenceCalculator.m: moved cluster subclasses to own source files (v4.5.63) diff --git a/sope-ical/NGiCal/Version b/sope-ical/NGiCal/Version index bae8b281..0e2ffe99 100644 --- a/sope-ical/NGiCal/Version +++ b/sope-ical/NGiCal/Version @@ -2,7 +2,7 @@ MAJOR_VERSION=4 MINOR_VERSION=5 -SUBMINOR_VERSION:=63 +SUBMINOR_VERSION:=64 # v4.5.40 requires NGExtensions v4.5.145 # v4.5.37 requires NGExtensions v4.5.140 diff --git a/sope-ical/NGiCal/iCalMonthlyRecurrenceCalculator.m b/sope-ical/NGiCal/iCalMonthlyRecurrenceCalculator.m index 1eacf1da..be6e6f8a 100644 --- a/sope-ical/NGiCal/iCalMonthlyRecurrenceCalculator.m +++ b/sope-ical/NGiCal/iCalMonthlyRecurrenceCalculator.m @@ -46,8 +46,14 @@ rEnd = [_r endDate]; interval = [self->rrule repeatInterval]; until = [self lastInstanceStartDate]; - - if (until) { + + if ([self->rrule byDayMask] != 0) { + [self errorWithFormat:@"cannot process byday part of rrule: %@", + self->rrule]; + return nil; + } + + if (until != nil) { if ([until compare:rStart] == NSOrderedAscending) return nil; if ([until compare:rEnd] == NSOrderedDescending) diff --git a/sope-ical/NGiCal/iCalRecurrenceCalculator.m b/sope-ical/NGiCal/iCalRecurrenceCalculator.m index 9d2febd7..6e048f7e 100644 --- a/sope-ical/NGiCal/iCalRecurrenceCalculator.m +++ b/sope-ical/NGiCal/iCalRecurrenceCalculator.m @@ -269,9 +269,9 @@ static Class yearlyCalcClass = Nil; - (NGCalendarDateRange *)lastInstanceCalendarDateRange { NSCalendarDate *start, *end; - start = [self lastInstanceStartDate]; - if (!start) + if ((start = [self lastInstanceStartDate]) == nil) return nil; + end = [start addTimeInterval:[self->firstRange duration]]; return [NGCalendarDateRange calendarDateRangeWithStartDate:start endDate:end]; @@ -280,12 +280,14 @@ static Class yearlyCalcClass = Nil; - (NSCalendarDate *)lastInstanceStartDate { NSCalendarDate *until; - /* 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. + /* + 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; } -- 2.39.5