(fix) make sure sure email invitations can always be read by EAS clients

pull/85/head
Ludovic Marcotte 2015-05-12 09:59:01 -04:00
parent 4826f01555
commit f666b436dd
2 changed files with 87 additions and 22 deletions

View File

@ -49,6 +49,7 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#import <NGImap4/NGImap4EnvelopeAddress.h>
#import <NGImap4/NSString+Imap4.h>
#import <NGObjWeb/WOContext+SoObjects.h>
#import <NGObjWeb/WOApplication.h>
#import <NGMime/NGMimeBodyPart.h>
#import <NGMime/NGMimeFileData.h>
@ -74,6 +75,8 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#include <SOGo/SOGoUser.h>
#include <SOGo/NSString+Utilities.h>
#import <Appointments/SOGoAptMailNotification.h>
typedef struct {
uint32_t dwLowDateTime;
uint32_t dwHighDateTime;
@ -452,7 +455,7 @@ struct GlobalObjectId {
// We get the right part based on the preference
if (theType == 1 || theType == 2)
{
if ([type isEqualToString: @"text"])
if ([type isEqualToString: @"text"] && ![subtype isEqualToString: @"calendar"])
{
NSString *s, *charset;
@ -511,9 +514,37 @@ struct GlobalObjectId {
- (iCalCalendar *) calendarFromIMIPMessage
{
NSDictionary *part;
NSString *type, *subtype;
NSArray *parts;
int i;
type = [[[self bodyStructure] valueForKey: @"type"] lowercaseString];
subtype = [[[self bodyStructure] valueForKey: @"subtype"] lowercaseString];
// process mail of type text/calendar
if ([type isEqualToString: @"text"] && [subtype isEqualToString: @"calendar"])
{
iCalCalendar *calendar;
NSString *encoding;
NSData *calendarData;
encoding = [[[self bodyStructure] valueForKey: @"encoding"] lowercaseString];
calendarData = [[self fetchPlainTextParts] objectForKey: @""];
if ([encoding caseInsensitiveCompare: @"base64"] == NSOrderedSame)
calendarData = [calendarData dataByDecodingBase64];
else if ([encoding caseInsensitiveCompare: @"quoted-printable"] == NSOrderedSame)
calendarData = [calendarData dataByDecodingQuotedPrintableTransferEncoding];
NS_DURING
calendar = [iCalCalendar parseSingleFromSource: calendarData];
NS_HANDLER
calendar = nil;
NS_ENDHANDLER
return calendar;
}
// We check if we have at least 2 parts and if one of them is a text/calendar
parts = [[self bodyStructure] objectForKey: @"parts"];
@ -783,6 +814,39 @@ struct GlobalObjectId {
nativeBodyType = 1;
d = [self _preferredBodyDataUsingType: preferredBodyType nativeType: &nativeBodyType];
if (calendar && !d)
{
WOApplication *app;
SOGoAptMailNotification *p;
NSString *pageName;
nativeBodyType = 2;
/* get WOApplication instance */
app = [WOApplication application];
/* create page name */
pageName = [NSString stringWithFormat: @"SOGoAptMail%@", @"Invitation"];
/* construct message content */
p = [app pageWithName: pageName inContext: context];
[p setApt: (iCalEvent *) [[calendar events] lastObject]];
if ([[ [[calendar events] lastObject] organizer] cn] && [[[ [[calendar events] lastObject] organizer] cn] length])
{
[p setOrganizerName: [[ [[calendar events] lastObject] organizer] cn]];
}
else
{
[p setOrganizerName: [[SOGoUser userWithLogin: owner] cn]];
}
if (preferredBodyType == 1 && nativeBodyType == 2)
d = [[[p getBody] htmlToText] dataUsingEncoding: NSUTF8StringEncoding];
else
d = [[p getBody] dataUsingEncoding: NSUTF8StringEncoding];
}
if (d)
{

43
NEWS
View File

@ -9,13 +9,14 @@ Enhancements
- added systemd startup script (PR#76)
- added Basque translation - thanks to Gorka Gonzalez
- updated Brazilian (Portuguese), Dutch, Norwegian (Bokmal), Polish, Russian, and Spanish (Spain) translations Enhancements
- Sharing request among different Outlook versions (Zentyal)
- Improve sync speed from Outlook by non-reprocessing already downloaded unread mails (Zentyal)
- Give support to calendar sharing invitations
- Missing contact fields are now saved and available when sharing it (Office, Profession, Manager's name, Assistant's name, Spouse/Partner, Anniversary) (Zentyal)
- Appointment color and importance work now between Outlooks (Zentyal)
- Synchronize events, contacts and tasks in reverse chronological order (Zentyal)
- During login, we now extract the domain from the user to accelerate authentication requests on sources
- sharing request among different Outlook versions (Zentyal)
- improve sync speed from Outlook by non-reprocessing already downloaded unread mails (Zentyal)
- give support to calendar sharing invitations
- missing contact fields are now saved and available when sharing it (Office, Profession, Manager's name, Assistant's name, Spouse/Partner, Anniversary) (Zentyal)
- appointment color and importance work now between Outlooks (Zentyal)
- synchronize events, contacts and tasks in reverse chronological order (Zentyal)
- during login, we now extract the domain from the user to accelerate authentication requests on sources
- make sure sure email invitations can always be read by EAS clients
Bug fixes
- now keep the BodyPreference for future EAS use and default to MIME if none set (#3146)
@ -29,21 +30,21 @@ Bug fixes
- fixed serialization of the PreventInvitationsWhitelist settings
- fixed md4 support (for NTLM password changes) with GNU TLS
- fixed edition of attachment URL in event/task editor
- Sent mails are not longer in Drafts folder using Outlook (Zentyal)
- Deleted mails are properly synced between Outlook profiles from the same account (Zentyal)
- Does not create a mail folder in other user's mailbox (Zentyal)
- Fix server-side crash with invalid events (Zentyal)
- Fix setting permissions for a folder with several users (Zentyal)
- Fix reception of calendar event invitations on optional attendees (Zentyal)
- Fix server side crash parsing rtf without color table (Zentyal)
- Weekly recurring events created in SOGo web interface are now shown in Outlook (Zentyal)
- Fix exception modifications import in recurrence series (Zentyal)
- Fix server side crash parsing rtf emails with images (with word97 format) (Zentyal)
- Fix sender on importing email messages like event invitations (Zentyal)
- Fix Outlook crashes when modifying the view of a folder (Zentyal)
- Fix server side crash when reading some recurrence appointments (Zentyal)
- sent mails are not longer in Drafts folder using Outlook (Zentyal)
- deleted mails are properly synced between Outlook profiles from the same account (Zentyal)
- does not create a mail folder in other user's mailbox (Zentyal)
- fix server-side crash with invalid events (Zentyal)
- fix setting permissions for a folder with several users (Zentyal)
- fix reception of calendar event invitations on optional attendees (Zentyal)
- fix server side crash parsing rtf without color table (Zentyal)
- weekly recurring events created in SOGo web interface are now shown in Outlook (Zentyal)
- fix exception modifications import in recurrence series (Zentyal)
- fix server side crash parsing rtf emails with images (with word97 format) (Zentyal)
- fix sender on importing email messages like event invitations (Zentyal)
- fix Outlook crashes when modifying the view of a folder (Zentyal)
- fix server side crash when reading some recurrence appointments (Zentyal)
- Outlook clients can use reply all functionality on multidomain environment (Zentyal)
- Optional attendes on events are now shown properly (Zentyal)
- optional attendes on events are now shown properly (Zentyal)
- fixed the EAS maximum response size being per-folder, and not global
2.2.17a (2015-03-15)