mirror of
https://github.com/inverse-inc/sogo.git
synced 2026-10-19 18:18:12 +00:00
See ChangeLog
Monotone-Parent: 93bde4643a2fb0ad0e86c36a29a73bc23ad39c64 Monotone-Revision: 04f443d215f2bc7c0d902f56f363c597ecffbcff Monotone-Author: ludovic@Sophos.ca Monotone-Date: 2011-02-23T23:06:55 Monotone-Branch: ca.inverse.sogo
This commit is contained in:
1 parent
3c3eb510a0
commit
f5378d5228
6 files changed
+146
-6
No files matched your search
@@ -1,3 +1,10 @@
|
|||||||
|
2011-02-23 Ludovic Marcotte <lmarcotte@inverse.ca>
|
||||||
|
|
||||||
|
* We now strip the bcc header in SOGoDraftObject instead
|
||||||
|
of doing it in SOPE. Prior to stripping the bcc header,
|
||||||
|
we keep a copy of the message for proper saving in the
|
||||||
|
Sent IMAP folder.
|
||||||
|
|
||||||
2011-02-23 Francis Lachapelle <flachapelle@inverse.ca>
|
2011-02-23 Francis Lachapelle <flachapelle@inverse.ca>
|
||||||
|
|
||||||
* SoObjects/Mailer/SOGoMailObject.m (-lookupInfoForBodyPart:): we
|
* SoObjects/Mailer/SOGoMailObject.m (-lookupInfoForBodyPart:): we
|
||||||
|
|||||||
@@ -22,6 +22,7 @@
|
|||||||
|
|
||||||
#import <Foundation/NSArray.h>
|
#import <Foundation/NSArray.h>
|
||||||
#import <Foundation/NSAutoreleasePool.h>
|
#import <Foundation/NSAutoreleasePool.h>
|
||||||
|
#import <Foundation/NSData.h>
|
||||||
#import <Foundation/NSDictionary.h>
|
#import <Foundation/NSDictionary.h>
|
||||||
#import <Foundation/NSKeyValueCoding.h>
|
#import <Foundation/NSKeyValueCoding.h>
|
||||||
#import <Foundation/NSProcessInfo.h>
|
#import <Foundation/NSProcessInfo.h>
|
||||||
@@ -85,6 +86,87 @@ static NSString *headerKeys[] = {@"subject", @"to", @"cc", @"bcc",
|
|||||||
|
|
||||||
@end
|
@end
|
||||||
|
|
||||||
|
//
|
||||||
|
// Useful extension that comes from Pantomime which is also
|
||||||
|
// released under the LGPL. We should eventually merge
|
||||||
|
// this with the same category found in SOPE's NGSmtpClient.m
|
||||||
|
// or simply drop sope-mime in favor of Pantomime
|
||||||
|
//
|
||||||
|
@interface NSMutableData (DataCleanupExtension)
|
||||||
|
|
||||||
|
- (NSRange) rangeOfCString: (const char *) theCString;
|
||||||
|
- (NSRange) rangeOfCString: (const char *) theCString
|
||||||
|
options: (unsigned int) theOptions
|
||||||
|
range: (NSRange) theRange;
|
||||||
|
@end
|
||||||
|
|
||||||
|
@implementation NSMutableData (DataCleanupExtension)
|
||||||
|
|
||||||
|
- (NSRange) rangeOfCString: (const char *) theCString
|
||||||
|
{
|
||||||
|
return [self rangeOfCString: theCString
|
||||||
|
options: 0
|
||||||
|
range: NSMakeRange(0,[self length])];
|
||||||
|
}
|
||||||
|
|
||||||
|
-(NSRange) rangeOfCString: (const char *) theCString
|
||||||
|
options: (unsigned int) theOptions
|
||||||
|
range: (NSRange) theRange
|
||||||
|
{
|
||||||
|
const char *b, *bytes;
|
||||||
|
int i, len, slen;
|
||||||
|
|
||||||
|
if (!theCString)
|
||||||
|
{
|
||||||
|
return NSMakeRange(NSNotFound,0);
|
||||||
|
}
|
||||||
|
|
||||||
|
bytes = [self bytes];
|
||||||
|
len = [self length];
|
||||||
|
slen = strlen(theCString);
|
||||||
|
|
||||||
|
b = bytes;
|
||||||
|
|
||||||
|
if (len > theRange.location + theRange.length)
|
||||||
|
{
|
||||||
|
len = theRange.location + theRange.length;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (theOptions == NSCaseInsensitiveSearch)
|
||||||
|
{
|
||||||
|
i = theRange.location;
|
||||||
|
b += i;
|
||||||
|
|
||||||
|
for (; i <= len-slen; i++, b++)
|
||||||
|
{
|
||||||
|
if (!strncasecmp(theCString,b,slen))
|
||||||
|
{
|
||||||
|
return NSMakeRange(i,slen);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
i = theRange.location;
|
||||||
|
b += i;
|
||||||
|
|
||||||
|
for (; i <= len-slen; i++, b++)
|
||||||
|
{
|
||||||
|
if (!memcmp(theCString,b,slen))
|
||||||
|
{
|
||||||
|
return NSMakeRange(i,slen);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return NSMakeRange(NSNotFound,0);
|
||||||
|
}
|
||||||
|
|
||||||
|
@end
|
||||||
|
|
||||||
|
//
|
||||||
|
//
|
||||||
|
//
|
||||||
@implementation SOGoDraftObject
|
@implementation SOGoDraftObject
|
||||||
|
|
||||||
static NGMimeType *MultiMixedType = nil;
|
static NGMimeType *MultiMixedType = nil;
|
||||||
@@ -1440,12 +1522,14 @@ static NSString *userAgent = nil;
|
|||||||
|
|
||||||
- (NSException *) sendMail
|
- (NSException *) sendMail
|
||||||
{
|
{
|
||||||
NSException *error;
|
NSMutableData *cleaned_message;
|
||||||
SOGoMailFolder *sentFolder;
|
SOGoMailFolder *sentFolder;
|
||||||
NSData *message;
|
|
||||||
NSURL *sourceIMAP4URL;
|
|
||||||
SOGoDomainDefaults *dd;
|
SOGoDomainDefaults *dd;
|
||||||
|
NSURL *sourceIMAP4URL;
|
||||||
|
NSException *error;
|
||||||
|
NSData *message;
|
||||||
|
NSRange r1, r2;
|
||||||
|
|
||||||
/* send mail */
|
/* send mail */
|
||||||
sentFolder = [[self mailAccountFolder] sentFolderInContext: context];
|
sentFolder = [[self mailAccountFolder] sentFolderInContext: context];
|
||||||
if ([sentFolder isKindOfClass: [NSException class]])
|
if ([sentFolder isKindOfClass: [NSException class]])
|
||||||
@@ -1457,11 +1541,34 @@ static NSString *userAgent = nil;
|
|||||||
|
|
||||||
generator = [[[NGMimeMessageGenerator alloc] init] autorelease];
|
generator = [[[NGMimeMessageGenerator alloc] init] autorelease];
|
||||||
message = [generator generateMimeFromPart: [self mimeMessageWithHeaders: nil
|
message = [generator generateMimeFromPart: [self mimeMessageWithHeaders: nil
|
||||||
excluding: [NSArray arrayWithObject: @"bcc"]]];
|
excluding: nil]];
|
||||||
|
|
||||||
|
//
|
||||||
|
// We now look for the Bcc: header. If it is present, we remove it.
|
||||||
|
// Some servers, like qmail, do not remove it automatically.
|
||||||
|
//
|
||||||
|
#warning FIXME - we should fix the case issue when we switch to Pantomime
|
||||||
|
cleaned_message = [NSMutableData dataWithData: message];
|
||||||
|
r1 = [cleaned_message rangeOfCString: "\r\n\r\n"];
|
||||||
|
r1 = [cleaned_message rangeOfCString: "\r\nbcc: "
|
||||||
|
options: 0
|
||||||
|
range: NSMakeRange(0,r1.location-1)];
|
||||||
|
|
||||||
|
if (r1.location != NSNotFound)
|
||||||
|
{
|
||||||
|
// We search for the first \r\n AFTER the Bcc: header and
|
||||||
|
// replace the whole thing with \r\n.
|
||||||
|
r2 = [cleaned_message rangeOfCString: "\r\n"
|
||||||
|
options: 0
|
||||||
|
range: NSMakeRange(NSMaxRange(r1)+1,[cleaned_message length]-NSMaxRange(r1)-1)];
|
||||||
|
[cleaned_message replaceBytesInRange: NSMakeRange(r1.location, NSMaxRange(r2)-r1.location)
|
||||||
|
withBytes: "\r\n"
|
||||||
|
length: 2];
|
||||||
|
}
|
||||||
|
|
||||||
dd = [[context activeUser] domainDefaults];
|
dd = [[context activeUser] domainDefaults];
|
||||||
error = [[SOGoMailer mailerWithDomainDefaults: dd]
|
error = [[SOGoMailer mailerWithDomainDefaults: dd]
|
||||||
sendMailData: message
|
sendMailData: cleaned_message
|
||||||
toRecipients: [self allBareRecipients]
|
toRecipients: [self allBareRecipients]
|
||||||
sender: [self sender]];
|
sender: [self sender]];
|
||||||
if (!error)
|
if (!error)
|
||||||
|
|||||||
@@ -72,6 +72,7 @@
|
|||||||
- (NSArray *) replyToEnvelopeAddresses;
|
- (NSArray *) replyToEnvelopeAddresses;
|
||||||
- (NSArray *) toEnvelopeAddresses;
|
- (NSArray *) toEnvelopeAddresses;
|
||||||
- (NSArray *) ccEnvelopeAddresses;
|
- (NSArray *) ccEnvelopeAddresses;
|
||||||
|
- (NSArray *) bccEnvelopeAddresses;
|
||||||
|
|
||||||
- (NSDictionary *) mailHeaders;
|
- (NSDictionary *) mailHeaders;
|
||||||
|
|
||||||
|
|||||||
@@ -289,6 +289,11 @@ static BOOL debugSoParts = NO;
|
|||||||
return [[self envelope] cc];
|
return [[self envelope] cc];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
- (NSArray *) bccEnvelopeAddresses
|
||||||
|
{
|
||||||
|
return [[self envelope] bcc];
|
||||||
|
}
|
||||||
|
|
||||||
- (NSArray *) replyToEnvelopeAddresses
|
- (NSArray *) replyToEnvelopeAddresses
|
||||||
{
|
{
|
||||||
return [[self envelope] replyTo];
|
return [[self envelope] replyTo];
|
||||||
|
|||||||
@@ -133,6 +133,11 @@ static NSString *mailETag = nil;
|
|||||||
return [[[self clientObject] ccEnvelopeAddresses] count] > 0 ? YES : NO;
|
return [[[self clientObject] ccEnvelopeAddresses] count] > 0 ? YES : NO;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
- (BOOL) hasBCC
|
||||||
|
{
|
||||||
|
return [[[self clientObject] bccEnvelopeAddresses] count] > 0 ? YES : NO;
|
||||||
|
}
|
||||||
|
|
||||||
- (BOOL) hasReplyTo
|
- (BOOL) hasReplyTo
|
||||||
{
|
{
|
||||||
return [[[self clientObject] replyToEnvelopeAddresses] count] > 0 ? YES : NO;
|
return [[[self clientObject] replyToEnvelopeAddresses] count] > 0 ? YES : NO;
|
||||||
|
|||||||
@@ -64,6 +64,21 @@
|
|||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
</var:if>
|
</var:if>
|
||||||
|
<var:if condition="hasBCC">
|
||||||
|
<tr class="mailer_fieldrow">
|
||||||
|
<td class="mailer_fieldname"><img rsrc:src="plus.png" class="collapse" style="display: none;" /><var:string label:value="Bcc"/>:</td>
|
||||||
|
<td class="mailer_fieldvalue">
|
||||||
|
<span class="collapse"><var:foreach list="clientObject.bccEnvelopeAddresses"
|
||||||
|
item="currentAddress">
|
||||||
|
<a var:href="currentAddressLink"
|
||||||
|
><var:string value="currentAddress"
|
||||||
|
formatter="context.mailEnvelopeFullAddressFormatter"
|
||||||
|
/></a>
|
||||||
|
<!-- TODO: better to use li+CSS -->
|
||||||
|
</var:foreach></span>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
</var:if>
|
||||||
<var:if condition="hasReplyTo">
|
<var:if condition="hasReplyTo">
|
||||||
<tr class="mailer_fieldrow">
|
<tr class="mailer_fieldrow">
|
||||||
<td class="mailer_fieldname"><var:string label:value="Reply-To"/>:</td>
|
<td class="mailer_fieldname"><var:string label:value="Reply-To"/>:</td>
|
||||||
|
|||||||
Reference in new issue
Block a user