]> err.no Git - sope/commitdiff
formal definitions of participantStatus
authorznek <znek@e4a50df8-12e2-0310-a44c-efbce7f8a7e3>
Fri, 17 Dec 2004 12:10:21 +0000 (12:10 +0000)
committerznek <znek@e4a50df8-12e2-0310-a44c-efbce7f8a7e3>
Fri, 17 Dec 2004 12:10:21 +0000 (12:10 +0000)
git-svn-id: http://svn.opengroupware.org/SOPE/trunk@450 e4a50df8-12e2-0310-a44c-efbce7f8a7e3

sope-ical/NGiCal/ChangeLog
sope-ical/NGiCal/Version
sope-ical/NGiCal/iCalPerson.h
sope-ical/NGiCal/iCalPerson.m

index ec3e4cd09cf8a45a2c6c6c1546d2ecfc0a6621a5..40dfc469aba95df260e893694c80d21562d0ffb2 100644 (file)
@@ -1,3 +1,9 @@
+2004-12-17  Marcus Mueller  <znek@mulle-kybernetik.com>
+
+       * iCalPerson.[hm]: formalized participationStatus according to RFC2445.
+         Provided convenience API to set status without concrete knowledge
+         of string values involved. (v4.5.38)
+
 2004-12-16  Marcus Mueller  <znek@mulle-kybernetik.com>
 
        * v4.5.37
index 6329c0fc8dd6ebe5425d838d5f7af688fbbe8491..177d90a94b33616d86d66a9c58097e7b4a7302a3 100644 (file)
@@ -2,6 +2,6 @@
 
 MAJOR_VERSION=4
 MINOR_VERSION=5
-SUBMINOR_VERSION:=37
+SUBMINOR_VERSION:=38
 
 # v4.5.37 requires NGExtensions v4.5.140
index 83c098d9357b7969f285866d4a0b3aeaa409327f..524082b35458dcd69d86832596c687ab5cc49edc 100644 (file)
 
 #include <NGiCal/iCalObject.h>
 
+typedef enum {
+  iCalPersonPartStatNeedsAction  = 0, /* NEEDS-ACTION (DEFAULT) */
+  iCalPersonPartStatAccepted     = 1, /* ACCEPTED               */
+  iCalPersonPartStatDeclined     = 2, /* DECLINED               */
+  /* up to here defined for VJOURNAL                            */
+  iCalPersonPartStatTentative    = 3, /* TENTATIVE              */
+  iCalPersonPartStatDelegated    = 4, /* DELEGATED              */
+  /* up to here defined for VEVENT                              */
+  iCalPersonPartStatCompleted    = 5, /* COMPLETED              */
+  iCalPersonPartStatInProcess    = 6, /* IN-PROCESS             */
+  /* up to there defined for VTODO                              */
+  
+  /* these are also defined for VJOURNAL, VEVENT and VTODO      */
+  iCalPersonPartStatExperimental = 7, /* x-name                 */
+  iCalPersonPartStatOther        = 8  /* iana-token             */
+} iCalPersonPartStat;
+
 @interface iCalPerson : iCalObject
 {
   NSString *cn;
   NSString *email;
-  NSString *rsvp;     /* FALSE           */
-  NSString *partStat; /* ACCEPTED        */
-  NSString *role;     /* REQ-PARTICIPANT */
-  NSString *xuid;     /* x22sAAHFf       */
+  NSString *rsvp;     /* i.e. FALSE           */
+  NSString *partStat; /* i.e. NEEDS-ACTION    */
+  NSString *role;     /* i.e. REQ-PARTICIPANT */
+  NSString *xuid;     /* i.e. x22sAAHFf       */
 }
 
 /* accessors */
@@ -57,6 +74,9 @@
 - (void)setPartStat:(NSString *)_s;
 - (NSString *)partStat;
 
+- (void)setParticipationStatus:(iCalPersonPartStat)_status;
+- (iCalPersonPartStat)participationStatus;
+
 - (BOOL)isEqualToPerson:(iCalPerson *)_other;
 - (BOOL)hasSameEmailAddress:(iCalPerson *)_other;
 
index f9110eff147113406758c0fb3a9220f8221e3dd6..72512d67862da7d7e098e6895060208575d15f39 100644 (file)
   return self->partStat;
 }
 
+- (void)setParticipationStatus:(iCalPersonPartStat)_status {
+  NSString *stat;
+
+  switch (_status) {
+    case iCalPersonPartStatAccepted:
+      stat = @"ACCEPTED";
+      break;
+    case iCalPersonPartStatDeclined:
+      stat = @"DECLINED";
+      break;
+    case iCalPersonPartStatTentative:
+      stat = @"TENTATIVE";
+      break;
+    case iCalPersonPartStatDelegated:
+      stat = @"DELEGATED";
+      break;
+    case iCalPersonPartStatCompleted:
+      stat = @"COMPLETED";
+      break;
+    case iCalPersonPartStatInProcess:
+      stat = @"IN-PROCESS";
+      break;
+    case iCalPersonPartStatExperimental:
+    case iCalPersonPartStatOther:
+      [NSException raise:NSInternalInconsistencyException
+                   format:@"Attempt to set meaningless "
+                          @"participationStatus (%d)!", _status];
+      break;
+    default:
+      stat = @"NEEDS-ACTION";
+      break;
+  }
+  [self setPartStat:stat];
+}
+
+- (iCalPersonPartStat)participationStatus {
+  NSString *stat;
+  
+  stat = [[self partStat] uppercaseString];
+  if (![stat isNotNull] || [stat isEqualToString:@"NEEDS-ACTION"])
+    return iCalPersonPartStatNeedsAction;
+  else if ([stat isEqualToString:@"ACCEPTED"])
+    return iCalPersonPartStatAccepted;
+  else if ([stat isEqualToString:@"DECLINED"])
+    return iCalPersonPartStatDeclined;
+  else if ([stat isEqualToString:@"TENTATIVE"])
+    return iCalPersonPartStatTentative;
+  else if ([stat isEqualToString:@"DELEGATED"])
+    return iCalPersonPartStatDelegated;
+  else if ([stat isEqualToString:@"COMPLETED"])
+    return iCalPersonPartStatCompleted;
+  else if ([stat isEqualToString:@"IN-PROCESS"])
+    return iCalPersonPartStatInProcess;
+  else if ([stat hasPrefix:@"X-"])
+    return iCalPersonPartStatExperimental;
+  return iCalPersonPartStatOther;
+}
+
+
 /* comparison */
 
 - (unsigned)hash {