From da5c8878acde0220d2b8ee07dde24a8babdeaae2 Mon Sep 17 00:00:00 2001 From: helge Date: Tue, 31 May 2005 11:39:05 +0000 Subject: [PATCH] improved vCard type handling git-svn-id: http://svn.opengroupware.org/SOPE/trunk@815 e4a50df8-12e2-0310-a44c-efbce7f8a7e3 --- sope-ical/NGiCal/ChangeLog | 5 +++++ sope-ical/NGiCal/NGVCardSaxHandler.m | 16 ++++++++++++++-- sope-ical/NGiCal/Version | 2 +- 3 files changed, 20 insertions(+), 3 deletions(-) diff --git a/sope-ical/NGiCal/ChangeLog b/sope-ical/NGiCal/ChangeLog index b71bc0be..b4141928 100644 --- a/sope-ical/NGiCal/ChangeLog +++ b/sope-ical/NGiCal/ChangeLog @@ -1,3 +1,8 @@ +2005-05-31 Helge Hess + + * NGVCardSaxHandler.m: ensure that types are always uppercase, improved + check for DUPs (v4.5.46) + 2005-05-16 Marcus Mueller * NGiCal.xcode: reorganized ordering of headers/classes diff --git a/sope-ical/NGiCal/NGVCardSaxHandler.m b/sope-ical/NGiCal/NGVCardSaxHandler.m index b169e2ed..239ae8bc 100644 --- a/sope-ical/NGiCal/NGVCardSaxHandler.m +++ b/sope-ical/NGiCal/NGVCardSaxHandler.m @@ -159,8 +159,20 @@ v = [_attrs valueAtIndex:i]; if ([n hasSuffix:@".type"] || [n isEqualToString:@"TYPE"]) { - if (![self->types containsObject:v]) - [self->types addObjectsFromArray:[v componentsSeparatedByString:@" "]]; + /* + Note: types cannot be separated by comma! Its indeed always a space,eg + "work pref voice" + If you find commas, usually the vCard is broken. + */ + NSEnumerator *e; + NSString *k; + + e = [[v componentsSeparatedByString:@" "] objectEnumerator]; + while ((k = [e nextObject]) != nil) { + k = [k uppercaseString]; + if ([self->types containsObject:k]) continue; + [self->types addObject:k]; + } } else [self->args setObject:v forKey:n]; diff --git a/sope-ical/NGiCal/Version b/sope-ical/NGiCal/Version index 632bc18a..2473f5b6 100644 --- a/sope-ical/NGiCal/Version +++ b/sope-ical/NGiCal/Version @@ -2,7 +2,7 @@ MAJOR_VERSION=4 MINOR_VERSION=5 -SUBMINOR_VERSION:=54 +SUBMINOR_VERSION:=56 # v4.5.40 requires NGExtensions v4.5.145 # v4.5.37 requires NGExtensions v4.5.140 -- 2.39.5