Removing some trail characters at event description

* They are sometimes present after a \r\n\n
pull/49/head
Miguel Julián 2014-06-12 15:46:02 +02:00 committed by Julio García
parent 2458af1a43
commit 5d43513dd9
1 changed files with 24 additions and 0 deletions

View File

@ -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];
}