Merge pull request #71 from Zentyal/ejhernandez/filetime-utc
Use PT_SYSTIME as absolute timestamp
This commit is contained in:
commit
8e41e5d665
|
@ -29,7 +29,6 @@
|
||||||
#import <Foundation/NSData.h>
|
#import <Foundation/NSData.h>
|
||||||
#import <Foundation/NSDictionary.h>
|
#import <Foundation/NSDictionary.h>
|
||||||
#import <Foundation/NSString.h>
|
#import <Foundation/NSString.h>
|
||||||
#import <Foundation/NSTimeZone.h>
|
|
||||||
#import <Foundation/NSValue.h>
|
#import <Foundation/NSValue.h>
|
||||||
#import <NGExtensions/NGHashMap.h>
|
#import <NGExtensions/NGHashMap.h>
|
||||||
#import <NGExtensions/NSObject+Logs.h>
|
#import <NGExtensions/NSObject+Logs.h>
|
||||||
|
@ -673,8 +672,6 @@ FillMessageHeadersFromProperties (NGMutableHashMap *headers,
|
||||||
date = [mailProperties objectForKey: MAPIPropertyKey (PR_CLIENT_SUBMIT_TIME)];
|
date = [mailProperties objectForKey: MAPIPropertyKey (PR_CLIENT_SUBMIT_TIME)];
|
||||||
if (date)
|
if (date)
|
||||||
{
|
{
|
||||||
date = [date addYear: 0 month: 0 day: 0
|
|
||||||
hour: 0 minute: 0 second: [[date timeZone] secondsFromGMT]];
|
|
||||||
[headers addObject: [date rfc822DateString] forKey: @"date"];
|
[headers addObject: [date rfc822DateString] forKey: @"date"];
|
||||||
}
|
}
|
||||||
[headers addObject: @"1.0" forKey: @"MIME-Version"];
|
[headers addObject: @"1.0" forKey: @"MIME-Version"];
|
||||||
|
|
|
@ -23,7 +23,6 @@
|
||||||
#import <Foundation/NSArray.h>
|
#import <Foundation/NSArray.h>
|
||||||
#import <Foundation/NSCalendarDate.h>
|
#import <Foundation/NSCalendarDate.h>
|
||||||
#import <Foundation/NSDictionary.h>
|
#import <Foundation/NSDictionary.h>
|
||||||
#import <Foundation/NSTimeZone.h>
|
|
||||||
#import <NGExtensions/NSObject+Logs.h>
|
#import <NGExtensions/NSObject+Logs.h>
|
||||||
#import <SOGo/SOGoObject.h>
|
#import <SOGo/SOGoObject.h>
|
||||||
#import <SOGo/SOGoUser.h>
|
#import <SOGo/SOGoUser.h>
|
||||||
|
@ -245,13 +244,8 @@ static Class NSExceptionK, MAPIStoreFolderK;
|
||||||
struct SPropValue *cValue;
|
struct SPropValue *cValue;
|
||||||
NSUInteger counter;
|
NSUInteger counter;
|
||||||
NSMutableDictionary *newProperties;
|
NSMutableDictionary *newProperties;
|
||||||
NSTimeZone *tz;
|
|
||||||
NSInteger tzOffset;
|
|
||||||
id value;
|
id value;
|
||||||
|
|
||||||
tz = nil;
|
|
||||||
tzOffset = 0;
|
|
||||||
|
|
||||||
newProperties = [NSMutableDictionary dictionaryWithCapacity: aRow->cValues];
|
newProperties = [NSMutableDictionary dictionaryWithCapacity: aRow->cValues];
|
||||||
for (counter = 0; counter < aRow->cValues; counter++)
|
for (counter = 0; counter < aRow->cValues; counter++)
|
||||||
{
|
{
|
||||||
|
@ -268,16 +262,6 @@ static Class NSExceptionK, MAPIStoreFolderK;
|
||||||
@"attempting to set string property as PR_STRING8: %.8x",
|
@"attempting to set string property as PR_STRING8: %.8x",
|
||||||
cValue->ulPropTag];
|
cValue->ulPropTag];
|
||||||
break;
|
break;
|
||||||
case PT_SYSTIME:
|
|
||||||
if (!tz)
|
|
||||||
{
|
|
||||||
tz = [[self userContext] timeZone];
|
|
||||||
tzOffset = -[tz secondsFromGMT];
|
|
||||||
}
|
|
||||||
value = [value addYear: 0 month: 0 day: 0
|
|
||||||
hour: 0 minute: 0 second: tzOffset];
|
|
||||||
[value setTimeZone: tz];
|
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
[newProperties setObject: value
|
[newProperties setObject: value
|
||||||
forKey: MAPIPropertyKey (cValue->ulPropTag)];
|
forKey: MAPIPropertyKey (cValue->ulPropTag)];
|
||||||
|
|
|
@ -367,13 +367,15 @@
|
||||||
NSString *status, *priority, *tzName;
|
NSString *status, *priority, *tzName;
|
||||||
NSCalendarDate *now;
|
NSCalendarDate *now;
|
||||||
NSInteger tzOffset;
|
NSInteger tzOffset;
|
||||||
|
NSTimeZone *userTZ;
|
||||||
double doubleValue;
|
double doubleValue;
|
||||||
|
|
||||||
vToDo = [sogoObject component: YES secure: NO];
|
vToDo = [sogoObject component: YES secure: NO];
|
||||||
vCalendar = [vToDo parent];
|
vCalendar = [vToDo parent];
|
||||||
[vCalendar setProdID: @"-//Inverse inc.//OpenChange+SOGo//EN"];
|
[vCalendar setProdID: @"-//Inverse inc.//OpenChange+SOGo//EN"];
|
||||||
|
|
||||||
tzName = [[[self userContext] timeZone] name];
|
userTZ = [[self userContext] timeZone];
|
||||||
|
tzName = [userTZ name];
|
||||||
tz = [iCalTimeZone timeZoneForName: tzName];
|
tz = [iCalTimeZone timeZoneForName: tzName];
|
||||||
[vCalendar addTimeZone: tz];
|
[vCalendar addTimeZone: tz];
|
||||||
|
|
||||||
|
@ -428,6 +430,13 @@
|
||||||
{
|
{
|
||||||
date = (iCalDateTime *) [vToDo uniqueChildWithTag: @"dtstart"];
|
date = (iCalDateTime *) [vToDo uniqueChildWithTag: @"dtstart"];
|
||||||
[date setTimeZone: tz];
|
[date setTimeZone: tz];
|
||||||
|
/* The property is set to user's local time zone.
|
||||||
|
See: [MS-OXOTASK] 2.2.2.2.4
|
||||||
|
TODO: Ignore when the PT_SYSTIME is 0x5AE980E0*/
|
||||||
|
tzOffset = [userTZ secondsFromGMTForDate: value];
|
||||||
|
value = [value dateByAddingYears: 0 months: 0 days: 0
|
||||||
|
hours: 0 minutes: 0
|
||||||
|
seconds: -tzOffset];
|
||||||
[date setDateTime: value];
|
[date setDateTime: value];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -437,6 +446,13 @@
|
||||||
{
|
{
|
||||||
date = (iCalDateTime *) [vToDo uniqueChildWithTag: @"due"];
|
date = (iCalDateTime *) [vToDo uniqueChildWithTag: @"due"];
|
||||||
[date setTimeZone: tz];
|
[date setTimeZone: tz];
|
||||||
|
/* The property is set to user's local time zone.
|
||||||
|
See: [MS-OXOTASK] 2.2.2.2.5
|
||||||
|
TODO: Ignore when the PT_SYSTIME is 0x5AE980E0*/
|
||||||
|
tzOffset = [userTZ secondsFromGMTForDate: value];
|
||||||
|
value = [value dateByAddingYears: 0 months: 0 days: 0
|
||||||
|
hours: 0 minutes: 0
|
||||||
|
seconds: -tzOffset];
|
||||||
[date setDateTime: value];
|
[date setDateTime: value];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -445,7 +461,9 @@
|
||||||
if (value)
|
if (value)
|
||||||
{
|
{
|
||||||
date = (iCalDateTime *) [vToDo uniqueChildWithTag: @"completed"];
|
date = (iCalDateTime *) [vToDo uniqueChildWithTag: @"completed"];
|
||||||
tzOffset = [[value timeZone] secondsFromGMTForDate: value];
|
/* The property is set to midnight in local time zone converted to UTC:
|
||||||
|
See: [MS-OXOTASK] 2.2.2.2.9 */
|
||||||
|
tzOffset = [userTZ secondsFromGMTForDate: value];
|
||||||
value = [value dateByAddingYears: 0 months: 0 days: 0
|
value = [value dateByAddingYears: 0 months: 0 days: 0
|
||||||
hours: 0 minutes: 0
|
hours: 0 minutes: 0
|
||||||
seconds: -tzOffset];
|
seconds: -tzOffset];
|
||||||
|
|
|
@ -119,6 +119,7 @@ NSObjectFromMAPISPropValue (const struct mapi_SPropValue *value)
|
||||||
break;
|
break;
|
||||||
case PT_SYSTIME:
|
case PT_SYSTIME:
|
||||||
result = [NSCalendarDate dateFromFileTime: &(value->value.ft)];
|
result = [NSCalendarDate dateFromFileTime: &(value->value.ft)];
|
||||||
|
[result setTimeZone: utcTZ];
|
||||||
break;
|
break;
|
||||||
case PT_BINARY:
|
case PT_BINARY:
|
||||||
case PT_SVREID:
|
case PT_SVREID:
|
||||||
|
|
|
@ -207,16 +207,7 @@
|
||||||
value
|
value
|
||||||
= [properties objectForKey: MAPIPropertyKey (PidLidExceptionReplaceTime)];
|
= [properties objectForKey: MAPIPropertyKey (PidLidExceptionReplaceTime)];
|
||||||
if (value)
|
if (value)
|
||||||
{
|
|
||||||
if (!isAllDay)
|
|
||||||
{
|
|
||||||
tzOffset = [userTimeZone secondsFromGMTForDate: value];
|
|
||||||
value = [value dateByAddingYears: 0 months: 0 days: 0
|
|
||||||
hours: 0 minutes: 0
|
|
||||||
seconds: tzOffset];
|
|
||||||
}
|
|
||||||
[self setRecurrenceId: value];
|
[self setRecurrenceId: value];
|
||||||
}
|
|
||||||
|
|
||||||
// start
|
// start
|
||||||
value = [properties objectForKey: MAPIPropertyKey (PidLidAppointmentStartWhole)];
|
value = [properties objectForKey: MAPIPropertyKey (PidLidAppointmentStartWhole)];
|
||||||
|
@ -241,14 +232,8 @@
|
||||||
[start setTimeZone: nil];
|
[start setTimeZone: nil];
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
|
||||||
tzOffset = [userTimeZone secondsFromGMTForDate: value];
|
|
||||||
value = [value dateByAddingYears: 0 months: 0 days: 0
|
|
||||||
hours: 0 minutes: 0
|
|
||||||
seconds: tzOffset];
|
|
||||||
[start setDateTime: value];
|
[start setDateTime: value];
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
/* end */
|
/* end */
|
||||||
value = [properties objectForKey: MAPIPropertyKey (PidLidAppointmentEndWhole)];
|
value = [properties objectForKey: MAPIPropertyKey (PidLidAppointmentEndWhole)];
|
||||||
|
@ -273,14 +258,8 @@
|
||||||
[end setTimeZone: nil];
|
[end setTimeZone: nil];
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
|
||||||
tzOffset = [[value timeZone] secondsFromGMTForDate: value];
|
|
||||||
value = [value dateByAddingYears: 0 months: 0 days: 0
|
|
||||||
hours: 0 minutes: 0
|
|
||||||
seconds: tzOffset];
|
|
||||||
[end setDateTime: value];
|
[end setDateTime: value];
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
/* priority */
|
/* priority */
|
||||||
value = [properties objectForKey: MAPIPropertyKey(PR_IMPORTANCE)];
|
value = [properties objectForKey: MAPIPropertyKey(PR_IMPORTANCE)];
|
||||||
|
|
Loading…
Reference in a new issue