From 563a2cd9df192207fd72c9124251fac90167cace Mon Sep 17 00:00:00 2001 From: Francis Lachapelle Date: Thu, 13 Sep 2018 10:04:43 -0400 Subject: [PATCH] Fix behaviour of return receipt actions --- NEWS | 1 + SoObjects/SOGo/SOGoDefaults.plist | 1 + UI/Common/English.lproj/Localizable.strings | 1 + UI/MailerUI/UIxMailView.m | 36 +++++++++++++-------- 4 files changed, 26 insertions(+), 13 deletions(-) diff --git a/NEWS b/NEWS index 7ab2d5b7e..88404419e 100644 --- a/NEWS +++ b/NEWS @@ -15,6 +15,7 @@ Bug fixes - [web] fixed display of multi-days events when some weekdays are disabled - [web] fixed synchronisation of calendar categories - [web] fixed popup window detection in message viewer (#4518) + - [web] fixed behaviour of return receipt actions 4.0.2 (2018-08-24) ------------------ diff --git a/SoObjects/SOGo/SOGoDefaults.plist b/SoObjects/SOGo/SOGoDefaults.plist index 980000489..ba4343836 100644 --- a/SoObjects/SOGo/SOGoDefaults.plist +++ b/SoObjects/SOGo/SOGoDefaults.plist @@ -131,6 +131,7 @@ $label3 = ("Personal", "#009900"); $label4 = ("To Do", "#3333FF"); $label5 = ("Later", "#993399"); + $mdnsent = ("Return Receipt Sent", "#006600"); }; SOGoCalendarCategories = ( diff --git a/UI/Common/English.lproj/Localizable.strings b/UI/Common/English.lproj/Localizable.strings index 77d147094..73a77956c 100644 --- a/UI/Common/English.lproj/Localizable.strings +++ b/UI/Common/English.lproj/Localizable.strings @@ -101,6 +101,7 @@ "Personal" = "Personal"; "To Do" = "To Do"; "Later" = "Later"; +"Return Receipt Sent" = "Return Receipt Sent"; "a2_Sunday" = "Su"; "a2_Monday" = "Mo"; "a2_Tuesday" = "Tu"; diff --git a/UI/MailerUI/UIxMailView.m b/UI/MailerUI/UIxMailView.m index 58097ce47..b44952053 100644 --- a/UI/MailerUI/UIxMailView.m +++ b/UI/MailerUI/UIxMailView.m @@ -70,6 +70,7 @@ - (BOOL) mailIsDraft; - (NSNumber *) shouldAskReceipt; - (NSString *) formattedDate; +- (NSString *) _matchingIdentityEMailOrDefault: (BOOL) useDefault; @end @@ -421,14 +422,21 @@ static NSString *mailETag = nil; } - (NSString *) _matchingIdentityEMail +{ + return [self _matchingIdentityEMailOrDefault: YES]; +} + +- (NSString *) _matchingIdentityEMailOrDefault: (BOOL) useDefault { NSMutableArray *recipients; NSArray *headerRecipients; - NSString *currentEMail; + NSString *currentEMail, *email; NGImap4EnvelopeAddress *address; NSInteger count, max; SOGoMailObject *co; + email = nil; + if (!matchingIdentityEMail) { recipients = [NSMutableArray array]; @@ -453,18 +461,21 @@ static NSString *mailETag = nil; [matchingIdentityEMail retain]; } } - - if (!matchingIdentityEMail) - { - // This can happen if we receive the message because we are - // in the list of bcc. In this case, we take the first - // identity associated with the account. - matchingIdentityEMail = [[[[[self clientObject] mailAccountFolder] identities] lastObject] objectForKey: @"email"]; - RETAIN(matchingIdentityEMail); - } } - return matchingIdentityEMail; + if (matchingIdentityEMail) + { + email = matchingIdentityEMail; + } + else if (useDefault) + { + // This can happen if we receive the message because we are + // in the list of bcc. In this case, we take the first + // identity associated with the account. + email = [[[[[self clientObject] mailAccountFolder] identities] objectAtIndex: 0] objectForKey: @"email"]; + } + + return email; } - (NSString *) _domainFromEMail: (NSString *) email @@ -531,7 +542,7 @@ static NSString *mailETag = nil; ud = [[context activeUser] userDefaults]; if ([ud allowUserReceipt]) { - if ([self _matchingIdentityEMail]) + if ([self _matchingIdentityEMailOrDefault: NO]) { if ([self _senderIsInUserDomain: headers]) action = [ud userReceiptAnyAction]; @@ -723,7 +734,6 @@ static NSString *mailETag = nil; if ([action isEqualToString: @"ask"]) { shouldAskReceipt = [NSNumber numberWithBool: YES]; - [self _flagMessageWithMDNSent]; } else if ([action isEqualToString: @"send"]) [self _sendEMailReceiptTo: email];