From 36d8fa12d39a78c0538e9ac071be1b288a49051b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Juan=20Vall=C3=A9s?= Date: Thu, 10 Sep 2015 10:24:50 +0200 Subject: [PATCH 1/2] Improve first character check in CSS identifiers A CSS identifier can't start with a digit, so when a folder name does, a '_' character is appended at the beginning of its CSS identifier. The check for this first character used the `isdigit()` function, which takes a `char` argument, while `[self objectAtIndex: 0]` returns a `unichar`, i.e. a 16-bit unsigned integer. This caused some non-digit characters to pass this check (e.g. Chinese characters), ending up with an underscore at the beginning of the folder name. --- SoObjects/SOGo/NSString+Utilities.m | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/SoObjects/SOGo/NSString+Utilities.m b/SoObjects/SOGo/NSString+Utilities.m index d7d85e5f5..3895cd923 100644 --- a/SoObjects/SOGo/NSString+Utilities.m +++ b/SoObjects/SOGo/NSString+Utilities.m @@ -373,6 +373,7 @@ static int cssEscapingCount; - (NSString *) asCSSIdentifier { + NSCharacterSet *numericSet; NSMutableString *cssIdentifier; unichar currentChar; int count, max, idx; @@ -381,10 +382,12 @@ static int cssEscapingCount; [self _setupCSSEscaping]; cssIdentifier = [NSMutableString string]; + numericSet = [NSCharacterSet decimalDigitCharacterSet]; max = [self length]; + if (max > 0) { - if (isdigit([self characterAtIndex: 0])) + if ([numericSet characterIsMember: [self characterAtIndex: 0]]) // A CSS identifier can't start with a digit; we add an underscore [cssIdentifier appendString: @"_"]; for (count = 0; count < max; count++) @@ -415,6 +418,7 @@ static int cssEscapingCount; - (NSString *) fromCSSIdentifier { + NSCharacterSet *numericSet; NSMutableString *newString; NSString *currentString; int count, length, max, idx; @@ -423,12 +427,14 @@ static int cssEscapingCount; if (!cssEscapingStrings) [self _setupCSSEscaping]; + numericSet = [NSCharacterSet decimalDigitCharacterSet]; newString = [NSMutableString string]; max = [self length]; count = 0; + if (max > 0 && [self characterAtIndex: 0] == '_' - && isdigit([self characterAtIndex: 1])) + && [numericSet characterIsMember: [self characterAtIndex: 1]]) { /* If the identifier starts with an underscore followed by a digit, we remove the underscore */ From b075a306c6c67d6f75d8353d507abb9f1fee78fa Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Enrique=20J=2E=20Hern=C3=A1ndez=20Blasco?= Date: Thu, 10 Sep 2015 17:26:41 +0200 Subject: [PATCH 2/2] oc-task: Save tasks from Outlook It was not working because we try to save as component the full calendar and its parent was nil. We have to save the calendar itself to save the task in the personal calendar. --- OpenChange/MAPIStoreTasksMessage.m | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/OpenChange/MAPIStoreTasksMessage.m b/OpenChange/MAPIStoreTasksMessage.m index 20bf67f8b..12a348d4c 100644 --- a/OpenChange/MAPIStoreTasksMessage.m +++ b/OpenChange/MAPIStoreTasksMessage.m @@ -531,7 +531,7 @@ } [vToDo setTimeStampAsDate: now]; - [sogoObject saveComponent: vCalendar]; + [sogoObject saveCalendar: vCalendar]; [self updateVersions]; }