see changelog

Monotone-Parent: 9c4692dfa023d79c22b1957404af85eb87b98350
Monotone-Revision: 92ec8d2f76cb2878fe2ef2c11944485cc9b5127f

Monotone-Author: ludovic@Sophos.ca
Monotone-Date: 2007-11-16T21:15:38
Monotone-Branch: ca.inverse.sogo
maint-2.0.2
Ludovic Marcotte 2007-11-16 21:15:38 +00:00
parent 8616eac2c0
commit 6a42264855
8 changed files with 91 additions and 85 deletions

View File

@ -1,3 +1,31 @@
2007-11-16 Ludovic Marcotte <ludovic@inverse.ca>
* SoObjects/Mailer/SOGoMailBaseObject.m
Fixed typo.
* SoObjects/Mailer/SOGoMailBodyPart.m
We also grok image/jpeg and return the SOGoMailBodyPart
for attachments fetching.
* SoObjects/Mailer/SOGoMailObject+Draft.m
Prevent a crash in case body decoding failed during
a reply.
* SoObjects/Mailer/SOGoMailObject.m
Improved body decoding during a reply to also try
latin1 as an encoding.
* UI/MailPartViewers/UIxMailRenderingContext.m
Greatly improved the display mechanisms for emails.
Also properly consider the content disposition for
most content types.
* UI/MailerUI/UIxMailToSelection.m
Removed worthless code.
* UI/WebServerResources/MailerUI.css
CSS fix for table views.
2007-11-15 Ludovic Marcotte <ludovic@inverse.ca>
* UI/WebServerResources/MailerUI.js

View File

@ -207,7 +207,7 @@ static BOOL debugOn = YES;
- (BOOL)isBodyPartKey:(NSString *)_key inContext:(id)_ctx {
/*
Every key starting with a digit is consider an IMAP4 mime part key, used in
Every key starting with a digit is considered an IMAP4 mime part key, used in
SOGoMailObject and SOGoMailBodyPart.
*/
if ([_key length] == 0)

View File

@ -349,7 +349,8 @@ static BOOL debugOn = NO;
if ([mimeType isEqualToString: @"image/gif"]
|| [mimeType isEqualToString: @"image/png"]
|| [mimeType isEqualToString: @"image/jpg"])
|| [mimeType isEqualToString: @"image/jpg"]
|| [mimeType isEqualToString: @"image/jpeg"])
classString = @"SOGoImageMailBodyPart";
else if ([mimeType isEqualToString: @"text/calendar"])
classString = @"SOGoCalendarMailBodyPart";
@ -366,7 +367,7 @@ static BOOL debugOn = NO;
if (classString)
klazz = NSClassFromString (classString);
else
klazz = Nil;
klazz = [SOGoMailBodyPart class];
return klazz;
}

View File

@ -80,6 +80,8 @@
int index;
BOOL htmlContent;
content = @"";
if ([keys count])
{
types = [keys objectsForKey: @"mimeType"];
@ -91,23 +93,23 @@
}
else
htmlContent = NO;
if (index == NSNotFound)
content = @"";
else
if (index != NSNotFound)
{
contentKey = [keys objectAtIndex: index];
parts = [self fetchPlainTextStrings:
[NSArray arrayWithObject: contentKey]];
rawPart = [[parts allValues] objectAtIndex: 0];
if (htmlContent)
content = [rawPart htmlToText];
else
content = rawPart;
if ([parts count] > 0)
{
rawPart = [[parts allValues] objectAtIndex: 0];
if (htmlContent)
content = [rawPart htmlToText];
else
content = rawPart;
}
}
}
else
content = @"";
return content;
}

View File

@ -656,8 +656,13 @@ static BOOL debugSoParts = NO;
[s autorelease];
}
else
s = [NSString stringWithData: mailData
usingEncodingNamed: charset];
{
s = [NSString stringWithData: mailData usingEncodingNamed: charset];
// If it has failed, we try at least using UTF-8. Normally, this can NOT fail
if (!s)
s = [[[NSString alloc] initWithData: mailData encoding: NSISOLatin1StringEncoding] autorelease];
}
}
else
s = nil;

View File

@ -29,6 +29,25 @@
#import "UIxMailRenderingContext.h"
@interface UIxMailRenderingContext (Private)
- (BOOL) _shouldDisplayAsAttachment: (NSDictionary *) info;
@end
@implementation UIxMailRenderingContext (Private)
- (BOOL) _shouldDisplayAsAttachment: (NSDictionary *) info
{
NSString *s;
s = [[info objectForKey:@"disposition"] objectForKey: @"type"];
return (s && [s caseInsensitiveCompare: @"ATTACHMENT"] == NSOrderedSame);
}
@end
@implementation UIxMailRenderingContext
static BOOL showNamedTextAttachmentsInline = NO;
@ -235,13 +254,12 @@ static BOOL showNamedTextAttachmentsInline = NO;
if ([mt isEqualToString:@"multipart"])
{
if ([st isEqualToString:@"mixed"])
if ([st isEqualToString:@"mixed"] || [st isEqualToString:@"related"])
return [self mixedViewer];
else if ([st isEqualToString:@"signed"])
return [self signedViewer];
else if ([st isEqualToString:@"alternative"]
|| [st isEqualToString:@"related"])
return [self alternativeViewer];
else if ([st isEqualToString:@"alternative"])
return [self alternativeViewer];
if ([st isEqualToString:@"report"])
/* this is used by mail-delivery reports */
@ -249,19 +267,9 @@ static BOOL showNamedTextAttachmentsInline = NO;
}
else if ([mt isEqualToString:@"text"])
{
/*
Note: in the _info dictionary we do not get the content-disposition
information (inline vs attachment). Our hack is to check for the
'name' parameter.
*/
if ([st isEqualToString:@"plain"] || [st isEqualToString:@"html"]) {
if (!showNamedTextAttachmentsInline) {
NSString *n;
n = [[_info objectForKey:@"parameterList"] objectForKey:@"name"];
if ([n isNotNull] && [n length] > 0)
return [self linkViewer];
}
if (!showNamedTextAttachmentsInline && [self _shouldDisplayAsAttachment: _info])
return [self linkViewer];
return [st isEqualToString:@"html"]
? [self htmlViewer] : [self textViewer];
@ -269,10 +277,15 @@ static BOOL showNamedTextAttachmentsInline = NO;
if ([st isEqualToString:@"calendar"])
return [self iCalViewer];
}
}
if ([mt isEqualToString:@"image"])
return [self imageViewer];
{
if ([self _shouldDisplayAsAttachment: _info])
return [self linkViewer];
return [self imageViewer];
}
if ([mt isEqualToString:@"message"] && [st isEqualToString:@"rfc822"])
return [self messageViewer];

View File

@ -64,8 +64,6 @@
- (void) setBcc: (NSArray *) _bcc;
- (NSArray *) bcc;
- (NSArray *) properlySplitAddresses: (NSArray *) _addresses;
- (void) getAddressesFromFormValues: (NSDictionary *) _dict;
- (NSString *) getIndexFromIdentifier: (NSString *) _identifier;
@ -108,7 +106,7 @@ static NSArray *headers = nil;
- (void) setTo: (NSArray *) _to
{
ASSIGN (to, [self properlySplitAddresses: _to]);
ASSIGN (to, _to);
}
- (NSArray *) to
@ -127,7 +125,7 @@ static NSArray *headers = nil;
- (void) setCc: (NSArray *) _cc
{
ASSIGN (cc, [self properlySplitAddresses: _cc]);
ASSIGN (cc, _cc);
}
- (NSArray *) cc
@ -137,7 +135,7 @@ static NSArray *headers = nil;
- (void) setBcc: (NSArray *) _bcc
{
ASSIGN (bcc, [self properlySplitAddresses: _bcc]);
ASSIGN (bcc, _bcc);
}
- (NSArray *) bcc
@ -237,52 +235,6 @@ static NSArray *headers = nil;
return @"";
}
/* address handling */
- (NSArray *) properlySplitAddresses: (NSArray *) _addresses
{
NSString *addrs;
NGMailAddressParser *parser;
NSArray *result;
NSMutableArray *ma;
unsigned i, count;
if (!_addresses || [_addresses count] == 0)
return nil;
/* create one huge string, then split it using the parser */
addrs = [_addresses componentsJoinedByString:@","];
parser = [NGMailAddressParser mailAddressParserWithString:addrs];
result = [parser parseAddressList];
if(result == nil) {
[self debugWithFormat:@"Couldn't parse given addresses:%@", _addresses];
return _addresses;
}
count = [result count];
ma = [NSMutableArray arrayWithCapacity:count];
for (i = 0; i < count; i++) {
NGMailAddress *addr;
NSMutableString *s;
BOOL hasName = NO;
s = [[NSMutableString alloc] init];
addr = [result objectAtIndex:i];
if([addr displayName]) {
[s appendString:[addr displayName]];
[s appendString:@" "];
hasName = YES;
}
if(hasName)
[s appendString:@"<"];
[s appendString:[addr address]];
if(hasName)
[s appendString:@">"];
[ma addObject:s];
}
return ma;
}
/* handling requests */
- (void) _fillAddresses: (NSMutableArray *) addresses

View File

@ -379,6 +379,11 @@ DIV.mailer_mailcontent
bottom: 0px;
overflow: auto; }
DIV.mailer_mailcontent TABLE
{
table-layout: auto;
}
TD.mailer_fieldname
{
white-space: nowrap;