(feat) we now "cc" delegates during invitation updates (fixes #3195)

This commit is contained in:
Ludovic Marcotte 2016-03-22 13:08:38 -04:00
parent 2c038d641a
commit fee310908b
2 changed files with 92 additions and 44 deletions

1
NEWS
View file

@ -8,6 +8,7 @@ New features
Enhancements Enhancements
- [web] updated Angular Material to version 1.0.6 - [web] updated Angular Material to version 1.0.6
- [web] added Lithuanan (lt) translation - thanks to Mantas Liobė - [web] added Lithuanan (lt) translation - thanks to Mantas Liobė
- [web] we now "cc" delegates during invitation updates (#3195)
Bug fixes Bug fixes
- [web] fixed missing columns in SELECT statements (PostgreSQL) - [web] fixed missing columns in SELECT statements (PostgreSQL)

View file

@ -905,12 +905,15 @@
} }
} }
#warning fix this when sendEmailUsing blabla has been cleaned up //
- (void) sendIMIPReplyForEvent: (iCalRepeatableEntityObject *) event //
//
- (void) _sendIMIPReplyForEvent: (iCalRepeatableEntityObject *) event
from: (SOGoUser *) from from: (SOGoUser *) from
to: (iCalPerson *) recipient to: (iCalPerson *) recipient
textOnly: (BOOL) textOnly
{ {
NSString *pageName, *mailDate, *email; NSString *mailDate, *email;
WOApplication *app; WOApplication *app;
iCalPerson *attendee; iCalPerson *attendee;
SOGoAptMailICalReply *p; SOGoAptMailICalReply *p;
@ -922,15 +925,12 @@
SOGoDomainDefaults *dd; SOGoDomainDefaults *dd;
dd = [from domainDefaults]; dd = [from domainDefaults];
if ([dd appointmentSendEMailNotifications] && [event isStillRelevant])
{
/* get WOApplication instance */ /* get WOApplication instance */
app = [WOApplication application]; app = [WOApplication application];
/* create page name */
pageName = @"SOGoAptMailICalReply";
/* construct message content */ /* construct message content */
p = [app pageWithName: pageName inContext: context]; p = [app pageWithName: @"SOGoAptMailICalReply" inContext: context];
[p setApt: (iCalEvent *) event]; [p setApt: (iCalEvent *) event];
attendee = [event userAsAttendee: from]; attendee = [event userAsAttendee: from];
@ -953,19 +953,30 @@
forKey: @"subject"]; forKey: @"subject"];
[headerMap setObject: [NSString generateMessageID] forKey: @"message-id"]; [headerMap setObject: [NSString generateMessageID] forKey: @"message-id"];
[headerMap setObject: @"1.0" forKey: @"MIME-Version"]; [headerMap setObject: @"1.0" forKey: @"MIME-Version"];
if (textOnly)
[headerMap setObject: @"text/html" forKey: @"content-type"];
else
[headerMap setObject: @"multipart/mixed" forKey: @"content-type"]; [headerMap setObject: @"multipart/mixed" forKey: @"content-type"];
[headerMap setObject: @"calendar:invitation-reply" forKey: @"x-sogo-message-type"]; [headerMap setObject: @"calendar:invitation-reply" forKey: @"x-sogo-message-type"];
msg = [NGMimeMessage messageWithHeader: headerMap]; msg = [NGMimeMessage messageWithHeader: headerMap];
/* multipart body */
body = [[NGMimeMultipartBody alloc] initWithPart: msg];
/* text part */ /* text part */
headerMap = [NGMutableHashMap hashMapWithCapacity: 1]; headerMap = [NGMutableHashMap hashMapWithCapacity: 1];
[headerMap setObject: @"text/html; charset=utf-8" [headerMap setObject: @"text/html; charset=utf-8"
forKey: @"content-type"]; forKey: @"content-type"];
bodyPart = [NGMimeBodyPart bodyPartWithHeader: headerMap]; bodyPart = [NGMimeBodyPart bodyPartWithHeader: headerMap];
bodyData = [[p getBody] dataUsingEncoding: NSUTF8StringEncoding]; bodyData = [[p getBody] dataUsingEncoding: NSUTF8StringEncoding];
if (textOnly)
{
[msg setBody: bodyData];
}
else
{
/* multipart body */
body = [[NGMimeMultipartBody alloc] initWithPart: msg];
[bodyPart setBody: bodyData]; [bodyPart setBody: bodyData];
/* attach text part to multipart body */ /* attach text part to multipart body */
@ -977,6 +988,7 @@
/* attach multipart body to message */ /* attach multipart body to message */
[msg setBody: body]; [msg setBody: body];
[body release]; [body release];
}
/* send the damn thing */ /* send the damn thing */
email = [recipient rfc822Email]; email = [recipient rfc822Email];
@ -987,6 +999,41 @@
withAuthenticator: [self authenticatorInContext: context] withAuthenticator: [self authenticatorInContext: context]
inContext: context]; inContext: context];
} }
//
//
//
- (void) sendIMIPReplyForEvent: (iCalRepeatableEntityObject *) event
from: (SOGoUser *) from
to: (iCalPerson *) recipient
{
SOGoDomainDefaults *dd;
dd = [from domainDefaults];
if ([dd appointmentSendEMailNotifications] && [event isStillRelevant])
{
// We first send to the real recipient (organizer)
[self _sendIMIPReplyForEvent: event
from: from
to: recipient
textOnly: NO];
// If we have a sent-by, we send it to it also. This is useful since
// if Alice is Bob's asssitant and invites Tony, when Tony accepts/declines
// the event, Alice will also be informed about this. See #3195 for details.
if ([recipient hasSentBy])
{
iCalPerson *sentBy;
sentBy = [[[iCalPerson alloc] init] autorelease];
[sentBy setEmail: [recipient sentBy]];
[self _sendIMIPReplyForEvent: event
from: from
to: sentBy
textOnly: YES];
}
}
} }
// //