Monotone-Parent: fe708fac93fc55eeea8eeef0dedf137ce1316fd0

Monotone-Revision: 8938a93c5d8a73495a153d6ff7e5a25d822508b6

Monotone-Author: wsourdeau@inverse.ca
Monotone-Date: 2010-11-05T23:21:09
Monotone-Branch: ca.inverse.sogo
maint-2.0.2
Wolfgang Sourdeau 2010-11-05 23:21:09 +00:00
parent f8dd432d65
commit 637c856218
7 changed files with 58 additions and 23 deletions

View File

@ -1,5 +1,10 @@
2010-11-05 Wolfgang Sourdeau <wsourdeau@inverse.ca>
* OpenChange/NSDate+MAPIStore.[hm]: this module now implements a
category for NSDate rather than NSCalendarDate.
(+dateFromFileTime): new method that returns an NSDate from a
struct FILETIME
* SoObjects/Appointments/SOGoAptMailReceipt.m (-getSubject)
(-getBody): invoked setupValues if values is nil to ensure that
the timezone has been set properly.

View File

@ -41,7 +41,7 @@ $(MAPISTORESOGO)_OBJC_FILES += \
\
NSArray+MAPIStore.m \
NSData+MAPIStore.m \
NSCalendarDate+MAPIStore.m \
NSDate+MAPIStore.m \
NSString+MAPIStore.m
-include GNUmakefile.preamble

View File

@ -29,7 +29,7 @@
#import "MAPIApplication.h"
#import "MAPIStoreAuthenticator.h"
#import "NSCalendarDate+MAPIStore.h"
#import "NSDate+MAPIStore.h"
#import "NSString+MAPIStore.h"
#import "SOGoGCSFolder+MAPIStore.h"

View File

@ -20,6 +20,8 @@
* Boston, MA 02111-1307, USA.
*/
#import <Foundation/NSCalendarDate.h>
#import <NGObjWeb/WOContext+SoObjects.h>
#import <NGImap4/NGImap4EnvelopeAddress.h>
@ -33,7 +35,7 @@
#import "MAPIApplication.h"
#import "MAPIStoreAuthenticator.h"
#import "NSData+MAPIStore.h"
#import "NSCalendarDate+MAPIStore.h"
#import "NSDate+MAPIStore.h"
#import "NSString+MAPIStore.h"
#import "MAPIStoreMailContext.h"
@ -116,7 +118,7 @@ static Class SOGoUserFolderK;
withFID: (uint64_t) fid
{
id child;
NSCalendarDate *offsetDate;
NSDate *offsetDate;
int rc;
rc = MAPI_E_SUCCESS;
@ -167,7 +169,7 @@ static Class SOGoUserFolderK;
case PR_EXPIRY_TIME: // TODO
case PR_REPLY_TIME:
*data = [[NSCalendarDate date] asFileTimeInMemCtx: memCtx];
*data = [[NSDate date] asFileTimeInMemCtx: memCtx];
break;
case PR_BODY:

View File

@ -27,7 +27,7 @@
#import "MAPIApplication.h"
#import "MAPIStoreAuthenticator.h"
#import "NSCalendarDate+MAPIStore.h"
#import "NSDate+MAPIStore.h"
#import "NSString+MAPIStore.h"
#import "SOGoGCSFolder+MAPIStore.h"

View File

@ -1,4 +1,4 @@
/* NSCalendarDate+MAPIStore.h - this file is part of SOGo
/* NSDate+MAPIStore.h - this file is part of SOGo
*
* Copyright (C) 2010 Inverse inc.
*
@ -23,9 +23,11 @@
#ifndef NSCALENDARDATE_MAPISTORE_H
#define NSCALENDARDATE_MAPISTORE_H
#import <Foundation/NSCalendarDate.h>
#import <Foundation/NSDate.h>
@interface NSCalendarDate (MAPIStoreDataTypes)
@interface NSDate (MAPIStoreDataTypes)
+ (id) dateFromFileTime: (struct FILETIME *) timeValue;
- (struct FILETIME *) asFileTimeInMemCtx: (void *) memCtx;

View File

@ -1,4 +1,4 @@
/* NSCalendarDate+MAPIStore.m - this file is part of SOGo
/* NSDate+MAPIStore.m - this file is part of SOGo
*
* Copyright (C) 2010 Inverse inc.
*
@ -20,34 +20,60 @@
* Boston, MA 02111-1307, USA.
*/
#import <Foundation/NSCalendarDate.h>
#import <Foundation/NSString.h>
#import <Foundation/NSTimeZone.h>
#import "NSCalendarDate+MAPIStore.h"
#import "NSDate+MAPIStore.h"
#undef DEBUG
#include <mapistore/mapistore.h>
#include <talloc.h>
@implementation NSCalendarDate (MAPIStoreDataTypes)
static NSDate *refDate = nil;
- (struct FILETIME *) asFileTimeInMemCtx: (void *) memCtx
@implementation NSDate (MAPIStoreDataTypes)
static void
_setupRefDate()
{
static NSCalendarDate *refDate = nil;
struct FILETIME *timeValue;
NSTimeZone *utc;
utc = [NSTimeZone timeZoneWithName: @"UTC"];
refDate = [NSCalendarDate dateWithYear: 1601 month: 1 day: 1
hour: 0 minute: 0 second: 0
timeZone: utc];
[refDate retain];
}
+ (id) dateFromFileTime: (struct FILETIME *) timeValue
{
NSDate *result;
uint64_t interval;
if (!refDate)
{
utc = [NSTimeZone timeZoneWithName: @"UTC"];
refDate = [NSCalendarDate dateWithYear: 1601 month: 1 day: 1
hour: 0 minute: 0 second: 0
timeZone: utc];
[refDate retain];
}
_setupRefDate ();
interval = ((uint64_t) timeValue->dwHighDateTime << 32
| timeValue->dwLowDateTime);
result = [[NSDate alloc]
initWithTimeInterval: (NSTimeInterval) interval / 10000000
sinceDate: refDate];
[result autorelease];
return result;
}
- (struct FILETIME *) asFileTimeInMemCtx: (void *) memCtx
{
struct FILETIME *timeValue;
uint64_t interval;
if (!refDate)
_setupRefDate ();
interval = (((uint64_t) [self timeIntervalSinceDate: refDate]) * 10000000);
timeValue = talloc_zero(memCtx, struct FILETIME);
timeValue = talloc_zero (memCtx, struct FILETIME);
timeValue->dwLowDateTime = (uint32_t) (interval & 0xffffffff);
timeValue->dwHighDateTime = (uint32_t) ((interval >> 32) & 0xffffffff);