From 2c9a61f0c50cac8f6ca929ec0b21a04c6d8f3061 Mon Sep 17 00:00:00 2001 From: Francis Lachapelle Date: Fri, 1 Jun 2012 14:29:30 +0000 Subject: [PATCH] See ChangeLog Monotone-Parent: 6a6bbe9da76e6e30fd9ce63cf4a8c7677f5f61a0 Monotone-Revision: f542ae0ee839e825fc2f1dae6c5d916237edb3e4 Monotone-Author: flachapelle@inverse.ca Monotone-Date: 2012-06-01T14:29:30 --- ChangeLog | 8 ++++++++ SoObjects/SOGo/NSString+Utilities.m | 16 ++++++++-------- 2 files changed, 16 insertions(+), 8 deletions(-) diff --git a/ChangeLog b/ChangeLog index e1dc42a6c..b4e96d8bf 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,11 @@ +2012-06-01 Francis Lachapelle + + * SoObjects/SOGo/NSString+Utilities.m + (-_handleURLs:textToMatch:prefix:inRanges:): don't reset the + prefix for the subsequent matching strings. This fixes links in + messages with multiple email addresses, some of which already + prefixed by "mailto;". + 2012-06-01 Wolfgang Sourdeau * SoObjects/SOGo/NSString+Crypto.m diff --git a/SoObjects/SOGo/NSString+Utilities.m b/SoObjects/SOGo/NSString+Utilities.m index 1feb8537d..ec04b9795 100644 --- a/SoObjects/SOGo/NSString+Utilities.m +++ b/SoObjects/SOGo/NSString+Utilities.m @@ -215,13 +215,13 @@ static int cssEscapingCount; { rangePtr->location += offset; urlText = [selfCopy substringFromRange: *rangePtr]; - if ([urlText hasPrefix: prefix]) prefix = @""; newUrlText = [NSString stringWithFormat: @"%@", - prefix, urlText, urlText]; + ([urlText hasPrefix: prefix]? @"" : prefix), + urlText, urlText]; [selfCopy replaceCharactersInRange: *rangePtr - withString: newUrlText]; + withString: newUrlText]; offset += ([newUrlText length] - [urlText length]); - + // Add range for further substitutions currentUrlRange = NSMakeRange (rangePtr->location, [newUrlText length]); [ranges addNonNSObject: ¤tUrlRange @@ -240,12 +240,12 @@ static int cssEscapingCount; selfCopy = [NSMutableString stringWithString: self]; [self _handleURLs: selfCopy textToMatch: @"://" - prefix: @"" - inRanges: ranges]; + prefix: @"" + inRanges: ranges]; [self _handleURLs: selfCopy textToMatch: @"@" - prefix: @"mailto:" - inRanges: ranges]; + prefix: @"mailto:" + inRanges: ranges]; [ranges freeNonNSObjects]; return selfCopy;