From f2e72f108fcc0ad78a0f167bed6e9df9e15111d0 Mon Sep 17 00:00:00 2001 From: Wolfgang Sourdeau Date: Tue, 7 Aug 2012 15:35:31 +0000 Subject: [PATCH] Monotone-Parent: 355e6e150effcfc0fdb8c4139071a1a734173bda Monotone-Revision: de8a628ccf75e9a2e0e0a0ce276c536a91eeb716 Monotone-Author: wsourdeau@inverse.ca Monotone-Date: 2012-08-07T15:35:31 Monotone-Branch: ca.inverse.sogo --- ChangeLog | 4 ++ .../Appointments/SOGoAptMailNotification.m | 54 +++++++++++-------- 2 files changed, 36 insertions(+), 22 deletions(-) diff --git a/ChangeLog b/ChangeLog index f15a3879e..98cd188e0 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,9 @@ 2012-08-07 Wolfgang Sourdeau + * SoObjects/Appointments/SOGoAptMailNotification.m (-setupValues): + test whether each value is non-nil before adding it to the + dictionary. + * OpenChange/MAPIStoreMailVolatileMessage.m (-save): restored registration of message url when saved. diff --git a/SoObjects/Appointments/SOGoAptMailNotification.m b/SoObjects/Appointments/SOGoAptMailNotification.m index 70f911592..63c694103 100644 --- a/SoObjects/Appointments/SOGoAptMailNotification.m +++ b/SoObjects/Appointments/SOGoAptMailNotification.m @@ -173,8 +173,8 @@ - (void) setupValues { - NSString *sentBy, *sentByText, *description; - NSCalendarDate *date; + NSString *sentByText; + id value; NSDictionary *sentByValues; SOGoUser *user; SOGoDateFormatter *dateFormatter; @@ -184,15 +184,18 @@ [viewTZ retain]; values = [NSMutableDictionary new]; - [values setObject: [self summary] forKey: @"Summary"]; + value = [self summary]; + if (!value) + value = @""; + [values setObject: value forKey: @"Summary"]; if (organizerName) { [values setObject: organizerName forKey: @"Organizer"]; - sentBy = [[apt organizer] sentBy]; - if ([sentBy length]) + value = [[apt organizer] sentBy]; + if (value) { - sentByValues = [NSDictionary dictionaryWithObject: sentBy + sentByValues = [NSDictionary dictionaryWithObject: value forKey: @"SentBy"]; sentByText = [sentByValues keysWithFormat: [self @@ -201,29 +204,36 @@ } else sentByText = @""; + [values setObject: sentByText forKey: @"SentByText"]; } dateFormatter = [[context activeUser] dateFormatterInContext: context]; - date = [self newStartDate]; - [values setObject: [dateFormatter shortFormattedDate: date] - forKey: @"StartDate"]; - if (![apt isAllDay]) - [values setObject: [dateFormatter formattedTime: date] - forKey: @"StartTime"]; + value = [self newStartDate]; + if (value) + { + [values setObject: [dateFormatter shortFormattedDate: value] + forKey: @"StartDate"]; + if (![apt isAllDay]) + [values setObject: [dateFormatter formattedTime: value] + forKey: @"StartTime"]; + } - date = [self newEndDate]; - [values setObject: [dateFormatter shortFormattedDate: date] - forKey: @"EndDate"]; - if (![apt isAllDay]) - [values setObject: [dateFormatter formattedTime: date] - forKey: @"EndTime"]; - - description = [[self apt] comment]; - [values setObject: (description ? description : @"") - forKey: @"Description"]; + value = [self newEndDate]; + if (value) + { + [values setObject: [dateFormatter shortFormattedDate: value] + forKey: @"EndDate"]; + if (![apt isAllDay]) + [values setObject: [dateFormatter formattedTime: value] + forKey: @"EndTime"]; + } + value = [[self apt] comment]; + if (!value) + value = @""; + [values setObject: value forKey: @"Description"]; } @end