]> err.no Git - scalable-opengroupware.org/commitdiff
see changelog
authorznek <znek@d1b88da0-ebda-0310-925b-ed51d893ca5b>
Wed, 30 Jun 2004 01:06:13 +0000 (01:06 +0000)
committerznek <znek@d1b88da0-ebda-0310-925b-ed51d893ca5b>
Wed, 30 Jun 2004 01:06:13 +0000 (01:06 +0000)
git-svn-id: http://svn.opengroupware.org/SOGo/trunk@89 d1b88da0-ebda-0310-925b-ed51d893ca5b

SOGoLogic/ChangeLog
SOGoLogic/SOGoAppointment.h
SOGoLogic/SOGoAppointment.m

index b05ad306899600d4b6eb52bce0fffcf518914a65..d7958e21cb3ef9cbbbde51273dadf26ace5fb84e 100644 (file)
@@ -1,3 +1,9 @@
+2004-06-30  Marcus Mueller  <znek@mulle-kybernetik.com>
+
+       * SOGoAppointment.[hm]: new cover methods. also added hackish
+         iCalString - this should be redone using some SAXProducer/Coder
+         architecture.
+
 2004-06-30  Helge Hess  <helge.hess@opengroupware.org>
 
        * SOGoAppointment.m: cache iCal parser and SAX driver
index c0a3d335e38ce61236dfa5680db2f13462bf9bcc..ab12abcdb929e0f5bf12d6586e6bf504233dbb51 100644 (file)
 
 - (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;
 
index d3ea8282e1259732bd128bd5ddbe9d44fe7aead5..d88e1c40191f3fe1c9ea0fa95186edd425ca90b1 100644 (file)
@@ -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];
 }