parent
f872dc52c6
commit
3bb40e4024
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
Copyright (C) 2007-2014 Inverse inc.
|
Copyright (C) 2007-2019 Inverse inc.
|
||||||
Copyright (C) 2004-2005 SKYRIX Software AG
|
Copyright (C) 2004-2005 SKYRIX Software AG
|
||||||
|
|
||||||
This file is part of SOGo.
|
This file is part of SOGo.
|
||||||
|
@ -37,6 +37,7 @@
|
||||||
#import <NGCards/iCalTimeZonePeriod.h>
|
#import <NGCards/iCalTimeZonePeriod.h>
|
||||||
#import <NGCards/iCalToDo.h>
|
#import <NGCards/iCalToDo.h>
|
||||||
#import <NGCards/NSString+NGCards.h>
|
#import <NGCards/NSString+NGCards.h>
|
||||||
|
#import <NGExtensions/NSCalendarDate+misc.h>
|
||||||
#import <NGExtensions/NGCalendarDateRange.h>
|
#import <NGExtensions/NGCalendarDateRange.h>
|
||||||
#import <NGExtensions/NSNull+misc.h>
|
#import <NGExtensions/NSNull+misc.h>
|
||||||
#import <NGExtensions/NSObject+Logs.h>
|
#import <NGExtensions/NSObject+Logs.h>
|
||||||
|
@ -50,6 +51,7 @@
|
||||||
#import <SOGo/SOGoBuild.h>
|
#import <SOGo/SOGoBuild.h>
|
||||||
#import <SOGo/SOGoCache.h>
|
#import <SOGo/SOGoCache.h>
|
||||||
#import <SOGo/SOGoDomainDefaults.h>
|
#import <SOGo/SOGoDomainDefaults.h>
|
||||||
|
#import <SOGo/SOGoGroup.h>
|
||||||
#import <SOGo/SOGoPermissions.h>
|
#import <SOGo/SOGoPermissions.h>
|
||||||
#import <SOGo/SOGoUser.h>
|
#import <SOGo/SOGoUser.h>
|
||||||
#import <SOGo/SOGoUserSettings.h>
|
#import <SOGo/SOGoUserSettings.h>
|
||||||
|
@ -3392,7 +3394,6 @@ firstInstanceCalendarDateRange: (NGCalendarDateRange *) fir
|
||||||
NSMutableDictionary *timezones, *uids;
|
NSMutableDictionary *timezones, *uids;
|
||||||
NSString *tzId, *uid, *originalUid;
|
NSString *tzId, *uid, *originalUid;
|
||||||
iCalEntityObject *element;
|
iCalEntityObject *element;
|
||||||
iCalDateTime *startDate;
|
|
||||||
iCalTimeZone *timezone;
|
iCalTimeZone *timezone;
|
||||||
iCalCalendar *masterCalendar;
|
iCalCalendar *masterCalendar;
|
||||||
iCalEvent *event;
|
iCalEvent *event;
|
||||||
|
@ -3436,74 +3437,12 @@ firstInstanceCalendarDateRange: (NGCalendarDateRange *) fir
|
||||||
|
|
||||||
timezone = nil;
|
timezone = nil;
|
||||||
element = [components objectAtIndex: i];
|
element = [components objectAtIndex: i];
|
||||||
// Use the timezone of the start date.
|
|
||||||
startDate = (iCalDateTime *) [element uniqueChildWithTag: @"dtstart"];
|
|
||||||
if (startDate)
|
|
||||||
{
|
|
||||||
tzId = [startDate value: 0 ofAttribute: @"tzid"];
|
|
||||||
if ([tzId length])
|
|
||||||
timezone = [timezones valueForKey: tzId];
|
|
||||||
else
|
|
||||||
{
|
|
||||||
// If the start date is a "floating time", let's use the user's timezone
|
|
||||||
// during the import for both the start and end dates. This is similar
|
|
||||||
// to what we do in SOGoAppointmentObject: -_adjustFloatingTimeInRequestCalendar:
|
|
||||||
NSString *s;
|
|
||||||
|
|
||||||
s = [[startDate valuesAtIndex: 0 forKey: @""] objectAtIndex: 0];
|
|
||||||
|
|
||||||
if ([element isKindOfClass: iCalEventK] &&
|
|
||||||
![(iCalEvent *)element isAllDay] &&
|
|
||||||
![s hasSuffix: @"Z"] &&
|
|
||||||
![s hasSuffix: @"z"])
|
|
||||||
{
|
|
||||||
iCalDateTime *endDate;
|
|
||||||
int delta;
|
|
||||||
|
|
||||||
timezone = [iCalTimeZone timeZoneForName: [[[self->context activeUser] userDefaults] timeZoneName]];
|
|
||||||
[calendar addTimeZone: timezone];
|
|
||||||
|
|
||||||
delta = [[timezone periodForDate: [startDate dateTime]] secondsOffsetFromGMT];
|
|
||||||
event = (iCalEvent *)element;
|
|
||||||
|
|
||||||
[event setStartDate: [[event startDate] dateByAddingYears: 0 months: 0 days: 0 hours: 0 minutes: 0 seconds: -delta]];
|
|
||||||
[startDate setTimeZone: timezone];
|
|
||||||
|
|
||||||
endDate = (iCalDateTime *) [element uniqueChildWithTag: @"dtend"];
|
|
||||||
|
|
||||||
if (endDate)
|
|
||||||
{
|
|
||||||
[event setEndDate: [[event endDate] dateByAddingYears: 0 months: 0 days: 0 hours: 0 minutes: 0 seconds: -delta]];
|
|
||||||
[endDate setTimeZone: timezone];
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if ([element isKindOfClass: iCalEventK])
|
if ([element isKindOfClass: iCalEventK])
|
||||||
{
|
{
|
||||||
event = (iCalEvent *)element;
|
event = (iCalEvent *)element;
|
||||||
if (![event hasEndDate] && ![event hasDuration])
|
timezone = [event adjustInContext: self->context];
|
||||||
{
|
|
||||||
// No end date, no duration
|
|
||||||
if ([event isAllDay])
|
|
||||||
[event setDuration: @"P1D"];
|
|
||||||
else
|
|
||||||
[event setDuration: @"PT1H"];
|
|
||||||
|
|
||||||
[self errorWithFormat: @"Importing event with no end date; setting duration to %@ for UID = %@", [event duration], [event uid]];
|
|
||||||
}
|
|
||||||
//
|
|
||||||
// We check for broken all-day events (like the ones coming from the "WebCalendar" tool) where
|
|
||||||
// the start date is equal to the end date. This clearly violates the RFC:
|
|
||||||
//
|
|
||||||
// 3.8.2.2. Date-Time End
|
|
||||||
// The value MUST be later in time than the value of the "DTSTART" property.
|
|
||||||
//
|
|
||||||
if ([event isAllDay] && [[event startDate] isEqual: [event endDate]])
|
|
||||||
{
|
|
||||||
[event setEndDate: [[event startDate] dateByAddingYears: 0 months: 0 days: 1 hours: 0 minutes: 0 seconds: 0]];
|
|
||||||
[self errorWithFormat: @"Fixed broken all-day event; setting end date to %@ for UID = %@", [event endDate], [event uid]];
|
|
||||||
}
|
|
||||||
if ([event recurrenceId])
|
if ([event recurrenceId])
|
||||||
{
|
{
|
||||||
// Event is an occurrence of a repeating event
|
// Event is an occurrence of a repeating event
|
||||||
|
@ -3525,7 +3464,6 @@ firstInstanceCalendarDateRange: (NGCalendarDateRange *) fir
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
originalUid = [element uid];
|
originalUid = [element uid];
|
||||||
if ((uid = [self importComponent: element
|
if ((uid = [self importComponent: element
|
||||||
timezone: timezone]))
|
timezone: timezone]))
|
||||||
|
|
|
@ -54,6 +54,7 @@
|
||||||
#import <SOGo/WORequest+SOGo.h>
|
#import <SOGo/WORequest+SOGo.h>
|
||||||
|
|
||||||
#import "iCalCalendar+SOGo.h"
|
#import "iCalCalendar+SOGo.h"
|
||||||
|
#import "iCalEvent+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"
|
||||||
|
@ -1930,6 +1931,7 @@ inRecurrenceExceptionsForEvent: (iCalEvent *) theEvent
|
||||||
{
|
{
|
||||||
NSArray *allEvents;
|
NSArray *allEvents;
|
||||||
iCalEvent *event;
|
iCalEvent *event;
|
||||||
|
iCalTimeZone *tz;
|
||||||
NSUInteger i;
|
NSUInteger i;
|
||||||
int j;
|
int j;
|
||||||
|
|
||||||
|
@ -1939,15 +1941,9 @@ inRecurrenceExceptionsForEvent: (iCalEvent *) theEvent
|
||||||
{
|
{
|
||||||
event = [allEvents objectAtIndex: i];
|
event = [allEvents objectAtIndex: i];
|
||||||
|
|
||||||
if (![event hasEndDate] && ![event hasDuration])
|
tz = [event adjustInContext: context];
|
||||||
{
|
if (tz)
|
||||||
// No end date, no duration
|
[rqCalendar addTimeZone: tz];
|
||||||
if ([event isAllDay])
|
|
||||||
[event setDuration: @"P1D"];
|
|
||||||
else
|
|
||||||
[event setDuration: @"PT1H"];
|
|
||||||
[self warnWithFormat: @"Invalid event: no end date; setting duration to %@", [event duration]];
|
|
||||||
}
|
|
||||||
|
|
||||||
if ([event organizer])
|
if ([event organizer])
|
||||||
{
|
{
|
||||||
|
@ -1994,53 +1990,6 @@ inRecurrenceExceptionsForEvent: (iCalEvent *) theEvent
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
|
||||||
// This is similar to what we do in SOGoAppointmentFolder: -importCalendar:
|
|
||||||
//
|
|
||||||
- (void) _adjustFloatingTimeInRequestCalendar: (iCalCalendar *) rqCalendar
|
|
||||||
{
|
|
||||||
iCalDateTime *startDate, *endDate;
|
|
||||||
NSString *startDateAsString;
|
|
||||||
SOGoUserDefaults *ud;
|
|
||||||
NSArray *allEvents;
|
|
||||||
iCalTimeZone *tz;
|
|
||||||
iCalEvent *event;
|
|
||||||
int i, delta;
|
|
||||||
|
|
||||||
allEvents = [rqCalendar events];
|
|
||||||
for (i = 0; i < [allEvents count]; i++)
|
|
||||||
{
|
|
||||||
event = [allEvents objectAtIndex: i];
|
|
||||||
|
|
||||||
if ([event isAllDay])
|
|
||||||
continue;
|
|
||||||
|
|
||||||
startDate = (iCalDateTime *)[event uniqueChildWithTag: @"dtstart"];
|
|
||||||
startDateAsString = [[startDate valuesAtIndex: 0 forKey: @""] objectAtIndex: 0];
|
|
||||||
|
|
||||||
if (![startDate timeZone] &&
|
|
||||||
![startDateAsString hasSuffix: @"Z"] &&
|
|
||||||
![startDateAsString hasSuffix: @"z"])
|
|
||||||
{
|
|
||||||
ud = [[context activeUser] userDefaults];
|
|
||||||
tz = [iCalTimeZone timeZoneForName: [ud timeZoneName]];
|
|
||||||
if ([rqCalendar addTimeZone: tz])
|
|
||||||
{
|
|
||||||
delta = [[tz periodForDate: [startDate dateTime]] secondsOffsetFromGMT];
|
|
||||||
|
|
||||||
[event setStartDate: [[event startDate] dateByAddingYears: 0 months: 0 days: 0 hours: 0 minutes: 0 seconds: -delta]];
|
|
||||||
[startDate setTimeZone: tz];
|
|
||||||
|
|
||||||
endDate = (iCalDateTime *) [event uniqueChildWithTag: @"dtend"];
|
|
||||||
if (endDate)
|
|
||||||
{
|
|
||||||
[event setEndDate: [[event endDate] dateByAddingYears: 0 months: 0 days: 0 hours: 0 minutes: 0 seconds: -delta]];
|
|
||||||
[endDate setTimeZone: tz];
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
- (void) _decomposeGroupsInRequestCalendar: (iCalCalendar *) rqCalendar
|
- (void) _decomposeGroupsInRequestCalendar: (iCalCalendar *) rqCalendar
|
||||||
{
|
{
|
||||||
|
@ -2163,7 +2112,6 @@ inRecurrenceExceptionsForEvent: (iCalEvent *) theEvent
|
||||||
[self _adjustEventsInRequestCalendar: calendar];
|
[self _adjustEventsInRequestCalendar: calendar];
|
||||||
[self adjustClassificationInRequestCalendar: calendar];
|
[self adjustClassificationInRequestCalendar: calendar];
|
||||||
[self _adjustPartStatInRequestCalendar: calendar];
|
[self _adjustPartStatInRequestCalendar: calendar];
|
||||||
[self _adjustFloatingTimeInRequestCalendar: calendar];
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
/* iCalEvent+SOGo.h - this file is part of SOGo
|
/* iCalEvent+SOGo.h - this file is part of SOGo
|
||||||
*
|
*
|
||||||
* Copyright (C) 2007-2015 Inverse inc.
|
* Copyright (C) 2007-2019 Inverse inc.
|
||||||
*
|
*
|
||||||
* 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
|
||||||
|
@ -23,6 +23,7 @@
|
||||||
|
|
||||||
#import <NGCards/iCalEvent.h>
|
#import <NGCards/iCalEvent.h>
|
||||||
|
|
||||||
|
@class iCalTimeZone;
|
||||||
@class NSMutableDictionary;
|
@class NSMutableDictionary;
|
||||||
|
|
||||||
@interface iCalEvent (SOGoExtensions)
|
@interface iCalEvent (SOGoExtensions)
|
||||||
|
@ -30,6 +31,7 @@
|
||||||
- (BOOL) isStillRelevant;
|
- (BOOL) isStillRelevant;
|
||||||
- (NSTimeInterval) occurenceInterval;
|
- (NSTimeInterval) occurenceInterval;
|
||||||
- (void) updateRecurrenceRulesUntilDate: (NSCalendarDate *) previousEndDate;
|
- (void) updateRecurrenceRulesUntilDate: (NSCalendarDate *) previousEndDate;
|
||||||
|
- (iCalTimeZone *) adjustInContext: (WOContext *) context;
|
||||||
|
|
||||||
@end
|
@end
|
||||||
|
|
||||||
|
|
|
@ -27,9 +27,10 @@
|
||||||
|
|
||||||
#import <NGCards/iCalCalendar.h>
|
#import <NGCards/iCalCalendar.h>
|
||||||
#import <NGCards/iCalDateTime.h>
|
#import <NGCards/iCalDateTime.h>
|
||||||
#import <NGCards/iCalTimeZone.h>
|
|
||||||
#import <NGCards/iCalPerson.h>
|
#import <NGCards/iCalPerson.h>
|
||||||
#import <NGCards/iCalRecurrenceRule.h>
|
#import <NGCards/iCalRecurrenceRule.h>
|
||||||
|
#import <NGCards/iCalTimeZone.h>
|
||||||
|
#import <NGCards/iCalTimeZonePeriod.h>
|
||||||
#import <NGCards/NSString+NGCards.h>
|
#import <NGCards/NSString+NGCards.h>
|
||||||
|
|
||||||
#import <SoObjects/SOGo/CardElement+SOGo.h>
|
#import <SoObjects/SOGo/CardElement+SOGo.h>
|
||||||
|
@ -444,4 +445,97 @@
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
- (iCalTimeZone *) adjustInContext: (WOContext *) context
|
||||||
|
{
|
||||||
|
iCalDateTime *startDate, *endDate;
|
||||||
|
iCalTimeZone *timezone;
|
||||||
|
NSCalendarDate *date;
|
||||||
|
NSString *startDateAsString, *timezoneId;
|
||||||
|
SOGoUserDefaults *ud;
|
||||||
|
int delta;
|
||||||
|
|
||||||
|
delta = 0;
|
||||||
|
timezone = nil;
|
||||||
|
|
||||||
|
startDate = (iCalDateTime *) [self uniqueChildWithTag: @"dtstart"];
|
||||||
|
endDate = (iCalDateTime *) [self uniqueChildWithTag: @"dtend"];
|
||||||
|
|
||||||
|
if (![startDate dateTime])
|
||||||
|
{
|
||||||
|
if ([endDate dateTime])
|
||||||
|
{
|
||||||
|
// End date but no start date
|
||||||
|
delta = 60*60; // 1 hour
|
||||||
|
[self setStartDate: [[self endDate] dateByAddingYears: 0 months: 0 days: 0 hours: 0 minutes: 0 seconds: -delta]];
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
// No start date, no end date; start the event at the first "working" hour
|
||||||
|
date = [[NSCalendarDate calendarDate] beginOfDayForUser: [context activeUser]];
|
||||||
|
[self setStartDate: date];
|
||||||
|
}
|
||||||
|
startDate = (iCalDateTime *) [self uniqueChildWithTag: @"dtstart"];
|
||||||
|
[self errorWithFormat: @"Fixed event with no start date; setting start date to %@ for UID %@", [startDate dateTime], [self uid]];
|
||||||
|
}
|
||||||
|
|
||||||
|
if ([startDate dateTime])
|
||||||
|
{
|
||||||
|
timezoneId = [startDate value: 0 ofAttribute: @"tzid"];
|
||||||
|
if ([timezoneId length])
|
||||||
|
{
|
||||||
|
timezone = [iCalTimeZone timeZoneForName: timezoneId];
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
startDateAsString = [[startDate valuesAtIndex: 0 forKey: @""] objectAtIndex: 0];
|
||||||
|
if (![startDateAsString hasSuffix: @"Z"] &&
|
||||||
|
![startDateAsString hasSuffix: @"z"])
|
||||||
|
{
|
||||||
|
// The start date is a "floating time", let's use the user's timezone
|
||||||
|
// for both the start and end dates.
|
||||||
|
ud = [[context activeUser] userDefaults];
|
||||||
|
timezone = [iCalTimeZone timeZoneForName: [ud timeZoneName]];
|
||||||
|
delta = [[timezone periodForDate: [startDate dateTime]] secondsOffsetFromGMT];
|
||||||
|
|
||||||
|
[self setStartDate: [[self startDate] dateByAddingYears: 0 months: 0 days: 0 hours: 0 minutes: 0 seconds: -delta]];
|
||||||
|
[startDate setTimeZone: timezone];
|
||||||
|
|
||||||
|
if ([endDate dateTime])
|
||||||
|
{
|
||||||
|
[self setEndDate: [[self endDate] dateByAddingYears: 0 months: 0 days: 0 hours: 0 minutes: 0 seconds: -delta]];
|
||||||
|
[endDate setTimeZone: timezone];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (![endDate dateTime] && ![self hasDuration])
|
||||||
|
{
|
||||||
|
// No end date, no duration
|
||||||
|
if ([self isAllDay])
|
||||||
|
[self setDuration: @"P1D"];
|
||||||
|
else
|
||||||
|
[self setDuration: @"PT1H"];
|
||||||
|
|
||||||
|
[self errorWithFormat: @"Fixed event with no end date; setting duration to %@ for UID %@", [self duration], [self uid]];
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
// We check for broken all-day events (like the ones coming from the "WebCalendar" tool) where
|
||||||
|
// the start date is equal to the end date. This clearly violates the RFC:
|
||||||
|
//
|
||||||
|
// 3.8.2.2. Date-Time End
|
||||||
|
// The value MUST be later in time than the value of the "DTSTART" property.
|
||||||
|
//
|
||||||
|
if ([self isAllDay] && [[self startDate] isEqual: [self endDate]])
|
||||||
|
{
|
||||||
|
[self setEndDate: [[self startDate] dateByAddingYears: 0 months: 0 days: 1 hours: 0 minutes: 0 seconds: 0]];
|
||||||
|
[self errorWithFormat: @"Fixed broken all-day event; setting end date to %@ for UID %@", [self endDate], [self uid]];
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
return timezone;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
@end
|
@end
|
||||||
|
|
|
@ -1,31 +1,32 @@
|
||||||
/* NSCalendarDate+SOGo.h - this file is part of SOGo
|
/* NSCalendarDate+SOGo.h - this file is part of SOGo
|
||||||
Copyright (C) 2000-2004 SKYRIX Software AG
|
*
|
||||||
|
* Copyright (C) 2019 Inverse inc.
|
||||||
This file is part of OGo
|
*
|
||||||
|
* This file is free software; you can redistribute it and/or modify
|
||||||
OGo is free software; you can redistribute it and/or modify it under
|
* it under the terms of the GNU General Public License as published by
|
||||||
the terms of the GNU Lesser General Public License as published by the
|
* the Free Software Foundation; either version 2, or (at your option)
|
||||||
Free Software Foundation; either version 2, or (at your option) any
|
* any later version.
|
||||||
later version.
|
*
|
||||||
|
* This file is distributed in the hope that it will be useful,
|
||||||
OGo is distributed in the hope that it will be useful, but WITHOUT ANY
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
|
* GNU General Public License for more details.
|
||||||
License for more details.
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
You should have received a copy of the GNU Lesser General Public
|
* along with this program; see the file COPYING. If not, write to
|
||||||
License along with OGo; see the file COPYING. If not, write to the
|
* the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
|
||||||
Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA
|
* Boston, MA 02111-1307, USA.
|
||||||
02111-1307, USA.
|
*/
|
||||||
*/
|
|
||||||
|
|
||||||
#ifndef NSCALENDARDATE_SCHEDULER_H
|
#ifndef NSCALENDARDATE_SCHEDULER_H
|
||||||
#define NSCALENDARDATE_SCHEDULER_H
|
#define NSCALENDARDATE_SCHEDULER_H
|
||||||
|
|
||||||
#import <Foundation/NSCalendarDate.h>
|
#import <Foundation/NSCalendarDate.h>
|
||||||
|
|
||||||
|
@class NSCalendarDate;
|
||||||
@class NSString;
|
@class NSString;
|
||||||
@class NSTimeZone;
|
@class NSTimeZone;
|
||||||
|
@class SOGoUser;
|
||||||
|
|
||||||
@interface NSCalendarDate (SOGoExtensions)
|
@interface NSCalendarDate (SOGoExtensions)
|
||||||
|
|
||||||
|
@ -34,6 +35,7 @@
|
||||||
inTimeZone: (NSTimeZone *) timeZone;
|
inTimeZone: (NSTimeZone *) timeZone;
|
||||||
|
|
||||||
- (BOOL) isDateInSameMonth: (NSCalendarDate *) _other;
|
- (BOOL) isDateInSameMonth: (NSCalendarDate *) _other;
|
||||||
|
- (NSCalendarDate *) beginOfDayForUser: (SOGoUser *) user;
|
||||||
|
|
||||||
- (NSString *) shortDateString;
|
- (NSString *) shortDateString;
|
||||||
- (NSString *) rfc822DateString;
|
- (NSString *) rfc822DateString;
|
||||||
|
|
|
@ -1,29 +1,31 @@
|
||||||
/* NSCalendarDate+SOGo.m - this file is part of SOGo
|
/* NSCalendarDate+SOGo.m - this file is part of SOGo
|
||||||
Copyright (C) 2000-2004 SKYRIX Software AG
|
*
|
||||||
|
* Copyright (C) 2019 Inverse inc.
|
||||||
This file is part of OGo
|
*
|
||||||
|
* This file is free software; you can redistribute it and/or modify
|
||||||
OGo is free software; you can redistribute it and/or modify it under
|
* it under the terms of the GNU General Public License as published by
|
||||||
the terms of the GNU Lesser General Public License as published by the
|
* the Free Software Foundation; either version 2, or (at your option)
|
||||||
Free Software Foundation; either version 2, or (at your option) any
|
* any later version.
|
||||||
later version.
|
*
|
||||||
|
* This file is distributed in the hope that it will be useful,
|
||||||
OGo is distributed in the hope that it will be useful, but WITHOUT ANY
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
|
* GNU General Public License for more details.
|
||||||
License for more details.
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
You should have received a copy of the GNU Lesser General Public
|
* along with this program; see the file COPYING. If not, write to
|
||||||
License along with OGo; see the file COPYING. If not, write to the
|
* the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
|
||||||
Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA
|
* Boston, MA 02111-1307, USA.
|
||||||
02111-1307, USA.
|
*/
|
||||||
*/
|
|
||||||
|
|
||||||
#import <Foundation/NSTimeZone.h>
|
#import <Foundation/NSTimeZone.h>
|
||||||
#import <Foundation/NSValue.h>
|
#import <Foundation/NSValue.h>
|
||||||
|
|
||||||
#import <NGExtensions/NSCalendarDate+misc.h>
|
#import <NGExtensions/NSCalendarDate+misc.h>
|
||||||
|
|
||||||
|
#import <SOGo/SOGoUser.h>
|
||||||
|
#import <SOGo/SOGoUserDefaults.h>
|
||||||
|
|
||||||
#import "NSCalendarDate+SOGo.h"
|
#import "NSCalendarDate+SOGo.h"
|
||||||
|
|
||||||
static NSString *rfc822Days[] = {@"Sun", @"Mon", @"Tue", @"Wed", @"Thu",
|
static NSString *rfc822Days[] = {@"Sun", @"Mon", @"Tue", @"Wed", @"Thu",
|
||||||
|
@ -96,6 +98,26 @@ static NSString *rfc822Months[] = {@"", @"Jan", @"Feb", @"Mar", @"Apr",
|
||||||
return str;
|
return str;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
- (NSCalendarDate *) beginOfDayForUser: (SOGoUser *) user
|
||||||
|
{
|
||||||
|
NSCalendarDate *date;
|
||||||
|
NSTimeZone *timeZone;
|
||||||
|
SOGoUserDefaults *ud;
|
||||||
|
|
||||||
|
ud = [user userDefaults];
|
||||||
|
timeZone = [ud timeZone];
|
||||||
|
[self setTimeZone: timeZone];
|
||||||
|
date = [self beginOfDay];
|
||||||
|
date = [date addYear: 0
|
||||||
|
month: 0
|
||||||
|
day: 0
|
||||||
|
hour: 0 - [date hourOfDay] + [ud dayStartHour]
|
||||||
|
minute: 0 - [date minuteOfHour]
|
||||||
|
second: 0];
|
||||||
|
|
||||||
|
return date;
|
||||||
|
}
|
||||||
|
|
||||||
- (NSString *) rfc822DateString
|
- (NSString *) rfc822DateString
|
||||||
{
|
{
|
||||||
int timeZoneShift, tzSeconds;
|
int timeZoneShift, tzSeconds;
|
||||||
|
|
Loading…
Reference in New Issue