Monotone-Parent: 64c6fb31c6cce606c55da59af9570e27ff81bd4d
Monotone-Revision: c80330da9a8ac34c6b7766f390131ea49ac47d5b Monotone-Author: wsourdeau@inverse.ca Monotone-Date: 2008-07-10T15:26:41 Monotone-Branch: ca.inverse.sogo
This commit is contained in:
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>
|
2008-07-09 Wolfgang Sourdeau <wsourdeau@inverse.ca>
|
||||||
|
|
||||||
* SoObjects/Appointments/SOGoAppointmentFolders.m ([SOGoAppointmentFolders -davCreateCalendarCollection:newNameinContext:createContext]):
|
* SoObjects/Appointments/SOGoAppointmentFolders.m ([SOGoAppointmentFolders -davCreateCalendarCollection:newNameinContext:createContext]):
|
||||||
|
|
|
@ -532,10 +532,7 @@
|
||||||
else
|
else
|
||||||
[recipientEvent takeAttendeeStatus: attendee];
|
[recipientEvent takeAttendeeStatus: attendee];
|
||||||
}
|
}
|
||||||
#warning fix this when sendEmailUsing blabla has been cleaned up
|
[self sendIMIPReplyForEvent: event to: person];
|
||||||
[self sendEMailUsingTemplateNamed: @"ICalReply"
|
|
||||||
forOldObject: nil andNewObject: event
|
|
||||||
toAttendees: [NSArray arrayWithObject: person]];
|
|
||||||
[person release];
|
[person release];
|
||||||
[elements
|
[elements
|
||||||
addObject: [self _caldavSuccessCodeWithRecipient: recipient]];
|
addObject: [self _caldavSuccessCodeWithRecipient: recipient]];
|
||||||
|
|
|
@ -55,6 +55,8 @@
|
||||||
forOldObject: (iCalRepeatableEntityObject *) _oldObject
|
forOldObject: (iCalRepeatableEntityObject *) _oldObject
|
||||||
andNewObject: (iCalRepeatableEntityObject *) _newObject
|
andNewObject: (iCalRepeatableEntityObject *) _newObject
|
||||||
toAttendees: (NSArray *) _attendees;
|
toAttendees: (NSArray *) _attendees;
|
||||||
|
- (void) sendIMIPReplyForEvent: (iCalRepeatableEntityObject *) event
|
||||||
|
to: (iCalPerson *) recipient;
|
||||||
- (void) sendResponseToOrganizer;
|
- (void) sendResponseToOrganizer;
|
||||||
|
|
||||||
// - (BOOL) isOrganizerOrOwner: (SOGoUser *) user;
|
// - (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;
|
NSString *pageName, *language, *mailDate, *email;
|
||||||
WOApplication *app;
|
WOApplication *app;
|
||||||
iCalPerson *organizer, *attendee;
|
iCalPerson *attendee;
|
||||||
NSString *iCalString;
|
NSString *iCalString;
|
||||||
iCalEvent *event;
|
|
||||||
SOGoAptMailICalReply *p;
|
SOGoAptMailICalReply *p;
|
||||||
NGMutableHashMap *headerMap;
|
NGMutableHashMap *headerMap;
|
||||||
NGMimeMessage *msg;
|
NGMimeMessage *msg;
|
||||||
NGMimeBodyPart *bodyPart;
|
NGMimeBodyPart *bodyPart;
|
||||||
NGMimeMultipartBody *body;
|
NGMimeMultipartBody *body;
|
||||||
NSData *bodyData;
|
NSData *bodyData;
|
||||||
|
SOGoUser *ownerUser;
|
||||||
|
|
||||||
if (sendEMailNotifications)
|
if (sendEMailNotifications)
|
||||||
{
|
{
|
||||||
event = [[self component: NO secure: NO] itipEntryWithMethod: @"reply"];
|
/* get WOApplication instance */
|
||||||
if (![event userIsOrganizer: [context activeUser]])
|
app = [WOApplication application];
|
||||||
{
|
|
||||||
organizer = [event organizer];
|
|
||||||
attendee = [event findParticipant: [context activeUser]];
|
|
||||||
[event setAttendees: [NSArray arrayWithObject: attendee]];
|
|
||||||
|
|
||||||
/* get WOApplication instance */
|
ownerUser = [SOGoUser userWithLogin: owner roles: nil];
|
||||||
app = [WOApplication application];
|
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];
|
/* construct message */
|
||||||
/* create page name */
|
headerMap = [NGMutableHashMap hashMapWithCapacity: 5];
|
||||||
pageName
|
|
||||||
= [NSString stringWithFormat: @"SOGoAptMail%@ICalReply", language];
|
|
||||||
/* construct message content */
|
|
||||||
p = [app pageWithName: pageName inContext: context];
|
|
||||||
[p setApt: event];
|
|
||||||
[p setAttendee: attendee];
|
|
||||||
|
|
||||||
/* construct message */
|
/* NOTE: multipart/alternative seems like the correct choice but
|
||||||
headerMap = [NGMutableHashMap hashMapWithCapacity: 5];
|
* unfortunately Thunderbird doesn't offer the rich content alternative
|
||||||
|
* at all. Mail.app shows the rich content alternative _only_
|
||||||
/* NOTE: multipart/alternative seems like the correct choice but
|
* so we'll stick with multipart/mixed for the time being.
|
||||||
* unfortunately Thunderbird doesn't offer the rich content alternative
|
*/
|
||||||
* at all. Mail.app shows the rich content alternative _only_
|
[headerMap setObject: @"multipart/mixed" forKey: @"content-type"];
|
||||||
* so we'll stick with multipart/mixed for the time being.
|
[headerMap setObject: [attendee mailAddress] forKey: @"from"];
|
||||||
*/
|
[headerMap setObject: [recipient mailAddress] forKey: @"to"];
|
||||||
[headerMap setObject: @"multipart/mixed" forKey: @"content-type"];
|
mailDate = [[NSCalendarDate date] rfc822DateString];
|
||||||
[headerMap setObject: [attendee mailAddress] forKey: @"from"];
|
[headerMap setObject: mailDate forKey: @"date"];
|
||||||
[headerMap setObject: [organizer mailAddress] forKey: @"to"];
|
[headerMap setObject: [p getSubject] forKey: @"subject"];
|
||||||
mailDate = [[NSCalendarDate date] rfc822DateString];
|
msg = [NGMimeMessage messageWithHeader: headerMap];
|
||||||
[headerMap setObject: mailDate forKey: @"date"];
|
|
||||||
[headerMap setObject: [p getSubject] forKey: @"subject"];
|
|
||||||
msg = [NGMimeMessage messageWithHeader: headerMap];
|
|
||||||
|
|
||||||
NSLog (@"sending 'REPLY' from %@ to %@",
|
NSLog (@"sending 'REPLY' from %@ to %@",
|
||||||
[attendee mailAddress], [organizer mailAddress]);
|
[attendee mailAddress], [recipient mailAddress]);
|
||||||
|
|
||||||
/* multipart body */
|
/* multipart body */
|
||||||
body = [[NGMimeMultipartBody alloc] initWithPart: msg];
|
body = [[NGMimeMultipartBody alloc] initWithPart: msg];
|
||||||
|
|
||||||
/* text part */
|
/* text part */
|
||||||
headerMap = [NGMutableHashMap hashMapWithCapacity: 1];
|
headerMap = [NGMutableHashMap hashMapWithCapacity: 1];
|
||||||
[headerMap setObject: @"text/plain; charset=utf-8"
|
[headerMap setObject: @"text/plain; 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];
|
||||||
[bodyPart setBody: bodyData];
|
[bodyPart setBody: bodyData];
|
||||||
|
|
||||||
/* attach text part to multipart body */
|
/* attach text part to multipart body */
|
||||||
[body addBodyPart: bodyPart];
|
[body addBodyPart: bodyPart];
|
||||||
|
|
||||||
/* calendar part */
|
/* calendar part */
|
||||||
headerMap = [NGMutableHashMap hashMapWithCapacity: 1];
|
headerMap = [NGMutableHashMap hashMapWithCapacity: 1];
|
||||||
[headerMap setObject: @"text/calendar; method=REPLY; charset=utf-8"
|
[headerMap setObject: @"text/calendar; method=REPLY; charset=utf-8"
|
||||||
forKey: @"content-type"];
|
forKey: @"content-type"];
|
||||||
bodyPart = [NGMimeBodyPart bodyPartWithHeader: headerMap];
|
bodyPart = [NGMimeBodyPart bodyPartWithHeader: headerMap];
|
||||||
iCalString = [[event parent] versitString];
|
iCalString = [[event parent] versitString];
|
||||||
[bodyPart setBody: [iCalString dataUsingEncoding: NSUTF8StringEncoding]];
|
[bodyPart setBody: [iCalString dataUsingEncoding: NSUTF8StringEncoding]];
|
||||||
|
|
||||||
/* attach calendar part to multipart body */
|
/* attach calendar part to multipart body */
|
||||||
[body addBodyPart: bodyPart];
|
[body addBodyPart: bodyPart];
|
||||||
|
|
||||||
/* 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 = [organizer rfc822Email];
|
email = [recipient rfc822Email];
|
||||||
[[SOGoMailer sharedMailer]
|
[[SOGoMailer sharedMailer]
|
||||||
sendMimePart: msg
|
sendMimePart: msg
|
||||||
toRecipients: [NSArray arrayWithObject: email]
|
toRecipients: [NSArray arrayWithObject: email]
|
||||||
sender: [attendee rfc822Email]];
|
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 a new issue