Monotone-Parent: b6726f7b87c51426fc4fa2e3ed33d20cb47a89e0

Monotone-Revision: f638868d7db65b1617476f06e76394a24bca8310

Monotone-Author: flachapelle@inverse.ca
Monotone-Date: 2011-01-14T19:07:43
Monotone-Branch: ca.inverse.sogo
maint-2.0.2
Francis Lachapelle 2011-01-14 19:07:43 +00:00
parent db851140d4
commit ab94153bfc
3 changed files with 31 additions and 24 deletions

View File

@ -178,19 +178,24 @@
NSString *dateString; NSString *dateString;
unsigned i; unsigned i;
dates = [NSMutableArray array]; if (theTimeZone)
dateList = [[self childrenWithTag: @"exdate"] objectEnumerator];
while ((dateString = [dateList nextObject]))
{ {
exDates = [(iCalDateTime*) dateString values]; dates = [NSMutableArray array];
for (i = 0; i < [exDates count]; i++) dateList = [[self childrenWithTag: @"exdate"] objectEnumerator];
while ((dateString = [dateList nextObject]))
{ {
dateString = [exDates objectAtIndex: i]; exDates = [(iCalDateTime*) dateString values];
exDate = [theTimeZone computedDateForString: dateString]; for (i = 0; i < [exDates count]; i++)
[dates addObject: exDate]; {
dateString = [exDates objectAtIndex: i];
exDate = [theTimeZone computedDateForString: dateString];
[dates addObject: exDate];
}
} }
} }
else
dates = [self exceptionDates];
return dates; return dates;
} }

View File

@ -835,7 +835,6 @@ firstInstanceCalendarDateRange: (NGCalendarDateRange *) fir
NSMutableDictionary *row, *fixedRow; NSMutableDictionary *row, *fixedRow;
NSMutableArray *records; NSMutableArray *records;
NSDictionary *cycleinfo; NSDictionary *cycleinfo;
NSCalendarDate *startDate, *endDate;
NGCalendarDateRange *firstRange, *oneRange; NGCalendarDateRange *firstRange, *oneRange;
NSArray *rules, *exRules, *exDates, *ranges; NSArray *rules, *exRules, *exDates, *ranges;
NSArray *elements, *components; NSArray *elements, *components;
@ -864,14 +863,14 @@ firstInstanceCalendarDateRange: (NGCalendarDateRange *) fir
theRecord]; theRecord];
return; return;
} }
rules = [cycleinfo objectForKey: @"rules"];
exRules = [cycleinfo objectForKey: @"exRules"];
exDates = [cycleinfo objectForKey: @"exDates"];
row = [self fixupRecord: theRecord]; row = [self fixupRecord: theRecord];
[row removeObjectForKey: @"c_cycleinfo"]; [row removeObjectForKey: @"c_cycleinfo"];
[row setObject: sharedYes forKey: @"isRecurrentEvent"]; [row setObject: sharedYes forKey: @"isRecurrentEvent"];
startDate = [row objectForKey: @"startDate"];
endDate = [row objectForKey: @"endDate"];
content = [theRecord objectForKey: @"c_content"]; content = [theRecord objectForKey: @"c_content"];
if ([content length]) if ([content length])
{ {
@ -886,20 +885,20 @@ firstInstanceCalendarDateRange: (NGCalendarDateRange *) fir
firstStartDate = (iCalDateTime*)[component uniqueChildWithTag: @"dtstart"]; firstStartDate = (iCalDateTime*)[component uniqueChildWithTag: @"dtstart"];
firstEndDate = (iCalDateTime*)[component uniqueChildWithTag: @"dtend"]; firstEndDate = (iCalDateTime*)[component uniqueChildWithTag: @"dtend"];
eventTimeZone = [firstStartDate timeZone]; eventTimeZone = [firstStartDate timeZone];
startDate = [eventTimeZone computedDateForDate: startDate];
firstRange = [NGCalendarDateRange calendarDateRangeWithStartDate: [[[firstStartDate values] lastObject] asCalendarDate] firstRange = [NGCalendarDateRange calendarDateRangeWithStartDate: [[[firstStartDate values] lastObject] asCalendarDate]
endDate: [[[firstEndDate values] lastObject] asCalendarDate]]; endDate: [[[firstEndDate values] lastObject] asCalendarDate]];
// Adjust the range to check with respect to the event timezone (extracted from the start date) if (eventTimeZone)
checkStartDate = [eventTimeZone computedDateForDate: [theRange startDate]]; {
checkEndDate = [eventTimeZone computedDateForDate: [theRange endDate]]; // Adjust the range to check with respect to the event timezone (extracted from the start date)
theRange = [NGCalendarDateRange calendarDateRangeWithStartDate: checkStartDate checkStartDate = [eventTimeZone computedDateForDate: [theRange startDate]];
endDate: checkEndDate]; checkEndDate = [eventTimeZone computedDateForDate: [theRange endDate]];
theRange = [NGCalendarDateRange calendarDateRangeWithStartDate: checkStartDate
endDate: checkEndDate];
exDates = [eventTimeZone computedDatesForStrings: exDates];
}
// Calculate the occurrences for the given range // Calculate the occurrences for the given range
rules = [cycleinfo objectForKey: @"rules"];
exRules = [cycleinfo objectForKey: @"exRules"];
exDates = [eventTimeZone computedDatesForStrings: [cycleinfo objectForKey: @"exDates"]];
ranges = [iCalRecurrenceCalculator recurrenceRangesWithinCalendarDateRange: theRange ranges = [iCalRecurrenceCalculator recurrenceRangesWithinCalendarDateRange: theRange
firstInstanceCalendarDateRange: firstRange firstInstanceCalendarDateRange: firstRange
recurrenceRules: rules recurrenceRules: rules

View File

@ -130,7 +130,10 @@
// Set the range to check with respect to the event timezone (extracted from the start date) // Set the range to check with respect to the event timezone (extracted from the start date)
firstStartDate = (iCalDateTime *)[self uniqueChildWithTag: @"dtstart"]; firstStartDate = (iCalDateTime *)[self uniqueChildWithTag: @"dtstart"];
eventTimeZone = [firstStartDate timeZone]; eventTimeZone = [firstStartDate timeZone];
startDate = [eventTimeZone computedDateForDate: theOccurenceDate]; if (eventTimeZone)
startDate = [eventTimeZone computedDateForDate: theOccurenceDate];
else
startDate = theOccurenceDate;
endDate = [startDate addTimeInterval: [self occurenceInterval]]; endDate = [startDate addTimeInterval: [self occurenceInterval]];
checkRange = [NGCalendarDateRange calendarDateRangeWithStartDate: startDate checkRange = [NGCalendarDateRange calendarDateRangeWithStartDate: startDate
endDate: endDate]; endDate: endDate];