Fix for bug #2889
parent
f4372af16d
commit
1c60ab2337
|
@ -1,10 +1,6 @@
|
||||||
/* iCalTimeZone.m - this file is part of SOPE
|
/* iCalTimeZone.m - this file is part of SOPE
|
||||||
*
|
*
|
||||||
* Copyright (C) 2006-2011 Inverse inc.
|
* Copyright (C) 2006-2014 Inverse inc.
|
||||||
*
|
|
||||||
* Author: Wolfgang Sourdeau <wsourdeau@inverse.ca>
|
|
||||||
* Ludovic Marcotte <lmarcotte@inverse.ca>
|
|
||||||
* Francis Lachapelle <flachapelle@inverse.ca>
|
|
||||||
*
|
*
|
||||||
* This file is free software; you can redistribute it and/or modify
|
* 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
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
|
|
@ -1,8 +1,6 @@
|
||||||
/* iCalTimeZonePeriod.m - this file is part of SOPE
|
/* iCalTimeZonePeriod.m - this file is part of SOPE
|
||||||
*
|
*
|
||||||
* Copyright (C) 2006-2009 Inverse inc.
|
* Copyright (C) 2006-2014 Inverse inc.
|
||||||
*
|
|
||||||
* Author: Wolfgang Sourdeau <wsourdeau@inverse.ca>
|
|
||||||
*
|
*
|
||||||
* This file is free software; you can redistribute it and/or modify
|
* 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
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
|
|
@ -42,6 +42,9 @@
|
||||||
#import <NGCards/NSCalendarDate+NGCards.h>
|
#import <NGCards/NSCalendarDate+NGCards.h>
|
||||||
#import <SaxObjC/XMLNamespaces.h>
|
#import <SaxObjC/XMLNamespaces.h>
|
||||||
|
|
||||||
|
#import <NGCards/iCalDateTime.h>
|
||||||
|
#import <NGCards/iCalTimeZone.h>
|
||||||
|
#import <NGCards/iCalTimeZonePeriod.h>
|
||||||
#import <NGCards/NSString+NGCards.h>
|
#import <NGCards/NSString+NGCards.h>
|
||||||
|
|
||||||
#import <SOGo/SOGoConstants.h>
|
#import <SOGo/SOGoConstants.h>
|
||||||
|
@ -161,7 +164,7 @@
|
||||||
object = nil;
|
object = nil;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
object = nil;
|
object = nil;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -182,8 +185,8 @@
|
||||||
//
|
//
|
||||||
//
|
//
|
||||||
- (void) _addOrUpdateEvent: (iCalEvent *) theEvent
|
- (void) _addOrUpdateEvent: (iCalEvent *) theEvent
|
||||||
forUID: (NSString *) theUID
|
forUID: (NSString *) theUID
|
||||||
owner: (NSString *) theOwner
|
owner: (NSString *) theOwner
|
||||||
{
|
{
|
||||||
if (![theUID isEqualToString: theOwner])
|
if (![theUID isEqualToString: theOwner])
|
||||||
{
|
{
|
||||||
|
@ -433,17 +436,20 @@
|
||||||
while ((currentAttendee = [enumerator nextObject]))
|
while ((currentAttendee = [enumerator nextObject]))
|
||||||
{
|
{
|
||||||
currentUID = [currentAttendee uid];
|
currentUID = [currentAttendee uid];
|
||||||
|
|
||||||
if (currentUID)
|
if (currentUID)
|
||||||
{
|
{
|
||||||
user = [SOGoUser userWithLogin: currentUID];
|
user = [SOGoUser userWithLogin: currentUID];
|
||||||
us = [user userSettings];
|
us = [user userSettings];
|
||||||
moduleSettings = [us objectForKey:@"Calendar"];
|
moduleSettings = [us objectForKey:@"Calendar"];
|
||||||
|
|
||||||
// Check if the user prevented his account from beeing invited to events
|
// Check if the user prevented his account from beeing invited to events
|
||||||
if (![user isResource] && [[moduleSettings objectForKey:@"PreventInvitations"] boolValue])
|
if (![user isResource] && [[moduleSettings objectForKey:@"PreventInvitations"] boolValue])
|
||||||
{
|
{
|
||||||
// Check if the user have a whiteList
|
// Check if the user have a whiteList
|
||||||
whiteListString = [moduleSettings objectForKey:@"PreventInvitationsWhitelist"];
|
whiteListString = [moduleSettings objectForKey:@"PreventInvitationsWhitelist"];
|
||||||
whiteList = [whiteListString objectFromJSONString];
|
whiteList = [whiteListString objectFromJSONString];
|
||||||
|
|
||||||
// If the filter have a hit, do not add the currentUID to the unavailableAttendees array
|
// If the filter have a hit, do not add the currentUID to the unavailableAttendees array
|
||||||
if (![whiteList objectForKey:ownerUID])
|
if (![whiteList objectForKey:ownerUID])
|
||||||
{
|
{
|
||||||
|
@ -455,9 +461,11 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
count = [unavailableAttendees count];
|
count = [unavailableAttendees count];
|
||||||
|
|
||||||
if (count > 0)
|
if (count > 0)
|
||||||
{
|
{
|
||||||
reason = [NSMutableString stringWithString:[self labelForKey: @"Inviting the following persons is prohibited:"]];
|
reason = [NSMutableString stringWithString:[self labelForKey: @"Inviting the following persons is prohibited:"]];
|
||||||
|
|
||||||
// Add all the unavailable users in the warning message
|
// Add all the unavailable users in the warning message
|
||||||
for (i = 0; i < count; i++)
|
for (i = 0; i < count; i++)
|
||||||
{
|
{
|
||||||
|
@ -466,10 +474,14 @@
|
||||||
if (i < count-2)
|
if (i < count-2)
|
||||||
[reason appendString:@", "];
|
[reason appendString:@", "];
|
||||||
}
|
}
|
||||||
|
|
||||||
[unavailableAttendees release];
|
[unavailableAttendees release];
|
||||||
|
|
||||||
return [NSException exceptionWithHTTPStatus:409 reason: reason];
|
return [NSException exceptionWithHTTPStatus:409 reason: reason];
|
||||||
}
|
}
|
||||||
|
|
||||||
[unavailableAttendees release];
|
[unavailableAttendees release];
|
||||||
|
|
||||||
return nil;
|
return nil;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -524,14 +536,14 @@
|
||||||
|
|
||||||
if ([user isResource])
|
if ([user isResource])
|
||||||
{
|
{
|
||||||
|
NSCalendarDate *start, *end, *rangeStartDate, *rangeEndDate;
|
||||||
SOGoAppointmentFolder *folder;
|
SOGoAppointmentFolder *folder;
|
||||||
NSCalendarDate *start, *end;
|
|
||||||
NGCalendarDateRange *range;
|
NGCalendarDateRange *range;
|
||||||
NSMutableArray *fbInfo;
|
NSMutableArray *fbInfo;
|
||||||
NSArray *allOccurences;
|
NSArray *allOccurences;
|
||||||
|
|
||||||
BOOL must_delete;
|
BOOL must_delete;
|
||||||
int i, j;
|
int i, j, delta;
|
||||||
|
|
||||||
// We get the start/end date for our conflict range. If the event to be added is recurring, we
|
// We get the start/end date for our conflict range. If the event to be added is recurring, we
|
||||||
// check for at least a year to start with.
|
// check for at least a year to start with.
|
||||||
|
@ -574,8 +586,18 @@
|
||||||
|
|
||||||
for (i = [fbInfo count]-1; i >= 0; i--)
|
for (i = [fbInfo count]-1; i >= 0; i--)
|
||||||
{
|
{
|
||||||
range = [NGCalendarDateRange calendarDateRangeWithStartDate: [[fbInfo objectAtIndex: i] objectForKey: @"startDate"]
|
// We MUST use the -uniqueChildWithTag method here because the event has been flattened, so its timezone has been
|
||||||
endDate: [[fbInfo objectAtIndex: i] objectForKey: @"endDate"]];
|
// modified in SOGoAppointmentFolder: -fixupCycleRecord: ....
|
||||||
|
rangeStartDate = [[fbInfo objectAtIndex: i] objectForKey: @"startDate"];
|
||||||
|
delta = [[rangeStartDate timeZoneDetail] timeZoneSecondsFromGMT] - [[[(iCalDateTime *)[theEvent uniqueChildWithTag: @"dtstart"] timeZone] periodForDate: [theEvent startDate]] secondsOffsetFromGMT];
|
||||||
|
rangeStartDate = [rangeStartDate dateByAddingYears: 0 months: 0 days: 0 hours: 0 minutes: 0 seconds: delta];
|
||||||
|
|
||||||
|
rangeEndDate = [[fbInfo objectAtIndex: i] objectForKey: @"endDate"];
|
||||||
|
delta = [[rangeEndDate timeZoneDetail] timeZoneSecondsFromGMT] - [[[(iCalDateTime *)[theEvent uniqueChildWithTag: @"dtend"] timeZone] periodForDate: [theEvent endDate]] secondsOffsetFromGMT];
|
||||||
|
rangeEndDate = [rangeEndDate dateByAddingYears: 0 months: 0 days: 0 hours: 0 minutes: 0 seconds: delta];
|
||||||
|
|
||||||
|
range = [NGCalendarDateRange calendarDateRangeWithStartDate: rangeStartDate
|
||||||
|
endDate: rangeEndDate];
|
||||||
|
|
||||||
if ([[[fbInfo objectAtIndex: i] objectForKey: @"c_uid"] compare: [theEvent uid]] == NSOrderedSame)
|
if ([[[fbInfo objectAtIndex: i] objectForKey: @"c_uid"] compare: [theEvent uid]] == NSOrderedSame)
|
||||||
{
|
{
|
||||||
|
@ -608,9 +630,9 @@
|
||||||
{
|
{
|
||||||
currentAttendee = [theAttendees objectAtIndex: i];
|
currentAttendee = [theAttendees objectAtIndex: i];
|
||||||
if ([[currentAttendee uid] isEqualToString: currentUID])
|
if ([[currentAttendee uid] isEqualToString: currentUID])
|
||||||
break;
|
break;
|
||||||
else
|
else
|
||||||
currentAttendee = nil;
|
currentAttendee = nil;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ([fbInfo count])
|
if ([fbInfo count])
|
||||||
|
@ -956,10 +978,10 @@ inRecurrenceExceptionsForEvent: (iCalEvent *) theEvent
|
||||||
- (NSException *) _updateAttendee: (iCalPerson *) attendee
|
- (NSException *) _updateAttendee: (iCalPerson *) attendee
|
||||||
withDelegate: (iCalPerson *) delegate
|
withDelegate: (iCalPerson *) delegate
|
||||||
ownerUser: (SOGoUser *) theOwnerUser
|
ownerUser: (SOGoUser *) theOwnerUser
|
||||||
forEventUID: (NSString *) eventUID
|
forEventUID: (NSString *) eventUID
|
||||||
withRecurrenceId: (NSCalendarDate *) recurrenceId
|
withRecurrenceId: (NSCalendarDate *) recurrenceId
|
||||||
withSequence: (NSNumber *) sequence
|
withSequence: (NSNumber *) sequence
|
||||||
forUID: (NSString *) uid
|
forUID: (NSString *) uid
|
||||||
shouldAddSentBy: (BOOL) b
|
shouldAddSentBy: (BOOL) b
|
||||||
{
|
{
|
||||||
SOGoAppointmentObject *eventObject;
|
SOGoAppointmentObject *eventObject;
|
||||||
|
@ -1022,12 +1044,12 @@ inRecurrenceExceptionsForEvent: (iCalEvent *) theEvent
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
addDelegate = YES;
|
addDelegate = YES;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (otherDelegate)
|
if (otherDelegate)
|
||||||
removeDelegate = YES;
|
removeDelegate = YES;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (removeDelegate)
|
if (removeDelegate)
|
||||||
|
@ -1094,8 +1116,8 @@ inRecurrenceExceptionsForEvent: (iCalEvent *) theEvent
|
||||||
- (NSException *) _handleAttendee: (iCalPerson *) attendee
|
- (NSException *) _handleAttendee: (iCalPerson *) attendee
|
||||||
withDelegate: (iCalPerson *) delegate
|
withDelegate: (iCalPerson *) delegate
|
||||||
ownerUser: (SOGoUser *) theOwnerUser
|
ownerUser: (SOGoUser *) theOwnerUser
|
||||||
statusChange: (NSString *) newStatus
|
statusChange: (NSString *) newStatus
|
||||||
inEvent: (iCalEvent *) event
|
inEvent: (iCalEvent *) event
|
||||||
{
|
{
|
||||||
NSString *currentStatus, *organizerUID;
|
NSString *currentStatus, *organizerUID;
|
||||||
SOGoUser *ownerUser, *currentUser;
|
SOGoUser *ownerUser, *currentUser;
|
||||||
|
|
Loading…
Reference in New Issue