From 4b9e8f14861971b44b7af16228d7022197b073dd Mon Sep 17 00:00:00 2001 From: Ludovic Marcotte Date: Thu, 13 Nov 2008 16:03:41 +0000 Subject: [PATCH] See ChangeLog Monotone-Parent: f84e4aaa7eb033904461e3ce48ce2ff0919a7a30 Monotone-Revision: 81c4e4d41c6464180cf83e11f19c2148e6351324 Monotone-Author: ludovic@Sophos.ca Monotone-Date: 2008-11-13T16:03:41 Monotone-Branch: ca.inverse.sogo --- ChangeLog | 5 +++++ SOPE/NGCards/CardVersitRenderer.m | 25 +++++++++++++++++++++--- SoObjects/Appointments/iCalPerson+SOGo.m | 2 +- 3 files changed, 28 insertions(+), 4 deletions(-) diff --git a/ChangeLog b/ChangeLog index 60ca418f7..9a59d9c76 100644 --- a/ChangeLog +++ b/ChangeLog @@ -7,6 +7,11 @@ * SoObjects/SOGo/SOGoUserFolder.m Improve the comparison of strings by rather using URL objects. + * SOPE/NGCards/CardVersitRenderer.m + We now properly quote attribute values if they + contain an ':' in them + * SoObjects/Appointments/iCalPerson+SOGo.m + Fixed the check for quoted SENT-BY 2008-11-11 Ludovic Marcotte diff --git a/SOPE/NGCards/CardVersitRenderer.m b/SOPE/NGCards/CardVersitRenderer.m index 049ae78b5..6714ce09f 100644 --- a/SOPE/NGCards/CardVersitRenderer.m +++ b/SOPE/NGCards/CardVersitRenderer.m @@ -78,10 +78,29 @@ key = [keys nextObject]; while (key) { + NSString *s; + int i, c; + renderedAttrs = [[attributes objectForKey: key] renderedForCards]; - [rendering appendFormat: @";%@=%@", - [key uppercaseString], - [renderedAttrs componentsJoinedByString: @","]]; + [rendering appendFormat: @";%@=", [key uppercaseString]]; + c = [renderedAttrs count]; + + 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: @","]; + } + key = [keys nextObject]; } diff --git a/SoObjects/Appointments/iCalPerson+SOGo.m b/SoObjects/Appointments/iCalPerson+SOGo.m index 224802de8..ff6a79bcd 100644 --- a/SoObjects/Appointments/iCalPerson+SOGo.m +++ b/SoObjects/Appointments/iCalPerson+SOGo.m @@ -67,7 +67,7 @@ static LDAPUserManager *um = nil; if ([mail length] > 7) { - if ([mail characterAtIndex: 0] && [mail hasSuffix: @"\""]) + if ([mail characterAtIndex: 0] == '"' && [mail hasSuffix: @"\""]) mail = [mail substringWithRange: NSMakeRange(1, [mail length]-2)]; return [mail substringFromIndex: 7];