(fix) fixed recurring events with timezones for EAS (fixes #3822)
parent
92a81f8c1b
commit
23fa9c0ea1
|
@ -37,11 +37,25 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
#import <NGCards/iCalEvent.h>
|
#import <NGCards/iCalEvent.h>
|
||||||
#import <NGCards/iCalByDayMask.h>
|
#import <NGCards/iCalByDayMask.h>
|
||||||
|
|
||||||
|
#import <NGCards/iCalDateTime.h>
|
||||||
|
#import <NGCards/iCalTimeZone.h>
|
||||||
|
|
||||||
#import "NSCalendarDate+ActiveSync.h"
|
#import "NSCalendarDate+ActiveSync.h"
|
||||||
#import "NSDate+ActiveSync.h"
|
#import "NSDate+ActiveSync.h"
|
||||||
|
|
||||||
@implementation iCalRecurrenceRule (ActiveSync)
|
@implementation iCalRecurrenceRule (ActiveSync)
|
||||||
|
|
||||||
|
- (NSCalendarDate *) _adjustedStartDate
|
||||||
|
{
|
||||||
|
iCalTimeZone *timeZone;
|
||||||
|
|
||||||
|
timeZone = [(iCalDateTime *)[[self parent] firstChildWithTag: @"dtstart"] timeZone];
|
||||||
|
if (timeZone)
|
||||||
|
return [timeZone computedDateForDate: [[self parent] startDate]];
|
||||||
|
else
|
||||||
|
return [[self parent] startDate];
|
||||||
|
}
|
||||||
|
|
||||||
- (NSString *) activeSyncRepresentationInContext: (WOContext *) context
|
- (NSString *) activeSyncRepresentationInContext: (WOContext *) context
|
||||||
{
|
{
|
||||||
NSMutableString *s;
|
NSMutableString *s;
|
||||||
|
@ -90,7 +104,7 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
{
|
{
|
||||||
// No byDayMask, we take the event's start date to compute the DayOfWeek
|
// No byDayMask, we take the event's start date to compute the DayOfWeek
|
||||||
// 0 == Sunday, 6 == Saturday
|
// 0 == Sunday, 6 == Saturday
|
||||||
v = (1 << [[[self parent] startDate] dayOfWeek]);
|
v = (1 << [[self _adjustedStartDate] dayOfWeek]);
|
||||||
}
|
}
|
||||||
|
|
||||||
[s appendFormat: @"<Recurrence_DayOfWeek xmlns=\"Calendar:\">%d</Recurrence_DayOfWeek>", v];
|
[s appendFormat: @"<Recurrence_DayOfWeek xmlns=\"Calendar:\">%d</Recurrence_DayOfWeek>", v];
|
||||||
|
@ -139,8 +153,7 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
{
|
{
|
||||||
// Simple reccurrence rule of type "Monthly"
|
// Simple reccurrence rule of type "Monthly"
|
||||||
type = 2;
|
type = 2;
|
||||||
[s appendFormat: @"<Recurrence_DayOfMonth xmlns=\"Calendar:\">%d</Recurrence_DayOfMonth>",
|
[s appendFormat: @"<Recurrence_DayOfMonth xmlns=\"Calendar:\">%d</Recurrence_DayOfMonth>", [[self _adjustedStartDate] dayOfMonth]];
|
||||||
(int)[[[self parent] startDate] dayOfMonth]];
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if ([self frequency] == iCalRecurrenceFrequenceYearly)
|
else if ([self frequency] == iCalRecurrenceFrequenceYearly)
|
||||||
|
@ -178,10 +191,8 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
type = 5;
|
type = 5;
|
||||||
[s appendFormat: @"<Recurrence_DayOfMonth xmlns=\"Calendar:\">%d</Recurrence_DayOfMonth>",
|
[s appendFormat: @"<Recurrence_DayOfMonth xmlns=\"Calendar:\">%d</Recurrence_DayOfMonth>", [[self _adjustedStartDate] dayOfMonth]];
|
||||||
(int)[[[self parent] startDate] dayOfMonth]];
|
[s appendFormat: @"<Recurrence_MonthOfYear xmlns=\"Calendar:\">%d</Recurrence_MonthOfYear>", [[self _adjustedStartDate] monthOfYear]];
|
||||||
[s appendFormat: @"<Recurrence_MonthOfYear xmlns=\"Calendar:\">%d</Recurrence_MonthOfYear>",
|
|
||||||
(int)[[[self parent] startDate] monthOfYear]];
|
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -123,7 +123,7 @@ struct SYSTEMTIME {
|
||||||
//uint16_t wStandardYear;
|
//uint16_t wStandardYear;
|
||||||
struct SYSTEMTIME stStandardDate;
|
struct SYSTEMTIME stStandardDate;
|
||||||
//uint16_t wDaylightYear;
|
//uint16_t wDaylightYear;
|
||||||
struct SYSTEMTIME stDaylightDate;
|
struct SYSTEMTIME stDaylightDate = {0,0,0,0,0,0,0,0};
|
||||||
|
|
||||||
char standardName[64], daylightName[64];
|
char standardName[64], daylightName[64];
|
||||||
|
|
||||||
|
@ -139,13 +139,17 @@ struct SYSTEMTIME {
|
||||||
|
|
||||||
period = [self _mostRecentPeriodWithName: @"DAYLIGHT"];
|
period = [self _mostRecentPeriodWithName: @"DAYLIGHT"];
|
||||||
if (!period)
|
if (!period)
|
||||||
stStandardDate.wMonth = 0;
|
{
|
||||||
|
stStandardDate.wMonth = 0;
|
||||||
lDaylightBias = (uint32_t) -([period secondsOffsetFromGMT] / 60) - lBias;
|
lDaylightBias = 0;
|
||||||
[period _fillTZDate: &stDaylightDate];
|
}
|
||||||
//wStandardYear = stStandardDate.wYear;
|
else
|
||||||
//wDaylightYear = stDaylightDate.wYear;
|
{
|
||||||
|
lDaylightBias = (uint32_t) -([period secondsOffsetFromGMT] / 60) - lBias;
|
||||||
|
[period _fillTZDate: &stDaylightDate];
|
||||||
|
//wStandardYear = stStandardDate.wYear;
|
||||||
|
//wDaylightYear = stDaylightDate.wYear;
|
||||||
|
}
|
||||||
|
|
||||||
// We build the timezone
|
// We build the timezone
|
||||||
[bytes appendBytes: &lBias length: 4];
|
[bytes appendBytes: &lBias length: 4];
|
||||||
|
|
Loading…
Reference in New Issue