From: znek Date: Wed, 30 Jun 2004 01:06:13 +0000 (+0000) Subject: see changelog X-Git-Url: https://err.no/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=9d3b6963373a3c73f5d167129ac4b93d5c519ff6;p=scalable-opengroupware.org see changelog git-svn-id: http://svn.opengroupware.org/SOGo/trunk@89 d1b88da0-ebda-0310-925b-ed51d893ca5b --- diff --git a/SOGoLogic/ChangeLog b/SOGoLogic/ChangeLog index b05ad306..d7958e21 100644 --- a/SOGoLogic/ChangeLog +++ b/SOGoLogic/ChangeLog @@ -1,3 +1,9 @@ +2004-06-30 Marcus Mueller + + * SOGoAppointment.[hm]: new cover methods. also added hackish + iCalString - this should be redone using some SAXProducer/Coder + architecture. + 2004-06-30 Helge Hess * SOGoAppointment.m: cache iCal parser and SAX driver diff --git a/SOGoLogic/SOGoAppointment.h b/SOGoLogic/SOGoAppointment.h index c0a3d335..ab12abcd 100644 --- a/SOGoLogic/SOGoAppointment.h +++ b/SOGoLogic/SOGoAppointment.h @@ -46,7 +46,11 @@ - (void)setLocation:(NSString *)_value; - (NSString *)location; +- (BOOL)hasLocation; +- (void)setStatus:(NSString *)_value; +- (NSString *)status; + - (void)setStartDate:(NSCalendarDate *)_date; - (NSCalendarDate *)startDate; @@ -61,6 +65,7 @@ - (void)setOrganizer:(iCalPerson *)_organizer; - (iCalPerson *)organizer; +- (void)removeAllAttendees; - (void)addToAttendees:(iCalPerson *)_person; - (NSArray *)attendees; diff --git a/SOGoLogic/SOGoAppointment.m b/SOGoLogic/SOGoAppointment.m index d3ea8282..d88e1c40 100644 --- a/SOGoLogic/SOGoAppointment.m +++ b/SOGoLogic/SOGoAppointment.m @@ -80,6 +80,84 @@ static SaxObjectDecoder *sax = nil; return self->event; } +/* TODO: REMOVE THIS HACK ASAP */ +- (NSString *)iCalString { + NSMutableString *s; + NSArray *persons; + unsigned i, count; + iCalPerson *p; + + /* assume length of 1K - reasonable ? */ + s = [[NSMutableString alloc] initWithCapacity:1024]; + [s appendString:@"BEGIN:VCALENDAR\nMETHOD:REQUEST\nPRODID:"]; + [s appendString:[self->calendar prodId]]; + [s appendString:@"\nVERSION:"]; + [s appendString:[self->calendar version]]; + [s appendString:@"\nBEGIN:VEVENT"]; + [s appendString:@"\nSUMMARY:"]; + [s appendString:[self summary]]; + if([self hasLocation]) { + [s appendString:@"\nLOCATION:"]; + [s appendString:[self location]]; + } + [s appendString:@"\nUID:"]; + [s appendString:[self uid]]; + [s appendString:@"\nDTSTART:"]; + [s appendString:[[self startDate] icalString]]; + if([self hasEndDate]) { + [s appendString:@"\nDTEND:"]; + [s appendString:[[self endDate] icalString]]; + } + if([self hasDuration]) { + [s appendString:@"\nDURATION:"]; + [s appendString:[(iCalEvent *)self->event duration]]; + } + [s appendString:@"\nSTATUS:"]; + [s appendString:[self status]]; + + /* what's all this? */ + [s appendString:@"\nTRANSP:OPAQUE"]; + [s appendString:@"\nCLASS:PRIVATE"]; + + /* organizer */ + p = [self organizer]; + if(p) { + NSString *x; + + [s appendString:@"\nORGANIZER;CN=\""]; + if((x = [p cn])) { + [s appendString:x]; + } + [s appendString:@"\""]; + if((x = [p email])) { + [s appendString:@":"]; /* sic! */ + [s appendString:x]; + } + } + + /* attendees */ + persons = [self attendees]; + count = [persons count]; + for(i = 0; i < count; i++) { + NSString *x; + + p = [persons objectAtIndex:i]; + [s appendString:@"\nATTENDEE;CN=\""]; + if((x = [p cn])) { + [s appendString:x]; + } + [s appendString:@"\""]; + if((x = [p email])) { + [s appendString:@":"]; /* sic! */ + [s appendString:x]; + } + } + + /* postamble */ + [s appendString:@"\nEND:VEVENT\nEND:VCALENDAR"]; + return [s autorelease]; +} + /* forwarded methods */ @@ -104,6 +182,16 @@ static SaxObjectDecoder *sax = nil; - (NSString *)location { return [self->event location]; } +- (BOOL)hasLocation { + return ([self location] != nil) && ([[self location] length] > 0); +} + +- (void)setStatus:(NSString *)_value { + [self->event setStatus:_value]; +} +- (NSString *)status { + return [(iCalEvent *)self->event status]; +} - (void)setStartDate:(NSCalendarDate *)_date { [self->event setStartDate:_date]; @@ -139,6 +227,9 @@ static SaxObjectDecoder *sax = nil; return [self->event organizer]; } +- (void)removeAllAttendees { + [self->event removeAllAttendees]; +} - (void)addToAttendees:(iCalPerson *)_person { [self->event addToAttendees:_person]; }