From bfda86e31cfcc5664e52b76336f930e5074d5a82 Mon Sep 17 00:00:00 2001 From: Francis Lachapelle Date: Wed, 1 Jun 2016 16:22:25 -0400 Subject: [PATCH] Fix recipients of reply message from Sent mailbox Fixes #2625 --- NEWS | 1 + SoObjects/Mailer/SOGoDraftObject.m | 13 +++++++++---- 2 files changed, 10 insertions(+), 4 deletions(-) diff --git a/NEWS b/NEWS index a2bd403e3..179bffd3f 100644 --- a/NEWS +++ b/NEWS @@ -23,6 +23,7 @@ Bug fixes - [web] improved CSS sanitizer for HTML messages (#3700) - [web] fixed toolbar of mail editor when sender address was too long (#3705) - [web] fixed decoding of filename in attachments (quotes and Cyrillic characters) (#2272) + - [web] fixed recipients when replying from a message in the Sent mailbox (#2625) - [core] strip X- tags when securing content (#3695) - [eas] when using EAS/ItemOperations, use IMAP PEEK operation diff --git a/SoObjects/Mailer/SOGoDraftObject.m b/SoObjects/Mailer/SOGoDraftObject.m index a42bd1537..f13243e2b 100644 --- a/SoObjects/Mailer/SOGoDraftObject.m +++ b/SoObjects/Mailer/SOGoDraftObject.m @@ -735,6 +735,7 @@ static NSString *userAgent = nil; // - (void) _fillInReplyAddresses: (NSMutableDictionary *) _info replyToAll: (BOOL) _replyToAll + fromSentMailbox: (BOOL) _fromSentMailbox envelope: (NGImap4Envelope *) _envelope { /* @@ -746,8 +747,6 @@ static NSString *userAgent = nil; Note: we cannot check reply-to, because Cyrus even sets a reply-to in the envelope if none is contained in the message itself! (bug or feature?) - - TODO: what about sender (RFC 822 3.6.2) */ NSMutableArray *to, *addrs, *allRecipients; NSArray *envelopeAddresses; @@ -789,7 +788,9 @@ static NSString *userAgent = nil; addrs = [NSMutableArray array]; envelopeAddresses = [_envelope replyTo]; - if ([envelopeAddresses count]) + if (_fromSentMailbox) + [addrs setArray: [_envelope to]]; + else if ([envelopeAddresses count]) [addrs setArray: envelopeAddresses]; else [addrs setArray: [_envelope from]]; @@ -963,17 +964,21 @@ static NSString *userAgent = nil; - (void) fetchMailForReplying: (SOGoMailObject *) sourceMail toAll: (BOOL) toAll { + BOOL fromSentMailbox; NSString *msgID; NSMutableDictionary *info; NGImap4Envelope *sourceEnvelope; + fromSentMailbox = [[sourceMail container] isKindOfClass: [SOGoSentFolder class]]; [sourceMail fetchCoreInfos]; info = [NSMutableDictionary dictionaryWithCapacity: 16]; [info setObject: [sourceMail subjectForReply] forKey: @"subject"]; sourceEnvelope = [sourceMail envelope]; - [self _fillInReplyAddresses: info replyToAll: toAll + [self _fillInReplyAddresses: info + replyToAll: toAll + fromSentMailbox: fromSentMailbox envelope: sourceEnvelope]; msgID = [sourceEnvelope messageID]; if ([msgID length] > 0)