From cfe1d1151a073cc7b7f289c441ab7cde8c2ba9fb Mon Sep 17 00:00:00 2001 From: Wolfgang Sourdeau Date: Thu, 27 Aug 2009 16:12:00 +0000 Subject: [PATCH] Monotone-Parent: 1639c49f52eac11f85997ccaa9ebcc659f81dd46 Monotone-Revision: 413f1a1eef0a131464297caa0b801dbd10e14b8d Monotone-Author: wsourdeau@inverse.ca Monotone-Date: 2009-08-27T16:12:00 Monotone-Branch: ca.inverse.sogo --- SOPE/NGCards/ChangeLog | 4 ++++ SOPE/NGCards/iCalPerson.h | 9 +++++++ SOPE/NGCards/iCalPerson.m | 50 +++++++++++++++++++++++++++++++++++++++ 3 files changed, 63 insertions(+) diff --git a/SOPE/NGCards/ChangeLog b/SOPE/NGCards/ChangeLog index b69bb8d92..b63455a39 100644 --- a/SOPE/NGCards/ChangeLog +++ b/SOPE/NGCards/ChangeLog @@ -1,5 +1,9 @@ 2009-08-27 Wolfgang Sourdeau + * iCalPerson.m (-setDelegatedTo:, -setDelegatedFrom:) + (-setSentBy:): new helper methods to set the corresponding + attributes, properly formatted. The getters were added too. + * iCalEntityObject.m (-removeFromAttendees:): new helper method to remove a specific attendee from the list. diff --git a/SOPE/NGCards/iCalPerson.h b/SOPE/NGCards/iCalPerson.h index 222de9e3d..6c7644673 100644 --- a/SOPE/NGCards/iCalPerson.h +++ b/SOPE/NGCards/iCalPerson.h @@ -66,6 +66,15 @@ typedef enum { - (NSString *)partStat; - (NSString *)partStatWithDefault; +- (void) setDelegatedTo: (NSString *) newDelegate; +- (NSString *) delegatedTo; + +- (void) setDelegatedFrom: (NSString *) newDelegatee; +- (NSString *) delegatedFrom; + +- (void) setSentBy: (NSString *) newDelegatee; +- (NSString *) sentBy; + - (void)setParticipationStatus:(iCalPersonPartStat)_status; - (iCalPersonPartStat)participationStatus; diff --git a/SOPE/NGCards/iCalPerson.m b/SOPE/NGCards/iCalPerson.m index bb1e73cbe..3fc8fd181 100644 --- a/SOPE/NGCards/iCalPerson.m +++ b/SOPE/NGCards/iCalPerson.m @@ -189,6 +189,56 @@ return iCalPersonPartStatOther; } +- (void) _setValueOfMailtoAttribute: (NSString *) name + to: (NSString *) value +{ + if ([value length] && ![value hasPrefix: @"\""]) + value = [NSString stringWithFormat: @"\"%@\"", value]; + + [self setValue: 0 ofAttribute: name to: value]; +} + +- (NSString *) _valueOfMailtoAttribute: (NSString *) name +{ + NSString *mailTo; + + mailTo = [self value: 0 ofAttribute: name]; + if ([mailTo hasPrefix: @"\""]) + mailTo + = [mailTo substringWithRange: NSMakeRange (0, [mailTo length] - 2)]; + + return mailTo; +} + +- (void) setDelegatedTo: (NSString *) newDelegate +{ + [self _setValueOfMailtoAttribute: @"delegated-to" to: newDelegate]; +} + +- (NSString *) delegatedTo +{ + return [self _valueOfMailtoAttribute: @"delegated-to"]; +} + +- (void) setDelegatedFrom: (NSString *) newDelegator +{ + [self _setValueOfMailtoAttribute: @"delegated-from" to: newDelegator]; +} + +- (NSString *) delegatedFrom +{ + return [self _valueOfMailtoAttribute: @"delegated-from"]; +} + +- (void) setSentBy: (NSString *) newSentBy +{ + [self _setValueOfMailtoAttribute: @"sent-by" to: newSentBy]; +} + +- (NSString *) sentBy +{ + return [self _valueOfMailtoAttribute: @"sent-by"]; +} /* comparison */