+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
MAJOR_VERSION=4
MINOR_VERSION=5
-SUBMINOR_VERSION:=37
+SUBMINOR_VERSION:=38
# v4.5.37 requires NGExtensions v4.5.140
#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 */
- (void)setPartStat:(NSString *)_s;
- (NSString *)partStat;
+- (void)setParticipationStatus:(iCalPersonPartStat)_status;
+- (iCalPersonPartStat)participationStatus;
+
- (BOOL)isEqualToPerson:(iCalPerson *)_other;
- (BOOL)hasSameEmailAddress:(iCalPerson *)_other;
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 {