Monotone-Parent: ec16bdb7ba63858784457e5200d914d15be4c55e
Monotone-Revision: bae3f2d15f56ace2300155adab60e9293a29ea32 Monotone-Author: wsourdeau@inverse.ca Monotone-Date: 2011-10-11T19:46:02 Monotone-Branch: ca.inverse.sogo
This commit is contained in:
parent
f15be9f23b
commit
8c929bc16b
26
ChangeLog
26
ChangeLog
|
@ -1,4 +1,28 @@
|
||||||
2011-10-09 Wolfgang Sourdeau <wsourdeau@inverse.ca>
|
2011-10-11 Wolfgang Sourdeau <wsourdeau@inverse.ca>
|
||||||
|
|
||||||
|
* OpenChange/MAPIStoreAppointmentWrapper.m
|
||||||
|
(-getPidLidReminderSet:inMemCtx:)
|
||||||
|
(-getPidLidReminderDelta:inMemCtx:)
|
||||||
|
(-getPidLidReminderTime:inMemCtx:)
|
||||||
|
(-getPidLidReminderSignalTime:inMemCtx:)
|
||||||
|
(-getPidLidReminderOverride:inMemCtx:)
|
||||||
|
(-getPidLidReminderType:inMemCtx:)
|
||||||
|
(-getPidLidReminderPlaySound:inMemCtx:)
|
||||||
|
(-getPidLidReminderFileParameter:inMemCtx:): implemented those
|
||||||
|
alarm-related getters (see OXORMDR).
|
||||||
|
|
||||||
|
* OpenChange/MAPIStoreCalendarMessage.m (_setupAlarmDataInEvent:):
|
||||||
|
new method invoked from -save that sets VALARM elements on the
|
||||||
|
current event based on the PidLidReminder* properties.
|
||||||
|
(-getPidLidReminderSet:inMemCtx:)
|
||||||
|
(-getPidLidReminderDelta:inMemCtx:)
|
||||||
|
(-getPidLidReminderTime:inMemCtx:)
|
||||||
|
(-getPidLidReminderSignalTime:inMemCtx:)
|
||||||
|
(-getPidLidReminderOverride:inMemCtx:)
|
||||||
|
(-getPidLidReminderType:inMemCtx:)
|
||||||
|
(-getPidLidReminderPlaySound:inMemCtx:)
|
||||||
|
(-getPidLidReminderFileParameter:inMemCtx:): new alarm-related
|
||||||
|
forwarders to homonymous methods in MAPIStoreAppointmentWrapper.
|
||||||
|
|
||||||
* OpenChange/MAPIStoreMailFolder.m (-synchroniseCache): improved
|
* OpenChange/MAPIStoreMailFolder.m (-synchroniseCache): improved
|
||||||
method to only fetch non-deleted messages in part 1, and to
|
method to only fetch non-deleted messages in part 1, and to
|
||||||
|
|
|
@ -29,6 +29,7 @@
|
||||||
|
|
||||||
@class NSTimeZone;
|
@class NSTimeZone;
|
||||||
|
|
||||||
|
@class iCalAlarm;
|
||||||
@class iCalCalendar;
|
@class iCalCalendar;
|
||||||
@class iCalEvent;
|
@class iCalEvent;
|
||||||
|
|
||||||
|
@ -44,6 +45,8 @@ extern NSTimeZone *utcTZ;
|
||||||
NSData *globalObjectId;
|
NSData *globalObjectId;
|
||||||
NSData *cleanGlobalObjectId;
|
NSData *cleanGlobalObjectId;
|
||||||
SOGoUser *user;
|
SOGoUser *user;
|
||||||
|
BOOL alarmSet;
|
||||||
|
iCalAlarm *alarm;
|
||||||
}
|
}
|
||||||
|
|
||||||
+ (id) wrapperWithICalEvent: (iCalEvent *) newEvent
|
+ (id) wrapperWithICalEvent: (iCalEvent *) newEvent
|
||||||
|
@ -137,6 +140,24 @@ extern NSTimeZone *utcTZ;
|
||||||
- (int) getPidLidAppointmentReplyTime: (void **) data
|
- (int) getPidLidAppointmentReplyTime: (void **) data
|
||||||
inMemCtx: (TALLOC_CTX *) memCtx;
|
inMemCtx: (TALLOC_CTX *) memCtx;
|
||||||
|
|
||||||
|
/* reminders */
|
||||||
|
- (int) getPidLidReminderSet: (void **) data
|
||||||
|
inMemCtx: (TALLOC_CTX *) memCtx;
|
||||||
|
- (int) getPidLidReminderDelta: (void **) data
|
||||||
|
inMemCtx: (TALLOC_CTX *) memCtx;
|
||||||
|
- (int) getPidLidReminderTime: (void **) data
|
||||||
|
inMemCtx: (TALLOC_CTX *) memCtx;
|
||||||
|
- (int) getPidLidReminderSignalTime: (void **) data
|
||||||
|
inMemCtx: (TALLOC_CTX *) memCtx;
|
||||||
|
- (int) getPidLidReminderOverride: (void **) data
|
||||||
|
inMemCtx: (TALLOC_CTX *) memCtx;
|
||||||
|
- (int) getPidLidReminderType: (void **) data
|
||||||
|
inMemCtx: (TALLOC_CTX *) memCtx;
|
||||||
|
- (int) getPidLidReminderPlaySound: (void **) data
|
||||||
|
inMemCtx: (TALLOC_CTX *) memCtx;
|
||||||
|
- (int) getPidLidReminderFileParameter: (void **) data
|
||||||
|
inMemCtx: (TALLOC_CTX *) memCtx;
|
||||||
|
|
||||||
@end
|
@end
|
||||||
|
|
||||||
#endif /* MAPISTORECALENDARWRAPPER_H */
|
#endif /* MAPISTORECALENDARWRAPPER_H */
|
||||||
|
|
|
@ -27,11 +27,14 @@
|
||||||
#import <Foundation/NSDictionary.h>
|
#import <Foundation/NSDictionary.h>
|
||||||
#import <Foundation/NSTimeZone.h>
|
#import <Foundation/NSTimeZone.h>
|
||||||
#import <NGExtensions/NSObject+Logs.h>
|
#import <NGExtensions/NSObject+Logs.h>
|
||||||
|
#import <NGCards/iCalAlarm.h>
|
||||||
#import <NGCards/iCalDateTime.h>
|
#import <NGCards/iCalDateTime.h>
|
||||||
#import <NGCards/iCalEvent.h>
|
#import <NGCards/iCalEvent.h>
|
||||||
|
#import <NGCards/iCalPerson.h>
|
||||||
#import <NGCards/iCalRecurrenceRule.h>
|
#import <NGCards/iCalRecurrenceRule.h>
|
||||||
#import <NGCards/iCalTimeZone.h>
|
#import <NGCards/iCalTimeZone.h>
|
||||||
#import <NGCards/iCalPerson.h>
|
#import <NGCards/iCalTrigger.h>
|
||||||
|
#import <NGCards/NSString+NGCards.h>
|
||||||
#import <SOGo/SOGoUserManager.h>
|
#import <SOGo/SOGoUserManager.h>
|
||||||
|
|
||||||
#import "MAPIStoreMessage.h"
|
#import "MAPIStoreMessage.h"
|
||||||
|
@ -96,6 +99,8 @@ static NSCharacterSet *hexCharacterSet = nil;
|
||||||
globalObjectId = nil;
|
globalObjectId = nil;
|
||||||
cleanGlobalObjectId = nil;
|
cleanGlobalObjectId = nil;
|
||||||
user = nil;
|
user = nil;
|
||||||
|
alarmSet = NO;
|
||||||
|
alarm = nil;
|
||||||
}
|
}
|
||||||
|
|
||||||
return self;
|
return self;
|
||||||
|
@ -124,6 +129,7 @@ static NSCharacterSet *hexCharacterSet = nil;
|
||||||
[globalObjectId release];
|
[globalObjectId release];
|
||||||
[cleanGlobalObjectId release];
|
[cleanGlobalObjectId release];
|
||||||
[user release];
|
[user release];
|
||||||
|
[alarm release];
|
||||||
[super dealloc];
|
[super dealloc];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1176,4 +1182,154 @@ _fillAppointmentRecurrencePattern (struct AppointmentRecurrencePattern *arp,
|
||||||
return rc;
|
return rc;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* reminders */
|
||||||
|
- (void) _setupAlarm
|
||||||
|
{
|
||||||
|
NSArray *alarms;
|
||||||
|
NSUInteger count, max;
|
||||||
|
iCalAlarm *currentAlarm;
|
||||||
|
NSString *action;
|
||||||
|
|
||||||
|
alarms = [event alarms];
|
||||||
|
max = [alarms count];
|
||||||
|
for (count = 0; !alarm && count < max; count++)
|
||||||
|
{
|
||||||
|
currentAlarm = [alarms objectAtIndex: count];
|
||||||
|
action = [[currentAlarm action] lowercaseString];
|
||||||
|
if (!action || [action isEqualToString: @"display"])
|
||||||
|
ASSIGN (alarm, currentAlarm);
|
||||||
|
}
|
||||||
|
|
||||||
|
alarmSet = YES;
|
||||||
|
}
|
||||||
|
|
||||||
|
- (int) getPidLidReminderSet: (void **) data
|
||||||
|
inMemCtx: (TALLOC_CTX *) memCtx
|
||||||
|
{
|
||||||
|
if (!alarmSet)
|
||||||
|
[self _setupAlarm];
|
||||||
|
|
||||||
|
*data = MAPIBoolValue (memCtx, (alarm != nil));
|
||||||
|
|
||||||
|
return MAPISTORE_SUCCESS;
|
||||||
|
}
|
||||||
|
|
||||||
|
- (int) getPidLidReminderTime: (void **) data
|
||||||
|
inMemCtx: (TALLOC_CTX *) memCtx
|
||||||
|
{
|
||||||
|
if (!alarmSet)
|
||||||
|
[self _setupAlarm];
|
||||||
|
|
||||||
|
return (alarm
|
||||||
|
? [self getPrStartDate: data inMemCtx: memCtx]
|
||||||
|
: MAPISTORE_ERR_NOT_FOUND);
|
||||||
|
}
|
||||||
|
|
||||||
|
- (int) getPidLidReminderDelta: (void **) data
|
||||||
|
inMemCtx: (TALLOC_CTX *) memCtx
|
||||||
|
{
|
||||||
|
int rc = MAPISTORE_ERR_NOT_FOUND;
|
||||||
|
iCalTrigger *trigger;
|
||||||
|
NSCalendarDate *startDate, *relationDate, *alarmDate;
|
||||||
|
NSTimeInterval interval;
|
||||||
|
NSString *relation;
|
||||||
|
|
||||||
|
if (!alarmSet)
|
||||||
|
[self _setupAlarm];
|
||||||
|
|
||||||
|
if (alarm)
|
||||||
|
{
|
||||||
|
trigger = [alarm trigger];
|
||||||
|
if ([[trigger valueType] caseInsensitiveCompare: @"DURATION"] == NSOrderedSame)
|
||||||
|
{
|
||||||
|
startDate = [event startDate];
|
||||||
|
relation = [[trigger relationType] lowercaseString];
|
||||||
|
interval = [[trigger value] durationAsTimeInterval];
|
||||||
|
if ([relation isEqualToString: @"end"])
|
||||||
|
relationDate = [event endDate];
|
||||||
|
else
|
||||||
|
relationDate = startDate;
|
||||||
|
|
||||||
|
// Compute the next alarm date with respect to the reference date
|
||||||
|
if (relationDate)
|
||||||
|
{
|
||||||
|
alarmDate = [relationDate addTimeInterval: interval];
|
||||||
|
interval = [startDate timeIntervalSinceDate: alarmDate];
|
||||||
|
*data = MAPILongValue (memCtx, (int) (interval / 60));
|
||||||
|
rc = MAPISTORE_SUCCESS;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return rc;
|
||||||
|
}
|
||||||
|
|
||||||
|
- (int) getPidLidReminderSignalTime: (void **) data
|
||||||
|
inMemCtx: (TALLOC_CTX *) memCtx
|
||||||
|
{
|
||||||
|
int rc = MAPISTORE_SUCCESS;
|
||||||
|
NSCalendarDate *alarmDate;
|
||||||
|
|
||||||
|
if (!alarmSet)
|
||||||
|
[self _setupAlarm];
|
||||||
|
|
||||||
|
if (alarm)
|
||||||
|
{
|
||||||
|
alarmDate = [alarm nextAlarmDate];
|
||||||
|
[alarmDate setTimeZone: utcTZ];
|
||||||
|
*data = [alarmDate asFileTimeInMemCtx: memCtx];
|
||||||
|
}
|
||||||
|
else
|
||||||
|
rc = MAPISTORE_ERR_NOT_FOUND;
|
||||||
|
|
||||||
|
return rc;
|
||||||
|
}
|
||||||
|
|
||||||
|
- (int) getPidLidReminderOverride: (void **) data
|
||||||
|
inMemCtx: (TALLOC_CTX *) memCtx
|
||||||
|
{
|
||||||
|
int rc = MAPISTORE_SUCCESS;
|
||||||
|
|
||||||
|
if (!alarmSet)
|
||||||
|
[self _setupAlarm];
|
||||||
|
|
||||||
|
if (alarm)
|
||||||
|
*data = MAPIBoolValue (memCtx, YES);
|
||||||
|
else
|
||||||
|
rc = MAPISTORE_ERR_NOT_FOUND;
|
||||||
|
|
||||||
|
return rc;
|
||||||
|
}
|
||||||
|
|
||||||
|
- (int) getPidLidReminderPlaySound: (void **) data
|
||||||
|
inMemCtx: (TALLOC_CTX *) memCtx
|
||||||
|
{
|
||||||
|
int rc = MAPISTORE_SUCCESS;
|
||||||
|
|
||||||
|
if (!alarmSet)
|
||||||
|
[self _setupAlarm];
|
||||||
|
|
||||||
|
if (alarm)
|
||||||
|
*data = MAPIBoolValue (memCtx, YES);
|
||||||
|
else
|
||||||
|
rc = MAPISTORE_ERR_NOT_FOUND;
|
||||||
|
|
||||||
|
return rc;
|
||||||
|
}
|
||||||
|
|
||||||
|
- (int) getPidLidReminderFileParameter: (void **) data
|
||||||
|
inMemCtx: (TALLOC_CTX *) memCtx
|
||||||
|
{
|
||||||
|
// if (!alarmSet)
|
||||||
|
// [self _setupAlarm];
|
||||||
|
|
||||||
|
return MAPISTORE_ERR_NOT_FOUND;
|
||||||
|
}
|
||||||
|
|
||||||
|
- (int) getPidLidReminderType: (void **) data
|
||||||
|
inMemCtx: (TALLOC_CTX *) memCtx
|
||||||
|
{
|
||||||
|
return MAPISTORE_ERR_NOT_FOUND;
|
||||||
|
}
|
||||||
|
|
||||||
@end
|
@end
|
||||||
|
|
|
@ -34,11 +34,13 @@
|
||||||
#import <Foundation/NSTimeZone.h>
|
#import <Foundation/NSTimeZone.h>
|
||||||
#import <NGObjWeb/WOContext+SoObjects.h>
|
#import <NGObjWeb/WOContext+SoObjects.h>
|
||||||
#import <NGExtensions/NSObject+Logs.h>
|
#import <NGExtensions/NSObject+Logs.h>
|
||||||
|
#import <NGCards/iCalAlarm.h>
|
||||||
#import <NGCards/iCalCalendar.h>
|
#import <NGCards/iCalCalendar.h>
|
||||||
#import <NGCards/iCalEvent.h>
|
#import <NGCards/iCalEvent.h>
|
||||||
#import <NGCards/iCalDateTime.h>
|
#import <NGCards/iCalDateTime.h>
|
||||||
#import <NGCards/iCalPerson.h>
|
#import <NGCards/iCalPerson.h>
|
||||||
#import <NGCards/iCalTimeZone.h>
|
#import <NGCards/iCalTimeZone.h>
|
||||||
|
#import <NGCards/iCalTrigger.h>
|
||||||
#import <SOGo/SOGoUser.h>
|
#import <SOGo/SOGoUser.h>
|
||||||
#import <Appointments/SOGoAppointmentFolder.h>
|
#import <Appointments/SOGoAppointmentFolder.h>
|
||||||
#import <Appointments/SOGoAppointmentObject.h>
|
#import <Appointments/SOGoAppointmentObject.h>
|
||||||
|
@ -417,6 +419,63 @@
|
||||||
return [self getYes: data inMemCtx: memCtx];
|
return [self getYes: data inMemCtx: memCtx];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* alarms */
|
||||||
|
- (int) getPidLidReminderSet: (void **) data
|
||||||
|
inMemCtx: (TALLOC_CTX *) memCtx
|
||||||
|
{
|
||||||
|
return [[self appointmentWrapper] getPidLidReminderSet: data
|
||||||
|
inMemCtx: memCtx];
|
||||||
|
}
|
||||||
|
|
||||||
|
- (int) getPidLidReminderDelta: (void **) data
|
||||||
|
inMemCtx: (TALLOC_CTX *) memCtx
|
||||||
|
{
|
||||||
|
return [[self appointmentWrapper] getPidLidReminderDelta: data
|
||||||
|
inMemCtx: memCtx];
|
||||||
|
}
|
||||||
|
|
||||||
|
- (int) getPidLidReminderTime: (void **) data
|
||||||
|
inMemCtx: (TALLOC_CTX *) memCtx
|
||||||
|
{
|
||||||
|
return [[self appointmentWrapper] getPidLidReminderTime: data
|
||||||
|
inMemCtx: memCtx];
|
||||||
|
}
|
||||||
|
|
||||||
|
- (int) getPidLidReminderSignalTime: (void **) data
|
||||||
|
inMemCtx: (TALLOC_CTX *) memCtx
|
||||||
|
{
|
||||||
|
return [[self appointmentWrapper] getPidLidReminderSignalTime: data
|
||||||
|
inMemCtx: memCtx];
|
||||||
|
}
|
||||||
|
|
||||||
|
- (int) getPidLidReminderOverride: (void **) data
|
||||||
|
inMemCtx: (TALLOC_CTX *) memCtx
|
||||||
|
{
|
||||||
|
return [[self appointmentWrapper] getPidLidReminderOverride: data
|
||||||
|
inMemCtx: memCtx];
|
||||||
|
}
|
||||||
|
|
||||||
|
- (int) getPidLidReminderType: (void **) data
|
||||||
|
inMemCtx: (TALLOC_CTX *) memCtx
|
||||||
|
{
|
||||||
|
return [[self appointmentWrapper] getPidLidReminderType: data
|
||||||
|
inMemCtx: memCtx];
|
||||||
|
}
|
||||||
|
|
||||||
|
- (int) getPidLidReminderPlaySound: (void **) data
|
||||||
|
inMemCtx: (TALLOC_CTX *) memCtx
|
||||||
|
{
|
||||||
|
return [[self appointmentWrapper] getPidLidReminderPlaySound: data
|
||||||
|
inMemCtx: memCtx];
|
||||||
|
}
|
||||||
|
|
||||||
|
- (int) getPidLidReminderFileParameter: (void **) data
|
||||||
|
inMemCtx: (TALLOC_CTX *) memCtx
|
||||||
|
{
|
||||||
|
return [[self appointmentWrapper] getPidLidReminderFileParameter: data
|
||||||
|
inMemCtx: memCtx];
|
||||||
|
}
|
||||||
|
|
||||||
/* attendee */
|
/* attendee */
|
||||||
- (void) _setupRecurrenceInCalendar: (iCalCalendar *) calendar
|
- (void) _setupRecurrenceInCalendar: (iCalCalendar *) calendar
|
||||||
withEvent: (iCalEvent *) event
|
withEvent: (iCalEvent *) event
|
||||||
|
@ -505,6 +564,48 @@
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
- (void) _setupAlarmDataInEvent: (iCalEvent *) newEvent
|
||||||
|
{
|
||||||
|
NSArray *alarms;
|
||||||
|
iCalAlarm *currentAlarm, *alarm = nil;
|
||||||
|
iCalTrigger *trigger;
|
||||||
|
NSNumber *delta;
|
||||||
|
NSString *action;
|
||||||
|
NSUInteger count, max;
|
||||||
|
|
||||||
|
/* find and remove first display alarm */
|
||||||
|
alarms = [newEvent alarms];
|
||||||
|
max = [alarms count];
|
||||||
|
for (count = 0; !alarm && count < max; count++)
|
||||||
|
{
|
||||||
|
currentAlarm = [alarms objectAtIndex: count];
|
||||||
|
action = [[currentAlarm action] lowercaseString];
|
||||||
|
if (!action || [action isEqualToString: @"display"])
|
||||||
|
alarm = currentAlarm;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (alarm)
|
||||||
|
[newEvent removeChild: alarm];
|
||||||
|
|
||||||
|
if ([[newProperties objectForKey: MAPIPropertyKey (PidLidReminderSet)]
|
||||||
|
boolValue])
|
||||||
|
{
|
||||||
|
delta = [newProperties
|
||||||
|
objectForKey: MAPIPropertyKey (PidLidReminderDelta)];
|
||||||
|
if (delta)
|
||||||
|
{
|
||||||
|
alarm = [iCalAlarm new];
|
||||||
|
[alarm setAction: @"DISPLAY"];
|
||||||
|
trigger = [iCalTrigger elementWithTag: @"trigger"];
|
||||||
|
[trigger setValueType: @"DURATION"];
|
||||||
|
[trigger setValue: [NSString stringWithFormat: @"-PT%@M", delta]];
|
||||||
|
[alarm setTrigger: trigger];
|
||||||
|
[newEvent addToAlarms: alarm];
|
||||||
|
[alarm release];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
- (void) save
|
- (void) save
|
||||||
{
|
{
|
||||||
iCalCalendar *vCalendar;
|
iCalCalendar *vCalendar;
|
||||||
|
@ -688,6 +789,9 @@
|
||||||
[newEvent setOrganizer: nil];
|
[newEvent setOrganizer: nil];
|
||||||
[newEvent removeAllAttendees];
|
[newEvent removeAllAttendees];
|
||||||
|
|
||||||
|
/* alarm */
|
||||||
|
[self _setupAlarmDataInEvent: newEvent];
|
||||||
|
|
||||||
// Organizer
|
// Organizer
|
||||||
value = [newProperties objectForKey: @"recipients"];
|
value = [newProperties objectForKey: @"recipients"];
|
||||||
if (value)
|
if (value)
|
||||||
|
|
Loading…
Reference in a new issue