Monotone-Parent: 9e801367e2872b48308f9e9be0a0a72b635bbc6e

Monotone-Revision: 49e9c5bd210d89a7731744a1af6593223adab775

Monotone-Author: wsourdeau@inverse.ca
Monotone-Date: 2007-11-29T19:37:37
Monotone-Branch: ca.inverse.sogo
This commit is contained in:
Wolfgang Sourdeau
2007-11-29 19:37:37 +00:00
parent 0305aa4b3f
commit 7dfc20e461
2 changed files with 67 additions and 60 deletions
+4
View File
@@ -1,5 +1,9 @@
2007-11-29 Wolfgang Sourdeau <wsourdeau@inverse.ca>
* SoObjects/Appointments/SOGoCalendarComponent.m
([SOGoCalendarComponent -sendResponseToOrganizer]): send the
message only of sendEMailNotifications is set.
* SoObjects/SOGo/SOGoObject.m ([SOGoObject -subscriptionRoles]):
new method that returns the roles that qualifies for adding the
special "authorized subscribed" sogo role.
+63 -60
View File
@@ -364,79 +364,82 @@ static BOOL sendEMailNotifications = NO;
NGMimeMultipartBody *body;
NSData *bodyData;
event = [[self component: NO secure: NO] itipEntryWithMethod: @"reply"];
if (![event userIsOrganizer: [context activeUser]])
if (sendEMailNotifications)
{
organizer = [event organizer];
attendee = [event findParticipant: [context activeUser]];
[event setAttendees: [NSArray arrayWithObject: attendee]];
event = [[self component: NO secure: NO] itipEntryWithMethod: @"reply"];
if (![event userIsOrganizer: [context activeUser]])
{
organizer = [event organizer];
attendee = [event findParticipant: [context activeUser]];
[event setAttendees: [NSArray arrayWithObject: attendee]];
/* get WOApplication instance */
app = [WOApplication application];
/* get WOApplication instance */
app = [WOApplication application];
language = [[context activeUser] language];
/* create page name */
pageName
= [NSString stringWithFormat: @"SOGoAptMail%@ICalReply", language];
/* construct message content */
p = [app pageWithName: pageName inContext: context];
[p setApt: event];
[p setAttendee: attendee];
language = [[context activeUser] language];
/* create page name */
pageName
= [NSString stringWithFormat: @"SOGoAptMail%@ICalReply", language];
/* construct message content */
p = [app pageWithName: pageName inContext: context];
[p setApt: event];
[p setAttendee: attendee];
/* construct message */
headerMap = [NGMutableHashMap hashMapWithCapacity: 5];
/* construct message */
headerMap = [NGMutableHashMap hashMapWithCapacity: 5];
/* NOTE: multipart/alternative seems like the correct choice but
* unfortunately Thunderbird doesn't offer the rich content alternative
* at all. Mail.app shows the rich content alternative _only_
* so we'll stick with multipart/mixed for the time being.
*/
[headerMap setObject: @"multipart/mixed" forKey: @"content-type"];
[headerMap setObject: [attendee mailAddress] forKey: @"From"];
[headerMap setObject: [organizer mailAddress] forKey: @"To"];
mailDate = [[NSCalendarDate date] rfc822DateString];
[headerMap setObject: mailDate forKey: @"date"];
[headerMap setObject: [p getSubject] forKey: @"Subject"];
msg = [NGMimeMessage messageWithHeader: headerMap];
/* NOTE: multipart/alternative seems like the correct choice but
* unfortunately Thunderbird doesn't offer the rich content alternative
* at all. Mail.app shows the rich content alternative _only_
* so we'll stick with multipart/mixed for the time being.
*/
[headerMap setObject: @"multipart/mixed" forKey: @"content-type"];
[headerMap setObject: [attendee mailAddress] forKey: @"From"];
[headerMap setObject: [organizer mailAddress] forKey: @"To"];
mailDate = [[NSCalendarDate date] rfc822DateString];
[headerMap setObject: mailDate forKey: @"date"];
[headerMap setObject: [p getSubject] forKey: @"Subject"];
msg = [NGMimeMessage messageWithHeader: headerMap];
NSLog (@"sending 'REPLY' from %@ to %@",
[attendee mailAddress], [organizer mailAddress]);
NSLog (@"sending 'REPLY' from %@ to %@",
[attendee mailAddress], [organizer mailAddress]);
/* multipart body */
body = [[NGMimeMultipartBody alloc] initWithPart: msg];
/* multipart body */
body = [[NGMimeMultipartBody alloc] initWithPart: msg];
/* text part */
headerMap = [NGMutableHashMap hashMapWithCapacity: 1];
[headerMap setObject: @"text/plain; charset=utf-8"
forKey: @"content-type"];
bodyPart = [NGMimeBodyPart bodyPartWithHeader: headerMap];
bodyData = [[p getBody] dataUsingEncoding: NSUTF8StringEncoding];
[bodyPart setBody: bodyData];
/* text part */
headerMap = [NGMutableHashMap hashMapWithCapacity: 1];
[headerMap setObject: @"text/plain; charset=utf-8"
forKey: @"content-type"];
bodyPart = [NGMimeBodyPart bodyPartWithHeader: headerMap];
bodyData = [[p getBody] dataUsingEncoding: NSUTF8StringEncoding];
[bodyPart setBody: bodyData];
/* attach text part to multipart body */
[body addBodyPart: bodyPart];
/* attach text part to multipart body */
[body addBodyPart: bodyPart];
/* calendar part */
headerMap = [NGMutableHashMap hashMapWithCapacity: 1];
[headerMap setObject: @"text/calendar; method=REPLY; charset=utf-8"
forKey: @"content-type"];
bodyPart = [NGMimeBodyPart bodyPartWithHeader: headerMap];
iCalString = [[event parent] versitString];
[bodyPart setBody: [iCalString dataUsingEncoding: NSUTF8StringEncoding]];
/* calendar part */
headerMap = [NGMutableHashMap hashMapWithCapacity: 1];
[headerMap setObject: @"text/calendar; method=REPLY; charset=utf-8"
forKey: @"content-type"];
bodyPart = [NGMimeBodyPart bodyPartWithHeader: headerMap];
iCalString = [[event parent] versitString];
[bodyPart setBody: [iCalString dataUsingEncoding: NSUTF8StringEncoding]];
/* attach calendar part to multipart body */
[body addBodyPart: bodyPart];
/* attach calendar part to multipart body */
[body addBodyPart: bodyPart];
/* attach multipart body to message */
[msg setBody: body];
[body release];
/* attach multipart body to message */
[msg setBody: body];
[body release];
/* send the damn thing */
email = [organizer rfc822Email];
[[SOGoMailer sharedMailer]
sendMimePart: msg
toRecipients: [NSArray arrayWithObject: email]
sender: [attendee rfc822Email]];
/* send the damn thing */
email = [organizer rfc822Email];
[[SOGoMailer sharedMailer]
sendMimePart: msg
toRecipients: [NSArray arrayWithObject: email]
sender: [attendee rfc822Email]];
}
}
}