From 4cadeeffcbdbb25c983a947993d687bcacb3630b Mon Sep 17 00:00:00 2001 From: Wolfgang Sourdeau Date: Mon, 20 Aug 2007 17:46:15 +0000 Subject: [PATCH] Monotone-Parent: 89b6d7fe4690e5301ab1c018adbeaff455cad96c Monotone-Revision: 9cc2d071b7d1404160adc61a8920fe180e03e6dd Monotone-Author: wsourdeau@inverse.ca Monotone-Date: 2007-08-20T17:46:15 Monotone-Branch: ca.inverse.sogo --- UI/MailPartViewers/UIxMailPartHTMLViewer.m | 31 +++++++++++++++------- 1 file changed, 21 insertions(+), 10 deletions(-) diff --git a/UI/MailPartViewers/UIxMailPartHTMLViewer.m b/UI/MailPartViewers/UIxMailPartHTMLViewer.m index 4226e6400..2ea840ebf 100644 --- a/UI/MailPartViewers/UIxMailPartHTMLViewer.m +++ b/UI/MailPartViewers/UIxMailPartHTMLViewer.m @@ -32,7 +32,11 @@ #import "UIxMailPartHTMLViewer.h" +#if 0 #define showWhoWeAre() NSLog(@"invoked '%@'", NSStringFromSelector(_cmd)) +#else +#define showWhoWeAre() +#endif @interface _UIxHTMLMailContentHandler : NSObject { @@ -95,6 +99,8 @@ /* SaxContentHandler */ - (void) startDocument { + showWhoWeAre(); + if (crumb) [crumb release]; if (result) @@ -116,6 +122,8 @@ { unsigned int count, max; + + showWhoWeAre(); max = [crumb count]; if (max > 0) for (count = max - 1; count > -1; count--) @@ -191,6 +199,7 @@ NSMutableString *resultPart; BOOL skipAttribute; + showWhoWeAre(); if (inStyle || inScript) ; else if ([_localName caseInsensitiveCompare: @"body"] == NSOrderedSame) @@ -240,6 +249,8 @@ namespace: (NSString *) _ns rawName: (NSString *) _rawName { + showWhoWeAre(); + if (inStyle) { if ([_localName caseInsensitiveCompare: @"style"] == NSOrderedSame) @@ -264,6 +275,7 @@ { NSString *tmpString; + showWhoWeAre(); if (!inScript) { if (inStyle) @@ -302,6 +314,7 @@ - (void) comment: (unichar *) _chars length: (int) _len { + showWhoWeAre(); if (inStyle) [self _appendStyle: _chars length: _len]; } @@ -383,7 +396,6 @@ bodyId = [part objectForKey: @"bodyId"]; if ([bodyId length] > 0) { - NSLog(@"%@", part); if ([bodyId hasPrefix: @"<"]) bodyId = [bodyId substringFromIndex: 1]; if ([bodyId hasSuffix: @">"]) @@ -431,26 +443,25 @@ { id parser; _UIxHTMLMailContentHandler *handler; - NSString *preparsedContent, *content, *css; + NSString *css; + NSMutableString *content; + NSData *preparsedContent; - preparsedContent = [super flatContentAsString]; + content = [NSMutableString string]; + + preparsedContent = [super decodedFlatContent]; parser = [[SaxXMLReaderFactory standardXMLReaderFactory] createXMLReaderForMimeType: @"text/html"]; handler = [_UIxHTMLMailContentHandler new]; [handler setAttachmentIds: [self _attachmentIds]]; [parser setContentHandler: handler]; - [parser setProperty: @"http://xml.org/sax/properties/lexical-handler" - to: handler]; [parser parseFromSource: preparsedContent]; css = [handler css]; if ([css length]) - content - = [NSString stringWithFormat: @"%@", - css, [handler result]]; - else - content = [handler result]; + [content appendFormat: @"", css]; + [content appendString: [handler result]]; [handler release]; return content;