Monotone-Parent: c8a00b4000a967d747332ed76e3501e958d17cfb

Monotone-Revision: 54dc6ee0dac49ddab76097b4e22cd6d4d5d91a3d

Monotone-Author: wsourdeau@inverse.ca
Monotone-Date: 2007-03-07T21:33:13
Monotone-Branch: ca.inverse.sogo
maint-2.0.2
Wolfgang Sourdeau 2007-03-07 21:33:13 +00:00
parent e8b0610707
commit dbfa5926b6
3 changed files with 80 additions and 0 deletions

View File

@ -1,5 +1,18 @@
2007-03-07 Wolfgang Sourdeau <wsourdeau@inverse.ca>
* SoObjects/Appointments/SOGoCalendarComponent.m
([SOGoCalendarComponent -contentAsString]): overriden method that
takes the privacy into account and discard the relevant fields if
needed by generating a new content string and caching it.
([SOGoCalendarComponent
-saveContentString:contentStringbaseVersion:baseVersion]): if the
new method above has cached a content string, release it and set
it to nil so that it will have to be regenerated in the case it is
requested further.
([SOGoCalendarComponent -_filterPrivateComponent:component]):
discard the fields that have to be hidden when the card is
private.
* SoObjects/Appointments/SOGoAppointmentFolder.m
([SOGoAppointmentFolder
-appendObject:objectwithBaseURL:baseURLtoREPORTResponse:r]): make

View File

@ -34,6 +34,7 @@
@interface SOGoCalendarComponent : SOGoContentObject
{
iCalCalendar *calendar;
NSString *calContent;
}
- (NSString *) componentTag;

View File

@ -68,6 +68,7 @@ static BOOL sendEMailNotifications = NO;
if ((self = [super init]))
{
calendar = nil;
calContent = nil;
}
return self;
@ -77,6 +78,8 @@ static BOOL sendEMailNotifications = NO;
{
if (calendar)
[calendar release];
if (calContent)
[calContent release];
[super dealloc];
}
@ -92,6 +95,69 @@ static BOOL sendEMailNotifications = NO;
return nil;
}
- (void) _filterPrivateComponent: (iCalEntityObject *) component
{
[component setSummary: @""];
[component setComment: @""];
[component setUserComment: @""];
[component setLocation: @""];
[component setCategories: @""];
[component setUrl: @""];
[component removeAllAttendees];
[component removeAllAlarms];
}
- (NSString *) contentAsString
{
NSString *tmpContent, *email;
iCalCalendar *tmpCalendar;
iCalRepeatableEntityObject *tmpComponent;
WOContext *context;
if (!calContent)
{
tmpContent = [super contentAsString];
calContent = tmpContent;
if ([tmpContent length] > 0)
{
tmpCalendar = [iCalCalendar parseSingleFromSource: tmpContent];
tmpComponent = (iCalRepeatableEntityObject *) [tmpCalendar firstChildWithTag: [self componentTag]];
if (![tmpComponent isPublic])
{
context = [[WOApplication application] context];
email = [[context activeUser] email];
if (!([tmpComponent isOrganizer: email]
|| [tmpComponent isParticipant: email]))
{
// content = tmpContent;
[self _filterPrivateComponent: tmpComponent];
calContent = [tmpCalendar versitString];
}
}
}
[calContent retain];
}
return calContent;
}
- (NSException *) saveContentString: (NSString *) contentString
baseVersion: (unsigned int) baseVersion
{
NSException *result;
result = [super saveContentString: contentString
baseVersion: baseVersion];
if (!result && calContent)
{
[calContent release];
calContent = nil;
}
return result;
}
- (iCalCalendar *) calendar
{
NSString *iCalString;