oc-mail: Set sender on email messages without an orig recipient

But it has recipients. This is for sure happening with event
invitations messages.
This commit is contained in:
Enrique J. Hernández Blasco 2015-03-03 22:52:42 +01:00
parent acc2bd0369
commit 44dfd35521
2 changed files with 14 additions and 5 deletions

1
NEWS
View file

@ -7,6 +7,7 @@ Enhancements
- Appointment color and importance work now between Outlooks - Appointment color and importance work now between Outlooks
Bug fixes Bug fixes
- Fix sender on importing email messages like event invitations
- Fix Outlook crashes when modifying the view of a folder - Fix Outlook crashes when modifying the view of a folder
- Fix server side crash when reading some recurrence appointments - Fix server side crash when reading some recurrence appointments

View file

@ -536,6 +536,7 @@ FillMessageHeadersFromProperties (NGMutableHashMap *headers,
NSDictionary *mailProperties, BOOL withBcc, NSDictionary *mailProperties, BOOL withBcc,
struct mapistore_connection_info *connInfo) struct mapistore_connection_info *connInfo)
{ {
BOOL fromResolved = NO;
NSData *senderEntryId; NSData *senderEntryId;
NSMutableString *subject; NSMutableString *subject;
NSString *from, *recId, *messageId, *subjectData, *recipientsStr; NSString *from, *recId, *messageId, *subjectData, *recipientsStr;
@ -572,13 +573,15 @@ FillMessageHeadersFromProperties (NGMutableHashMap *headers,
list = MakeRecipientsList ([recipients objectForKey: @"orig"]); list = MakeRecipientsList ([recipients objectForKey: @"orig"]);
if ([list count]) if ([list count])
[headers setObjects: list forKey: @"from"]; {
[headers setObjects: list forKey: @"from"];
fromResolved = YES;
}
} }
else
if (!fromResolved)
{ {
NSLog (@"Message without recipients." NSLog (@"Message without an orig from, try to guess it from PidTagSenderEntryId");
@"Guessing recipients from PidTagSenderEntryId, PidTagOriginalDisplayTo"
@"and PidTagOriginalCc");
senderEntryId = [mailProperties objectForKey: MAPIPropertyKey (PR_SENDER_ENTRYID)]; senderEntryId = [mailProperties objectForKey: MAPIPropertyKey (PR_SENDER_ENTRYID)];
if (senderEntryId) if (senderEntryId)
{ {
@ -638,7 +641,12 @@ FillMessageHeadersFromProperties (NGMutableHashMap *headers,
} }
} }
}
if (!recipients)
{
NSLog (@"Message without recipients."
@"Guessing recipients from PidTagOriginalDisplayTo and PidTagOriginalCc");
recipientsStr = [mailProperties objectForKey: MAPIPropertyKey (PidTagOriginalDisplayTo)]; recipientsStr = [mailProperties objectForKey: MAPIPropertyKey (PidTagOriginalDisplayTo)];
if (recipientsStr) if (recipientsStr)
{ {