Monotone-Parent: 231d9f088984bb0dc975e90ac754e3c646546493

Monotone-Revision: 2d4a926cb463fbf80ac0aa402d2ed4efa912738c

Monotone-Author: wsourdeau@inverse.ca
Monotone-Date: 2007-11-12T17:08:12
Monotone-Branch: ca.inverse.sogo
This commit is contained in:
Wolfgang Sourdeau
2007-11-12 17:08:12 +00:00
parent 1febf78555
commit 7066fcc2ff
3 changed files with 79 additions and 19 deletions

View File

@@ -1,5 +1,10 @@
2007-11-12 Wolfgang Sourdeau <wsourdeau@inverse.ca>
* SoObjects/Mailer/SOGoDraftObject.m ([SOGoDraftObject
-fetchMailForReplying:sourceMailtoAll:toAll]): remove the current
user from the list of recipients and make sure no other address is
counted twice.
* UI/MailPartViewers/UIxMailPartTextViewer.m ([NSString
-stringByConvertingCRLNToHTML]): build the returned NSString
without the ending \0.

View File

@@ -384,11 +384,47 @@ static BOOL showTextAttachmentsInline = NO;
- (void) _addEMailsOfAddresses: (NSArray *) _addrs
toArray: (NSMutableArray *) _ma
{
unsigned i, count;
NSEnumerator *addresses;
NGImap4EnvelopeAddress *currentAddress;
for (i = 0, count = [_addrs count]; i < count; i++)
[_ma addObject:
[(NGImap4EnvelopeAddress *) [_addrs objectAtIndex: i] email]];
addresses = [_addrs objectEnumerator];
while ((currentAddress = [addresses nextObject]))
[_ma addObject: [currentAddress email]];
}
- (void) _addRecipients: (NSArray *) recipients
toArray: (NSMutableArray *) array
{
NSEnumerator *addresses;
NGImap4EnvelopeAddress *currentAddress;
addresses = [recipients objectEnumerator];
while ((currentAddress = [addresses nextObject]))
[array addObject: [currentAddress baseEMail]];
}
- (void) _purgeRecipients: (NSArray *) recipients
fromAddresses: (NSMutableArray *) addresses
{
NSEnumerator *allRecipients;
NSString *currentRecipient;
NGImap4EnvelopeAddress *currentAddress;
int count, max;
max = [addresses count];
allRecipients = [recipients objectEnumerator];
while (max > 0
&& ((currentRecipient = [allRecipients nextObject])))
for (count = max - 1; count >= 0; count--)
{
currentAddress = [addresses objectAtIndex: count];
if ([currentRecipient isEqualToString: [currentAddress baseEMail]])
{
[addresses removeObjectAtIndex: count];
max--;
}
}
}
- (void) _fillInReplyAddresses: (NSMutableDictionary *) _info
@@ -407,32 +443,51 @@ static BOOL showTextAttachmentsInline = NO;
TODO: what about sender (RFC 822 3.6.2)
*/
NSMutableArray *to;
NSArray *addrs;
to = [NSMutableArray arrayWithCapacity:2];
NSMutableArray *to, *addrs, *allRecipients;
NSArray *envelopeAddresses, *userEmails;
/* first check for "reply-to" */
addrs = [_envelope replyTo];
if ([addrs count] == 0)
/* no "reply-to", try "from" */
addrs = [_envelope from];
allRecipients = [NSMutableArray new];
userEmails = [[context activeUser] allEmails];
[allRecipients addObjectsFromArray: userEmails];
to = [NSMutableArray arrayWithCapacity: 2];
addrs = [NSMutableArray new];
envelopeAddresses = [_envelope replyTo];
if ([envelopeAddresses count])
[addrs setArray: envelopeAddresses];
else
[addrs setArray: [_envelope from]];
[self _purgeRecipients: allRecipients
fromAddresses: addrs];
[self _addEMailsOfAddresses: addrs toArray: to];
[self _addRecipients: addrs toArray: allRecipients];
[_info setObject: to forKey: @"to"];
/* CC processing if we reply-to-all: add all 'to' and 'cc' */
if (_replyToAll)
{
to = [NSMutableArray arrayWithCapacity:8];
to = [NSMutableArray new];
[self _addEMailsOfAddresses: [_envelope to] toArray: to];
[self _addEMailsOfAddresses: [_envelope cc] toArray: to];
[addrs setArray: [_envelope to]];
[self _purgeRecipients: allRecipients
fromAddresses: addrs];
[self _addEMailsOfAddresses: addrs toArray: to];
[self _addRecipients: addrs toArray: allRecipients];
[addrs setArray: [_envelope cc]];
[self _purgeRecipients: allRecipients
fromAddresses: addrs];
[self _addEMailsOfAddresses: addrs toArray: to];
[_info setObject: to forKey: @"cc"];
[to release];
}
[allRecipients release];
}
- (NSArray *) _attachmentBodiesFromPaths: (NSArray *) paths

View File

@@ -80,7 +80,7 @@ extern NSString *SOGoWeekStartFirstFullWeek;
// - (NSString *) primaryEmail;
// - (NSString *) systemEmail;
// - (NSArray *) allEmails;
- (NSArray *) allEmails;
- (BOOL) hasEmail: (NSString *) email;