mirror of
https://github.com/inverse-inc/sogo.git
synced 2026-05-27 06:15:26 +00:00
See ChangeLog.
Monotone-Parent: ed8a21d5648d8bc72dc33ad272987d8963be1285 Monotone-Revision: 12a15fd8afcf3963e3ec84c6a630972534773465 Monotone-Author: flachapelle@inverse.ca Monotone-Date: 2011-04-16T01:35:06 Monotone-Branch: ca.inverse.sogo
This commit is contained in:
@@ -1336,6 +1336,44 @@
|
||||
[rq setContent: [[calendar versitString] dataUsingEncoding: [rq contentEncoding]]];
|
||||
}
|
||||
|
||||
/**
|
||||
* Verify vCalendar for any inconsistency or missing attributes.
|
||||
* Currently only check if the events have an end date or a duration.
|
||||
* @param rq the HTTP PUT request
|
||||
*/
|
||||
- (void) _adjustEventsInRequest: (WORequest *) rq
|
||||
{
|
||||
iCalCalendar *calendar;
|
||||
NSArray *allEvents;
|
||||
iCalEvent *event;
|
||||
NSUInteger i;
|
||||
BOOL modified;
|
||||
|
||||
calendar = [iCalCalendar parseSingleFromSource: [rq contentAsString]];
|
||||
allEvents = [calendar events];
|
||||
modified = NO;
|
||||
|
||||
for (i = 0; i < [allEvents count]; i++)
|
||||
{
|
||||
event = [allEvents objectAtIndex: i];
|
||||
|
||||
if (![event hasEndDate] && ![event hasDuration])
|
||||
{
|
||||
// No end date, no duration
|
||||
if ([event isAllDay])
|
||||
[event setDuration: @"P1D"];
|
||||
else
|
||||
[event setDuration: @"PT1H"];
|
||||
|
||||
modified = YES;
|
||||
[self errorWithFormat: @"Invalid event: no end date; setting duration to %@", [event duration]];
|
||||
}
|
||||
}
|
||||
|
||||
if (modified)
|
||||
[rq setContent: [[calendar versitString] dataUsingEncoding: [rq contentEncoding]]];
|
||||
}
|
||||
|
||||
- (void) _decomposeGroupsInRequest: (WORequest *) rq
|
||||
{
|
||||
iCalCalendar *calendar;
|
||||
@@ -1471,6 +1509,8 @@
|
||||
{
|
||||
[self _adjustTransparencyInRequest: rq];
|
||||
}
|
||||
|
||||
[self _adjustEventsInRequest: rq];
|
||||
}
|
||||
|
||||
//
|
||||
|
||||
Reference in New Issue
Block a user