See ChangeLog

Monotone-Parent: c052846d400add7f419d4d1ffe4c900df5f4302a
Monotone-Revision: f0940e9496d2f6b614f37aed2fd66c564c0df278

Monotone-Author: ludovic@Sophos.ca
Monotone-Date: 2008-09-30T19:34:31
Monotone-Branch: ca.inverse.sogo
This commit is contained in:
Ludovic Marcotte
2008-09-30 19:34:31 +00:00
parent 3b9ee48394
commit 53b31d9cce
10 changed files with 122 additions and 10 deletions

View File

@@ -103,6 +103,8 @@ _xmlCharsetForCharset (NSString *charset)
BOOL inScript;
BOOL inCSSDeclaration;
BOOL hasEmbeddedCSS;
BOOL hasExternalImages;
BOOL unsafe;
NSMutableArray *crumb;
xmlCharEncoding contentEncoding;
}
@@ -135,6 +137,16 @@ _xmlCharsetForCharset (NSString *charset)
[super dealloc];
}
- (BOOL) hasExternalImages
{
return hasExternalImages;
}
- (BOOL) setUnsafe: (BOOL) b
{
unsafe = b;
}
- (void) setContentEncoding: (xmlCharEncoding) newContentEncoding
{
contentEncoding = newContentEncoding;
@@ -292,8 +304,14 @@ _xmlCharsetForCharset (NSString *charset)
value = [attachmentIds objectForKey: cid];
skipAttribute = (value == nil);
}
else
skipAttribute = YES;
else if ([_rawName caseInsensitiveCompare: @"img"] == NSOrderedSame)
{
hasExternalImages = YES;
if (!unsafe) skipAttribute = YES;
}
else
skipAttribute = YES;
}
else if ([name caseInsensitiveCompare: @"href"] == NSOrderedSame
|| [name caseInsensitiveCompare: @"action"] == NSOrderedSame)
@@ -520,10 +538,17 @@ _xmlCharsetForCharset (NSString *charset)
handler = [_UIxHTMLMailContentHandler new];
[handler setAttachmentIds: [mail fetchAttachmentIds]];
[handler setContentEncoding: [self _xmlCharEncoding]];
[handler setUnsafe: unsafe];
[parser setContentHandler: handler];
[parser parseFromSource: preparsedContent];
}
- (BOOL) hasExternalImages
{
return [handler hasExternalImages];
}
- (NSString *) cssContent
{
NSString *cssContent, *css;
@@ -550,6 +575,23 @@ _xmlCharsetForCharset (NSString *charset)
return [handler result];
}
- (void) setUnsafe: (BOOL) b
{
unsafe = b;
}
- (BOOL) displayLoadImages
{
BOOL b;
b = [handler hasExternalImages];
if (b && unsafe)
return NO;
return b;
}
@end
@implementation UIxMailPartExternalHTMLViewer