mirror of
https://github.com/inverse-inc/sogo.git
synced 2026-05-20 02:45:25 +00:00
Monotone-Parent: f4db30ef74d0df8b212b89bceeb05e6dd3c57874
Monotone-Revision: c4ca1fc9171a84aed3074955c7d96c02bf3ae9ad Monotone-Author: wsourdeau@inverse.ca Monotone-Date: 2007-12-06T16:27:28 Monotone-Branch: ca.inverse.sogo
This commit is contained in:
@@ -1,5 +1,10 @@
|
||||
2007-12-06 Wolfgang Sourdeau <wsourdeau@inverse.ca>
|
||||
|
||||
* UI/MailerUI/UIxMailEditor.m ([UIxMailEditor -saveAction])
|
||||
([UIxMailEditor -sendAction]): make sure that the attachments
|
||||
having the same filename are correctly sequenced (ex: base.ext,
|
||||
base-1.ext, base-2.ext).
|
||||
|
||||
* SoObjects/Mailer/SOGoMailBodyPart.m ([SOGoMailBodyPart
|
||||
-fetchBLOB]): added support for quoted-printable decoding. Also,
|
||||
we return nil if the type is not supported.
|
||||
|
||||
@@ -67,6 +67,7 @@
|
||||
/* these are for the inline attachment list */
|
||||
NSString *attachmentName;
|
||||
NSArray *attachmentNames;
|
||||
NSMutableArray *attachedFiles;
|
||||
}
|
||||
|
||||
@end
|
||||
@@ -115,6 +116,7 @@ static NSArray *infoKeys = nil;
|
||||
[bcc release];
|
||||
[attachmentName release];
|
||||
[attachmentNames release];
|
||||
[attachedFiles release];
|
||||
[super dealloc];
|
||||
}
|
||||
|
||||
@@ -262,6 +264,29 @@ static NSArray *infoKeys = nil;
|
||||
}
|
||||
|
||||
/* actions */
|
||||
- (NSString *) _fixedFilename: (NSString *) filename
|
||||
{
|
||||
NSString *newFilename, *baseFilename, *extension;
|
||||
unsigned int variation;
|
||||
|
||||
if (!attachedFiles)
|
||||
attachedFiles = [NSMutableArray new];
|
||||
|
||||
newFilename = filename;
|
||||
|
||||
baseFilename = [filename stringByDeletingPathExtension];
|
||||
extension = [filename pathExtension];
|
||||
variation = 0;
|
||||
while ([attachedFiles containsObject: newFilename])
|
||||
{
|
||||
variation++;
|
||||
newFilename = [NSString stringWithFormat: @"%@-%d.%@", baseFilename,
|
||||
variation, extension];
|
||||
}
|
||||
[attachedFiles addObject: newFilename];
|
||||
|
||||
return newFilename;
|
||||
}
|
||||
|
||||
- (NSDictionary *) _scanAttachmentFilenamesInRequest: (id) httpBody
|
||||
{
|
||||
@@ -271,7 +296,7 @@ static NSArray *infoKeys = nil;
|
||||
unsigned int count, max;
|
||||
NGMimeBodyPart *part;
|
||||
NGMimeContentDispositionHeaderField *header;
|
||||
NSString *mimeType;
|
||||
NSString *mimeType, *filename;
|
||||
|
||||
parts = [httpBody parts];
|
||||
max = [parts count];
|
||||
@@ -284,8 +309,9 @@ static NSArray *infoKeys = nil;
|
||||
[part headerForKey: @"content-disposition"];
|
||||
mimeType = [(NGMimeType *)
|
||||
[part headerForKey: @"content-type"] stringValue];
|
||||
filename = [self _fixedFilename: [header filename]];
|
||||
attachment = [NSDictionary dictionaryWithObjectsAndKeys:
|
||||
[header filename], @"filename",
|
||||
filename, @"filename",
|
||||
mimeType, @"mimetype", nil];
|
||||
[filenames setObject: attachment forKey: [header name]];
|
||||
}
|
||||
@@ -370,12 +396,12 @@ static NSArray *infoKeys = nil;
|
||||
{
|
||||
NSArray *a;
|
||||
|
||||
if (attachmentNames != nil)
|
||||
return attachmentNames;
|
||||
|
||||
a = [[self clientObject] fetchAttachmentNames];
|
||||
a = [a sortedArrayUsingSelector: @selector (compare:)];
|
||||
attachmentNames = [a copy];
|
||||
if (attachmentNames)
|
||||
{
|
||||
a = [[self clientObject] fetchAttachmentNames];
|
||||
a = [a sortedArrayUsingSelector: @selector (compare:)];
|
||||
attachmentNames = [a copy];
|
||||
}
|
||||
|
||||
return attachmentNames;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user