Monotone-Parent: 64c6fb31c6cce606c55da59af9570e27ff81bd4d
Monotone-Revision: c80330da9a8ac34c6b7766f390131ea49ac47d5b Monotone-Author: wsourdeau@inverse.ca Monotone-Date: 2008-07-10T15:26:41 Monotone-Branch: ca.inverse.sogomaint-2.0.2
parent
a62f8fb9af
commit
fa626352b5
|
@ -1,3 +1,12 @@
|
|||
2008-07-10 Wolfgang Sourdeau <wsourdeau@inverse.ca>
|
||||
|
||||
* SoObjects/Appointments/SOGoCalendarComponent.m
|
||||
([SOGoCalendarComponent
|
||||
-sendIMIPReplyForEvent:eventto:recipient]): new method, derived from
|
||||
sendResponseToOrganizer but more generic.
|
||||
([SOGoCalendarComponent -sendResponseToOrganizer]): make use of
|
||||
the new method mentionne above.
|
||||
|
||||
2008-07-09 Wolfgang Sourdeau <wsourdeau@inverse.ca>
|
||||
|
||||
* SoObjects/Appointments/SOGoAppointmentFolders.m ([SOGoAppointmentFolders -davCreateCalendarCollection:newNameinContext:createContext]):
|
||||
|
|
|
@ -532,10 +532,7 @@
|
|||
else
|
||||
[recipientEvent takeAttendeeStatus: attendee];
|
||||
}
|
||||
#warning fix this when sendEmailUsing blabla has been cleaned up
|
||||
[self sendEMailUsingTemplateNamed: @"ICalReply"
|
||||
forOldObject: nil andNewObject: event
|
||||
toAttendees: [NSArray arrayWithObject: person]];
|
||||
[self sendIMIPReplyForEvent: event to: person];
|
||||
[person release];
|
||||
[elements
|
||||
addObject: [self _caldavSuccessCodeWithRecipient: recipient]];
|
||||
|
|
|
@ -55,6 +55,8 @@
|
|||
forOldObject: (iCalRepeatableEntityObject *) _oldObject
|
||||
andNewObject: (iCalRepeatableEntityObject *) _newObject
|
||||
toAttendees: (NSArray *) _attendees;
|
||||
- (void) sendIMIPReplyForEvent: (iCalRepeatableEntityObject *) event
|
||||
to: (iCalPerson *) recipient;
|
||||
- (void) sendResponseToOrganizer;
|
||||
|
||||
// - (BOOL) isOrganizerOrOwner: (SOGoUser *) user;
|
||||
|
|
|
@ -373,96 +373,108 @@ static BOOL sendEMailNotifications = NO;
|
|||
}
|
||||
}
|
||||
|
||||
- (void) sendResponseToOrganizer
|
||||
#warning fix this when sendEmailUsing blabla has been cleaned up
|
||||
- (void) sendIMIPReplyForEvent: (iCalRepeatableEntityObject *) event
|
||||
to: (iCalPerson *) recipient
|
||||
{
|
||||
NSString *pageName, *language, *mailDate, *email;
|
||||
WOApplication *app;
|
||||
iCalPerson *organizer, *attendee;
|
||||
iCalPerson *attendee;
|
||||
NSString *iCalString;
|
||||
iCalEvent *event;
|
||||
SOGoAptMailICalReply *p;
|
||||
NGMutableHashMap *headerMap;
|
||||
NGMimeMessage *msg;
|
||||
NGMimeBodyPart *bodyPart;
|
||||
NGMimeMultipartBody *body;
|
||||
NSData *bodyData;
|
||||
SOGoUser *ownerUser;
|
||||
|
||||
if (sendEMailNotifications)
|
||||
{
|
||||
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];
|
||||
ownerUser = [SOGoUser userWithLogin: owner roles: nil];
|
||||
language = [ownerUser language];
|
||||
/* create page name */
|
||||
pageName
|
||||
= [NSString stringWithFormat: @"SOGoAptMail%@ICalReply", language];
|
||||
/* construct message content */
|
||||
p = [app pageWithName: pageName inContext: context];
|
||||
[p setApt: event];
|
||||
[p setAttendee: [event findParticipant: ownerUser]];
|
||||
|
||||
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: [recipient 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], [recipient 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 = [recipient rfc822Email];
|
||||
[[SOGoMailer sharedMailer]
|
||||
sendMimePart: msg
|
||||
toRecipients: [NSArray arrayWithObject: email]
|
||||
sender: [attendee rfc822Email]];
|
||||
}
|
||||
}
|
||||
|
||||
- (void) sendResponseToOrganizer
|
||||
{
|
||||
iCalPerson *organizer, *attendee;
|
||||
iCalEvent *event;
|
||||
SOGoUser *ownerUser;
|
||||
|
||||
event = [[self component: NO secure: NO] itipEntryWithMethod: @"reply"];
|
||||
ownerUser = [SOGoUser userWithLogin: owner roles: nil];
|
||||
if (![event userIsOrganizer: ownerUser])
|
||||
{
|
||||
organizer = [event organizer];
|
||||
attendee = [event findParticipant: ownerUser];
|
||||
[event setAttendees: [NSArray arrayWithObject: attendee]];
|
||||
[self sendIMIPReplyForEvent: event to: organizer];
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue