diff --git a/SOPE/NGCards/CardVersitRenderer.m b/SOPE/NGCards/CardVersitRenderer.m index 9c4521d4a..35e50d0e7 100644 --- a/SOPE/NGCards/CardVersitRenderer.m +++ b/SOPE/NGCards/CardVersitRenderer.m @@ -72,41 +72,19 @@ } [rendering appendString: [tag uppercaseString]]; + + /* parameters */ attributes = [anElement attributes]; - keys = [[attributes allKeys] objectEnumerator]; - while ((key = [keys nextObject])) + if ([attributes count]) { - NSString *s; - int i, c; - - renderedAttrs = [[attributes objectForKey: key] renderedForCards]; - c = [renderedAttrs count]; - if (c > 0) - { - [rendering appendFormat: @";%@=", [key uppercaseString]]; - - for (i = 0; i < c; i++) - { - s = [renderedAttrs objectAtIndex: i]; - - /* We MUST quote attribute values that have a ":" in them - and that not already quoted */ - if ([s length] > 2 && [s rangeOfString: @":"].length && - [s characterAtIndex: 0] != '"' && ![s hasSuffix: @"\""]) - s = [NSString stringWithFormat: @"\"%@\"", s]; - - [rendering appendFormat: @"%@", s]; - - if (i+1 < c) - [rendering appendString: @","]; - } - } + [rendering appendString: @";"]; + [attributes versitRenderInString: rendering asAttributes: YES]; } + /* values */ values = [anElement values]; - if ([values count] > 0) - [rendering appendFormat: @":%@", - [[values renderedForCards] componentsJoinedByString: @";"]]; + [rendering appendString: @":"]; + [values versitRenderInString: rendering asAttributes: NO]; if ([rendering length] > 0) [rendering appendString: @"\r\n"]; diff --git a/SOPE/NGCards/ChangeLog b/SOPE/NGCards/ChangeLog index e176b447f..fd6b23d98 100644 --- a/SOPE/NGCards/ChangeLog +++ b/SOPE/NGCards/ChangeLog @@ -1,3 +1,37 @@ +2011-11-13 Wolfgang Sourdeau + + * iCalTrigger.m (-setValue:, value): removed useless accessors. + + * iCalAttachment.m (-setValue:, value): removed useless accessors. + + * iCalRecurrenceRule.m (-setRrule): now makes use of the existing + parsing algorithm and get the values from the parsed element. + + * iCalEntityObject.m (-setCategories:): now take an array as + parameter. + + * NSString+NGCards.m (-vCardSubvalues): new method adapted to the + new CardElement data structure, replaces + "vCardSubvaluesWithSeparator:", since we now know how to properly + separate or escape elements. + + * CardElement.m (-init): "values" in now an NSMutableDictionary. + (-setValues:, -values): new primitive accessors; + (-setValues:atIndex:forKey:, -setSingleValue:atIndex:forKey:) + (setSingleValue:forKey:): new helper setters. + (-flattenedValueAtIndex:forKey:, -flattenedValues:forKey:): new + "flattened" helper getters. "Flattening" meaning here that the + first and/or second level array are merged with "," and ";", to + support clients that badly escape(d) their output for fields + taking only one value or a specific set of values. + (-valuesForKey:,-valuesAtIndex:forKey:): new helper getters + +2011-11-09 Wolfgang Sourdeau + + * NSString+NGCards.m (-escapedForCards): restored the escaping of + commas, since they might be used in fields such as + COMMENT/DESCRIPTION (iCalendar) or NOTE (vCards) + 2011-09-20 Wolfgang Sourdeau * iCalToDo.m (-setCompleted:): (hack) when invoked with a nil diff --git a/SOPE/NGCards/NSString+NGCards.m b/SOPE/NGCards/NSString+NGCards.m index f27b964c3..e46b2e29d 100644 --- a/SOPE/NGCards/NSString+NGCards.m +++ b/SOPE/NGCards/NSString+NGCards.m @@ -157,8 +157,8 @@ string = [self stringByReplacingString: @"\\" withString: @"\\\\"]; - // string = [string stringByReplacingString: @"," - // withString: @"\\,"]; + string = [string stringByReplacingString: @"," + withString: @"\\,"]; // string = [string stringByReplacingString: @":" // withString: @"\\:"]; string = [string stringByReplacingString: @";" diff --git a/SOPE/NGCards/iCalEntityObject.m b/SOPE/NGCards/iCalEntityObject.m index d28a4f78a..446eab0ef 100644 --- a/SOPE/NGCards/iCalEntityObject.m +++ b/SOPE/NGCards/iCalEntityObject.m @@ -72,54 +72,55 @@ /* accessors */ -- (void) setUid: (NSString *) _uid +- (void) setUid: (NSString *) _value { - [[self uniqueChildWithTag: @"uid"] setValue: 0 to: _uid]; + [[self uniqueChildWithTag: @"uid"] setSingleValue: _value forKey: @""]; } - (NSString *) uid { - return [[self uniqueChildWithTag: @"uid"] value: 0]; + return [[self uniqueChildWithTag: @"uid"] flattenedValuesForKey: @""]; } - (void) setSummary: (NSString *) _value { - [[self uniqueChildWithTag: @"summary"] setValue: 0 to: _value]; + [[self uniqueChildWithTag: @"summary"] setSingleValue: _value forKey: @""]; } - (NSString *) summary { - return [[self uniqueChildWithTag: @"summary"] value: 0]; + return [[self uniqueChildWithTag: @"summary"] flattenedValuesForKey: @""]; } - (void) setLocation: (NSString *) _value { - [[self uniqueChildWithTag: @"location"] setValue: 0 to: _value]; + [[self uniqueChildWithTag: @"location"] setSingleValue: _value forKey: @""]; } - (NSString *) location { - return [[self uniqueChildWithTag: @"location"] value: 0]; + return [[self uniqueChildWithTag: @"location"] flattenedValuesForKey: @""]; } +#warning the "comment" accessors are actually "description" accessors, the "comment" ones are missing - (void) setComment: (NSString *) _value { - [[self uniqueChildWithTag: @"description"] setValue: 0 to: _value]; + [[self uniqueChildWithTag: @"description"] setSingleValue: _value forKey: @""]; } - (NSString *) comment { - return [[self uniqueChildWithTag: @"description"] value: 0]; + return [[self uniqueChildWithTag: @"description"] flattenedValuesForKey: @""]; } - (void) setAccessClass: (NSString *) _value { - [[self uniqueChildWithTag: @"class"] setValue: 0 to: _value]; + [[self uniqueChildWithTag: @"class"] setSingleValue: _value forKey: @""]; } - (NSString *) accessClass { - return [[self uniqueChildWithTag: @"class"] value: 0]; + return [[self uniqueChildWithTag: @"class"] flattenedValuesForKey: @""]; } - (iCalAccessClass) symbolicAccessClass