Monotone-Parent: 9475f39d99549bfa74e7f88be7e54d9650beb0d5
Monotone-Revision: d953e1b8cae8bcdf2a3cff4219ea365af8391941 Monotone-Author: wsourdeau@inverse.ca Monotone-Date: 2012-07-13T20:31:41maint-2.0.2
parent
caf58a7c4a
commit
82f3f1b3d9
|
@ -1,5 +1,13 @@
|
||||||
2012-07-13 Wolfgang Sourdeau <wsourdeau@inverse.ca>
|
2012-07-13 Wolfgang Sourdeau <wsourdeau@inverse.ca>
|
||||||
|
|
||||||
|
* SoObjects/Appointments/SOGoCalendarComponent.m
|
||||||
|
(-lookupOccurrence:): now a virtual method forcing the use by
|
||||||
|
subclasses of the new methods below.
|
||||||
|
|
||||||
|
* SoObjects/Appointments/iCalCalendar+SOGo.m: new category module.
|
||||||
|
(-eventWithRecurrenceId, -todoWithRecurrenceId): new method that
|
||||||
|
return as recurrence based on the id passed as parameter.
|
||||||
|
|
||||||
* Tests/Integration/test-caldav-scheduling.py
|
* Tests/Integration/test-caldav-scheduling.py
|
||||||
(CalDAVSchedulingTest.setUp): use the proper password for
|
(CalDAVSchedulingTest.setUp): use the proper password for
|
||||||
attendee1_delegate.
|
attendee1_delegate.
|
||||||
|
|
|
@ -9,6 +9,7 @@ Appointments_PRINCIPAL_CLASS = SOGoAppointmentsProduct
|
||||||
Appointments_OBJC_FILES = \
|
Appointments_OBJC_FILES = \
|
||||||
Product.m \
|
Product.m \
|
||||||
NSArray+Appointments.m \
|
NSArray+Appointments.m \
|
||||||
|
iCalCalendar+SOGo.m \
|
||||||
iCalEntityObject+SOGo.m \
|
iCalEntityObject+SOGo.m \
|
||||||
iCalRepeatableEntityObject+SOGo.m \
|
iCalRepeatableEntityObject+SOGo.m \
|
||||||
iCalEvent+SOGo.m \
|
iCalEvent+SOGo.m \
|
||||||
|
|
|
@ -53,6 +53,7 @@
|
||||||
#import <SOGo/SOGoWebDAVValue.h>
|
#import <SOGo/SOGoWebDAVValue.h>
|
||||||
#import <SOGo/WORequest+SOGo.h>
|
#import <SOGo/WORequest+SOGo.h>
|
||||||
|
|
||||||
|
#import "iCalCalendar+SOGo.h"
|
||||||
#import "iCalEventChanges+SOGo.h"
|
#import "iCalEventChanges+SOGo.h"
|
||||||
#import "iCalEntityObject+SOGo.h"
|
#import "iCalEntityObject+SOGo.h"
|
||||||
#import "iCalPerson+SOGo.h"
|
#import "iCalPerson+SOGo.h"
|
||||||
|
@ -121,6 +122,12 @@
|
||||||
return newOccurence;
|
return newOccurence;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
- (iCalRepeatableEntityObject *) lookupOccurrence: (NSString *) recID
|
||||||
|
|
||||||
|
{
|
||||||
|
return [[self calendar: NO secure: NO] eventWithRecurrenceID: recID];
|
||||||
|
}
|
||||||
|
|
||||||
- (SOGoAppointmentObject *) _lookupEvent: (NSString *) eventUID
|
- (SOGoAppointmentObject *) _lookupEvent: (NSString *) eventUID
|
||||||
forUID: (NSString *) uid
|
forUID: (NSString *) uid
|
||||||
{
|
{
|
||||||
|
@ -839,7 +846,7 @@ inRecurrenceExceptionsForEvent: (iCalEvent *) theEvent
|
||||||
// If recurrenceId is defined, find the specified occurence
|
// If recurrenceId is defined, find the specified occurence
|
||||||
// within the repeating vEvent.
|
// within the repeating vEvent.
|
||||||
recurrenceTime = [NSString stringWithFormat: @"%f", [recurrenceId timeIntervalSince1970]];
|
recurrenceTime = [NSString stringWithFormat: @"%f", [recurrenceId timeIntervalSince1970]];
|
||||||
oldEvent = (iCalEvent*)[self lookupOccurence: recurrenceTime];
|
oldEvent = (iCalEvent*)[self lookupOccurrence: recurrenceTime];
|
||||||
if (oldEvent == nil)
|
if (oldEvent == nil)
|
||||||
// If no occurence found, create one
|
// If no occurence found, create one
|
||||||
oldEvent = (iCalEvent *)[self newOccurenceWithID: recurrenceTime];
|
oldEvent = (iCalEvent *)[self newOccurenceWithID: recurrenceTime];
|
||||||
|
@ -906,7 +913,7 @@ inRecurrenceExceptionsForEvent: (iCalEvent *) theEvent
|
||||||
// If recurrenceId is defined, find the specified occurence
|
// If recurrenceId is defined, find the specified occurence
|
||||||
// within the repeating vEvent.
|
// within the repeating vEvent.
|
||||||
recurrenceTime = [NSString stringWithFormat: @"%f", [recurrenceId timeIntervalSince1970]];
|
recurrenceTime = [NSString stringWithFormat: @"%f", [recurrenceId timeIntervalSince1970]];
|
||||||
event = [eventObject lookupOccurence: recurrenceTime];
|
event = [eventObject lookupOccurrence: recurrenceTime];
|
||||||
|
|
||||||
if (event == nil)
|
if (event == nil)
|
||||||
// If no occurence found, create one
|
// If no occurence found, create one
|
||||||
|
@ -1348,7 +1355,7 @@ inRecurrenceExceptionsForEvent: (iCalEvent *) theEvent
|
||||||
// If _recurrenceId is defined, find the specified occurence
|
// If _recurrenceId is defined, find the specified occurence
|
||||||
// within the repeating vEvent.
|
// within the repeating vEvent.
|
||||||
recurrenceTime = [NSString stringWithFormat: @"%f", [_recurrenceId timeIntervalSince1970]];
|
recurrenceTime = [NSString stringWithFormat: @"%f", [_recurrenceId timeIntervalSince1970]];
|
||||||
event = (iCalEvent*)[self lookupOccurence: recurrenceTime];
|
event = (iCalEvent*)[self lookupOccurrence: recurrenceTime];
|
||||||
|
|
||||||
if (event == nil)
|
if (event == nil)
|
||||||
// If no occurence found, create one
|
// If no occurence found, create one
|
||||||
|
|
|
@ -86,7 +86,8 @@
|
||||||
- (NSArray *) getUIDsForICalPersons: (NSArray *) iCalPersons;
|
- (NSArray *) getUIDsForICalPersons: (NSArray *) iCalPersons;
|
||||||
|
|
||||||
/* recurrences */
|
/* recurrences */
|
||||||
- (iCalRepeatableEntityObject *) lookupOccurence: (NSString *) recID;
|
/* same as above, but refers to the existing calendar component */
|
||||||
|
- (iCalRepeatableEntityObject *) lookupOccurrence: (NSString *) recID;
|
||||||
- (SOGoComponentOccurence *) occurence: (iCalRepeatableEntityObject *) component;
|
- (SOGoComponentOccurence *) occurence: (iCalRepeatableEntityObject *) component;
|
||||||
- (iCalRepeatableEntityObject *) newOccurenceWithID: (NSString *) recID;
|
- (iCalRepeatableEntityObject *) newOccurenceWithID: (NSString *) recID;
|
||||||
|
|
||||||
|
|
|
@ -269,45 +269,11 @@
|
||||||
return iCalString;
|
return iCalString;
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline BOOL _occurenceHasID (iCalRepeatableEntityObject *occurence,
|
- (iCalRepeatableEntityObject *) lookupOccurrence: (NSString *) recID
|
||||||
NSString *recID)
|
|
||||||
{
|
{
|
||||||
unsigned int seconds, recSeconds;
|
[self subclassResponsibility: _cmd];
|
||||||
|
|
||||||
seconds = [recID intValue];
|
return nil;
|
||||||
recSeconds = [[occurence recurrenceId] timeIntervalSince1970];
|
|
||||||
|
|
||||||
return (seconds == recSeconds);
|
|
||||||
}
|
|
||||||
|
|
||||||
- (iCalRepeatableEntityObject *) lookupOccurence: (NSString *) recID
|
|
||||||
{
|
|
||||||
iCalRepeatableEntityObject *component, *occurence, *currentOccurence;
|
|
||||||
NSArray *occurences;
|
|
||||||
unsigned int count, max;
|
|
||||||
|
|
||||||
occurence = nil;
|
|
||||||
|
|
||||||
component = [self component: NO secure: NO];
|
|
||||||
if ([component hasRecurrenceRules])
|
|
||||||
{
|
|
||||||
occurences = [[self calendar: NO secure: NO] allObjects];
|
|
||||||
max = [occurences count];
|
|
||||||
count = 1; // skip master event
|
|
||||||
while (!occurence && count < max)
|
|
||||||
{
|
|
||||||
currentOccurence = [occurences objectAtIndex: count];
|
|
||||||
if (_occurenceHasID (currentOccurence, recID))
|
|
||||||
occurence = currentOccurence;
|
|
||||||
else
|
|
||||||
count++;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else if (_occurenceHasID (component, recID))
|
|
||||||
/* The "master" event could be that occurrence. */
|
|
||||||
occurence = component;
|
|
||||||
|
|
||||||
return occurence;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
- (SOGoComponentOccurence *) occurence: (iCalRepeatableEntityObject *) component
|
- (SOGoComponentOccurence *) occurence: (iCalRepeatableEntityObject *) component
|
||||||
|
@ -397,7 +363,7 @@ static inline BOOL _occurenceHasID (iCalRepeatableEntityObject *occurence,
|
||||||
else if ([lookupName hasPrefix: @"occurence"])
|
else if ([lookupName hasPrefix: @"occurence"])
|
||||||
{
|
{
|
||||||
recID = [lookupName substringFromIndex: 9];
|
recID = [lookupName substringFromIndex: 9];
|
||||||
occurence = [self lookupOccurence: recID];
|
occurence = [self lookupOccurrence: recID];
|
||||||
if (occurence)
|
if (occurence)
|
||||||
isNewOccurence = NO;
|
isNewOccurence = NO;
|
||||||
else
|
else
|
||||||
|
|
|
@ -32,6 +32,7 @@
|
||||||
|
|
||||||
#import <SoObjects/SOGo/SOGoMailer.h>
|
#import <SoObjects/SOGo/SOGoMailer.h>
|
||||||
|
|
||||||
|
#import "iCalCalendar+SOGo.h"
|
||||||
#import "NSArray+Appointments.h"
|
#import "NSArray+Appointments.h"
|
||||||
#import "SOGoAptMailNotification.h"
|
#import "SOGoAptMailNotification.h"
|
||||||
#import "SOGoAppointmentFolder.h"
|
#import "SOGoAppointmentFolder.h"
|
||||||
|
@ -46,6 +47,11 @@
|
||||||
return @"vtodo";
|
return @"vtodo";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
- (iCalRepeatableEntityObject *) lookupOccurrence: (NSString *) recID
|
||||||
|
{
|
||||||
|
return [[self calendar: NO secure: NO] todoWithRecurrenceID: recID];
|
||||||
|
}
|
||||||
|
|
||||||
- (SOGoComponentOccurence *) occurence: (iCalRepeatableEntityObject *) occ
|
- (SOGoComponentOccurence *) occurence: (iCalRepeatableEntityObject *) occ
|
||||||
{
|
{
|
||||||
NSArray *allTodos;
|
NSArray *allTodos;
|
||||||
|
|
|
@ -0,0 +1,39 @@
|
||||||
|
/* iCalCalendar+SOGo.h - this file is part of SOGo
|
||||||
|
*
|
||||||
|
* Copyright (C) 2012 Inverse inc
|
||||||
|
*
|
||||||
|
* Author: Wolfgang Sourdeau <wsourdeau@inverse.ca>
|
||||||
|
*
|
||||||
|
* This file is free software; you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
* the Free Software Foundation; either version 2, or (at your option)
|
||||||
|
* any later version.
|
||||||
|
*
|
||||||
|
* This file is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with this program; see the file COPYING. If not, write to
|
||||||
|
* the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
|
||||||
|
* Boston, MA 02111-1307, USA.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef ICALCALENDAR_SOGO_H
|
||||||
|
#define ICALCALENDAR_SOGO_H
|
||||||
|
|
||||||
|
#import <NGCards/iCalCalendar.h>
|
||||||
|
|
||||||
|
@class NSString;
|
||||||
|
@class iCalEvent;
|
||||||
|
@class iCalToDo;
|
||||||
|
|
||||||
|
@interface iCalCalendar (SOGoExtensions)
|
||||||
|
|
||||||
|
- (iCalEvent *) eventWithRecurrenceID: (NSString *) recID;
|
||||||
|
- (iCalToDo *) todoWithRecurrenceID: (NSString *) recID;
|
||||||
|
|
||||||
|
@end
|
||||||
|
|
||||||
|
#endif /* ICALCALENDAR_SOGO_H */
|
|
@ -0,0 +1,82 @@
|
||||||
|
/* iCalCalendar+SOGo.m - this file is part of $PROJECT_NAME_HERE$
|
||||||
|
*
|
||||||
|
* Copyright (C) 2012 Inverse inc
|
||||||
|
*
|
||||||
|
* Author: Wolfgang Sourdeau <wsourdeau@inverse.ca>
|
||||||
|
*
|
||||||
|
* This file is free software; you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
* the Free Software Foundation; either version 2, or (at your option)
|
||||||
|
* any later version.
|
||||||
|
*
|
||||||
|
* This file is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with this program; see the file COPYING. If not, write to
|
||||||
|
* the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
|
||||||
|
* Boston, MA 02111-1307, USA.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#import <Foundation/NSArray.h>
|
||||||
|
#import <Foundation/NSString.h>
|
||||||
|
|
||||||
|
#import <NGCards/iCalRepeatableEntityObject.h>
|
||||||
|
|
||||||
|
#import "iCalCalendar+SOGo.h"
|
||||||
|
|
||||||
|
@implementation iCalCalendar (SOGoExtensions)
|
||||||
|
|
||||||
|
- (id) _occurrence: (NSString *) recID
|
||||||
|
inArray: (NSArray *) components
|
||||||
|
{
|
||||||
|
id occurrence;
|
||||||
|
iCalRepeatableEntityObject *component;
|
||||||
|
NSUInteger count, max, seconds, recSeconds;
|
||||||
|
|
||||||
|
occurrence = nil;
|
||||||
|
|
||||||
|
seconds = [recID intValue];
|
||||||
|
|
||||||
|
max = [components count];
|
||||||
|
|
||||||
|
/* master occurrence */
|
||||||
|
component = [components objectAtIndex: 0];
|
||||||
|
|
||||||
|
if ([component hasRecurrenceRules])
|
||||||
|
{
|
||||||
|
count = 1; // skip master event
|
||||||
|
while (!occurrence && count < max)
|
||||||
|
{
|
||||||
|
component = [components objectAtIndex: count];
|
||||||
|
recSeconds = [[component recurrenceId] timeIntervalSince1970];
|
||||||
|
if (recSeconds == seconds)
|
||||||
|
occurrence = component;
|
||||||
|
else
|
||||||
|
count++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
/* The "master" event could be that occurrence. */
|
||||||
|
recSeconds = [[component recurrenceId] timeIntervalSince1970];
|
||||||
|
if (recSeconds == seconds)
|
||||||
|
occurrence = component;
|
||||||
|
}
|
||||||
|
|
||||||
|
return occurrence;
|
||||||
|
}
|
||||||
|
|
||||||
|
- (iCalEvent *) eventWithRecurrenceID: (NSString *) recID
|
||||||
|
{
|
||||||
|
return [self _occurrence: recID inArray: [self events]];
|
||||||
|
}
|
||||||
|
|
||||||
|
- (iCalToDo *) todoWithRecurrenceID: (NSString *) recID;
|
||||||
|
{
|
||||||
|
return [self _occurrence: recID inArray: [self todos]];
|
||||||
|
}
|
||||||
|
|
||||||
|
@end
|
Loading…
Reference in New Issue