diff --git a/OpenChange/MAPIStoreAppointmentWrapper.m b/OpenChange/MAPIStoreAppointmentWrapper.m index 5445f989c..c07998c5e 100644 --- a/OpenChange/MAPIStoreAppointmentWrapper.m +++ b/OpenChange/MAPIStoreAppointmentWrapper.m @@ -1214,11 +1214,27 @@ static NSCharacterSet *hexCharacterSet = nil; return MAPISTORE_SUCCESS; } +/* +private static function parseDescriptionOc2Rc($description) +{ + $description = ltrim($description, ')'); + + if (strpos($description, "\r\n\n") !== false) { + $exploded = explode("\r\n\n", $description, -1); + $description = join($exploded, "\n"); + } + + return $description; +} +*/ + - (int) getPidTagBody: (void **) data inMemCtx: (TALLOC_CTX *) memCtx { int rc; + NSRange range; NSString *stringValue; + NSString *trimingString = @"\r\n\n"; /* FIXME: there is a confusion in NGCards around "comment" and "description" */ stringValue = [event comment]; @@ -1226,6 +1242,14 @@ static NSCharacterSet *hexCharacterSet = nil; && ![stringValue isEqualToString: @"\r\n"] && ![stringValue isEqualToString: @"\n"]) { + /* Avoiding those trail weird characters at event description */ + range = [stringValue rangeOfString: trimingString + options: NSBackwardsSearch]; + if (range.location > 0) + { + stringValue = [stringValue substringToIndex: (NSMaxRange(range) -1)]; + } + rc = MAPISTORE_SUCCESS; *data = [stringValue asUnicodeInMemCtx: memCtx]; }