mirror of
https://github.com/inverse-inc/sogo.git
synced 2026-03-04 06:36:24 +00:00
Monotone-Parent: 7140a5ceda022b61cef5ae79339b0dd6d915880b
Monotone-Revision: 1321ce15584f6fd3efdfbca5f6c254254ef69476 Monotone-Author: wsourdeau@inverse.ca Monotone-Date: 2008-01-28T18:51:52 Monotone-Branch: ca.inverse.sogo
This commit is contained in:
@@ -1,5 +1,12 @@
|
||||
2008-01-28 Wolfgang Sourdeau <wsourdeau@inverse.ca>
|
||||
|
||||
* iCalRecurrenceRule.m ([iCalRecurrenceRule
|
||||
-weekDayFromICalRepresentation:_day]): issue an error whenever the
|
||||
day cannot be deduced. Accept days notated with a prefix.
|
||||
([iCalRecurrenceRule -byDayMask]): don't strip the represented
|
||||
day, feed it directly to weekDayFromICalRepresentation: since it
|
||||
will do the correct syntax validation.
|
||||
|
||||
* iCalDailyRecurrenceCalculator.m ([iCalDailyRecurrenceCalculator
|
||||
-recurrenceRangesWithinCalendarDateRange:]): make use of <<
|
||||
instead of exp2 to compute the mask.
|
||||
|
||||
@@ -302,7 +302,6 @@
|
||||
for (count = 0; count < max; count++)
|
||||
{
|
||||
day = [days objectAtIndex: count];
|
||||
day = [day substringFromIndex: [day length] - 2];
|
||||
mask |= [self weekDayFromICalRepresentation: day];
|
||||
}
|
||||
}
|
||||
@@ -331,27 +330,43 @@
|
||||
|
||||
- (iCalWeekDay) weekDayFromICalRepresentation: (NSString *) _day
|
||||
{
|
||||
if ([_day length] > 1) {
|
||||
/* be tolerant */
|
||||
unichar c0, c1;
|
||||
|
||||
c0 = [_day characterAtIndex:0];
|
||||
if (c0 == 'm' || c0 == 'M') return iCalWeekDayMonday;
|
||||
if (c0 == 'w' || c0 == 'W') return iCalWeekDayWednesday;
|
||||
if (c0 == 'f' || c0 == 'F') return iCalWeekDayFriday;
|
||||
NSString *day;
|
||||
/* be tolerant */
|
||||
iCalWeekDay foundDay;
|
||||
unichar chars[2];
|
||||
|
||||
c1 = [_day characterAtIndex:1];
|
||||
if (c0 == 't' || c0 == 'T') {
|
||||
if (c1 == 'u' || c1 == 'U') return iCalWeekDayTuesday;
|
||||
if (c1 == 'h' || c1 == 'H') return iCalWeekDayThursday;
|
||||
}
|
||||
if (c0 == 's' || c0 == 'S') {
|
||||
if (c1 == 'a' || c1 == 'A') return iCalWeekDaySaturday;
|
||||
if (c1 == 'u' || c1 == 'U') return iCalWeekDaySunday;
|
||||
}
|
||||
}
|
||||
foundDay = 0;
|
||||
|
||||
return -1;
|
||||
if ([_day length] > 1)
|
||||
{
|
||||
[[_day uppercaseString] getCharacters: chars
|
||||
range: NSMakeRange ([day length] - 2, 2)];
|
||||
|
||||
switch (chars[0])
|
||||
{
|
||||
case 'M': foundDay = iCalWeekDayMonday;
|
||||
break;
|
||||
case 'W': foundDay = iCalWeekDayWednesday;
|
||||
break;
|
||||
case 'F': foundDay = iCalWeekDayFriday;
|
||||
break;
|
||||
case 'T':
|
||||
if (chars[1] == 'U')
|
||||
foundDay = iCalWeekDayTuesday;
|
||||
else if (chars[1] == 'H')
|
||||
foundDay = iCalWeekDayThursday;
|
||||
case 'S':
|
||||
if (chars[1] == 'A')
|
||||
foundDay = iCalWeekDaySaturday;
|
||||
else if (chars[1] == 'H')
|
||||
foundDay = iCalWeekDaySunday;
|
||||
}
|
||||
}
|
||||
|
||||
if (!foundDay)
|
||||
[self errorWithFormat: @"wrong weekday representation: '%@'", _day];
|
||||
|
||||
return foundDay;
|
||||
// // TODO: do not raise but rather return an error value?
|
||||
// [NSException raise:NSGenericException
|
||||
// format:@"Incorrect weekDay '%@' specified!", _day];
|
||||
|
||||
Reference in New Issue
Block a user