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 */
- (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];
return [self->event organizer];
}
+- (void)removeAllAttendees {
+ [self->event removeAllAttendees];
+}
- (void)addToAttendees:(iCalPerson *)_person {
[self->event addToAttendees:_person];
}