mirror of
https://github.com/inverse-inc/sogo.git
synced 2026-05-07 12:35:27 +00:00
Fix for bug #2482
This commit is contained in:
@@ -619,11 +619,40 @@ static NSString *userAgent = nil;
|
||||
TODO: what about sender (RFC 822 3.6.2)
|
||||
*/
|
||||
NSMutableArray *to, *addrs, *allRecipients;
|
||||
NSArray *envelopeAddresses, *userEmails;
|
||||
NSArray *envelopeAddresses;
|
||||
|
||||
allRecipients = [NSMutableArray array];
|
||||
userEmails = [[context activeUser] allEmails];
|
||||
[allRecipients addObjectsFromArray: userEmails];
|
||||
|
||||
//
|
||||
// When we do a Reply-To or a Reply-To-All, we strip our own addresses
|
||||
// from the list of recipients so we don't reply to ourself! We check
|
||||
// which addresses we should use - that is the ones for the current
|
||||
// user if we're dealing with the default "SOGo mail account" or
|
||||
// the ones specified in the auxiliary IMAP accounts
|
||||
//
|
||||
if ([[[self->container mailAccountFolder] nameInContainer] intValue] == 0)
|
||||
{
|
||||
NSArray *userEmails;
|
||||
|
||||
userEmails = [[context activeUser] allEmails];
|
||||
[allRecipients addObjectsFromArray: userEmails];
|
||||
}
|
||||
else
|
||||
{
|
||||
NSArray *identities;
|
||||
NSString *email;
|
||||
int i;
|
||||
|
||||
identities = [[[self container] mailAccountFolder] identities];
|
||||
|
||||
for (i = 0; i < [identities count]; i++)
|
||||
{
|
||||
email = [[identities objectAtIndex: i] objectForKey: @"email"];
|
||||
|
||||
if (email)
|
||||
[allRecipients addObject: email];
|
||||
}
|
||||
}
|
||||
|
||||
to = [NSMutableArray arrayWithCapacity: 2];
|
||||
|
||||
@@ -634,20 +663,19 @@ static NSString *userAgent = nil;
|
||||
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"];
|
||||
[self _purgeRecipients: allRecipients fromAddresses: addrs];
|
||||
[self _addEMailsOfAddresses: addrs toArray: to];
|
||||
[self _addRecipients: addrs toArray: allRecipients];
|
||||
[_info setObject: to forKey: @"to"];
|
||||
|
||||
/* If "to" is empty, we add at least ourself as a recipient!
|
||||
This is for emails in the "Sent" folder that we reply to... */
|
||||
if (![to count])
|
||||
{
|
||||
if ([[_envelope replyTo] count])
|
||||
[self _addEMailsOfAddresses: [_envelope replyTo] toArray: to];
|
||||
[self _addEMailsOfAddresses: [_envelope replyTo] toArray: to];
|
||||
else
|
||||
[self _addEMailsOfAddresses: [_envelope from] toArray: to];
|
||||
[self _addEMailsOfAddresses: [_envelope from] toArray: to];
|
||||
}
|
||||
|
||||
/* If we have no To but we have Cc recipients, let's move the Cc
|
||||
@@ -661,7 +689,7 @@ static NSString *userAgent = nil;
|
||||
[_info removeObjectForKey: @"cc"];
|
||||
}
|
||||
|
||||
/* CC processing if we reply-to-all: add all 'to' and 'cc' */
|
||||
/* CC processing if we reply-to-all: - we add all 'to' and 'cc' fields */
|
||||
if (_replyToAll)
|
||||
{
|
||||
to = [NSMutableArray new];
|
||||
|
||||
@@ -253,11 +253,33 @@ static NSArray *infoKeys = nil;
|
||||
|
||||
- (NSString *) replyTo
|
||||
{
|
||||
SOGoUserDefaults *ud;
|
||||
NSString *value;
|
||||
|
||||
value = nil;
|
||||
|
||||
ud = [[context activeUser] userDefaults];
|
||||
//
|
||||
// We add the correct replyTo here. That is, the one specified in the defaults
|
||||
// for the main "SOGo mail account" versus the one specified in the auxiliary
|
||||
// IMAP accounts.
|
||||
//
|
||||
if ([[[[self clientObject] mailAccountFolder] nameInContainer] intValue] == 0)
|
||||
{
|
||||
SOGoUserDefaults *ud;
|
||||
|
||||
ud = [[context activeUser] userDefaults];
|
||||
value = [ud mailReplyTo];
|
||||
}
|
||||
else
|
||||
{
|
||||
NSArray *identities;
|
||||
|
||||
identities = [[[self clientObject] mailAccountFolder] identities];
|
||||
|
||||
return [ud mailReplyTo];
|
||||
if ([identities count])
|
||||
value = [[identities objectAtIndex: 0] objectForKey: @"replyTo"];
|
||||
}
|
||||
|
||||
return value;
|
||||
}
|
||||
|
||||
- (void) setSubject: (NSString *) newSubject
|
||||
|
||||
Reference in New Issue
Block a user