Monotone-Parent: 138d10664c297f2945644209ec2c4b488844af1b

Monotone-Revision: 680b3d6bcb1de20bb28768ebf727ed9053b9e2a0

Monotone-Author: wsourdeau@inverse.ca
Monotone-Date: 2007-12-13T00:00:55
Monotone-Branch: ca.inverse.sogo
This commit is contained in:
Wolfgang Sourdeau
2007-12-13 00:00:55 +00:00
parent 8f200c6d36
commit d66be7a764
2 changed files with 24 additions and 2 deletions
+4
View File
@@ -1,5 +1,9 @@
2007-12-12 Wolfgang Sourdeau <wsourdeau@inverse.ca>
* SoObjects/SOGo/NSString+Utilities.m ([NSString
-stringByDetectingURLs]): we now go back until the real start of
the found url.
* SoObjects/Mailer/SOGoMailObject.m ([SOGoMailObject
-fetchAttachmentIds]): new method that wanders through the mail
structure to collect the attachment content ids and to associate
+20 -2
View File
@@ -33,6 +33,7 @@
static NSMutableCharacterSet *urlNonEndingChars = nil;
static NSMutableCharacterSet *urlAfterEndingChars = nil;
static NSMutableCharacterSet *urlStartChars = nil;
@implementation NSString (SOGoURLExtension)
@@ -150,12 +151,12 @@ static NSMutableCharacterSet *urlAfterEndingChars = nil;
if (!urlNonEndingChars)
{
urlNonEndingChars = [NSMutableCharacterSet new];
[urlNonEndingChars addCharactersInString: @">=,.:;\t \r\n"];
[urlNonEndingChars addCharactersInString: @"=,.:;\t \r\n"];
}
if (!urlAfterEndingChars)
{
urlAfterEndingChars = [NSMutableCharacterSet new];
[urlAfterEndingChars addCharactersInString: @"[]\t \r\n"];
[urlAfterEndingChars addCharactersInString: @"&;[]\t \r\n"];
}
start = refRange.location;
@@ -187,9 +188,26 @@ static NSMutableCharacterSet *urlAfterEndingChars = nil;
NSRange httpRange, currentURL, rest;
NSString *urlText, *newUrlText;
unsigned int length, matchLength;
int startLocation;
if (!urlStartChars)
{
urlStartChars = [NSMutableCharacterSet new];
[urlStartChars addCharactersInString: @"abcdefghijklmnopqrstuvwxyz"
@"ABCDEFGHIJKLMNOPQRSTUVWXYZ"
@"0123456789:@"];
}
matchLength = [match length];
httpRange = [selfCopy rangeOfString: match];
if (httpRange.location != NSNotFound)
{
startLocation = httpRange.location;
while (startLocation > -1
&& [urlStartChars characterIsMember:
[selfCopy characterAtIndex: startLocation]])
startLocation--;
httpRange.location = startLocation + 1;
}
while (httpRange.location != NSNotFound)
{
if ([ranges hasRangeIntersection: httpRange])