Monotone-Parent: 2e93af5446f533d239d1daf98838f4049e3256a0

Monotone-Revision: a12bd5b03a0fa8ed21ec4b06e2b7b59ddf2c3ca2

Monotone-Author: wsourdeau@inverse.ca
Monotone-Date: 2008-07-08T15:42:40
Monotone-Branch: ca.inverse.sogo
maint-2.0.2
Wolfgang Sourdeau 2008-07-08 15:42:40 +00:00
parent 1aa527535b
commit 804c05e92d
3 changed files with 96 additions and 23 deletions

View File

@ -1,5 +1,10 @@
2008-07-08 Wolfgang Sourdeau <wsourdeau@inverse.ca>
* SoObjects/Appointments/SOGoAppointmentObject.m
([SOGoAppointmentObject -postCalDAVEventReplyTo:recipients]): new
method that handle CalDAV REPLY posts by updating the event in the
table of the SOGo users and send the reply by email as well.
* SoObjects/Appointments/SOGoCalendarComponent.m
([SOGoCalendarComponent
-sendEMailUsingTemplateNamed:_pageNameforOldObject:_oldObjectandNewObject:_newObjecttoAttendees:_attendees]):

View File

@ -48,6 +48,11 @@
- (NSException *) changeParticipationStatus: (NSString *) _status;
- (void) takeAttendeeStatus: (iCalPerson *) attendee;
- (NSArray *) postCalDAVEventRequestTo: (NSArray *) recipients;
- (NSArray *) postCalDAVEventReplyTo: (NSArray *) recipients;
/* "iCal multifolder saves" */
// - (NSException *) saveContentString: (NSString *) _iCal

View File

@ -415,31 +415,94 @@
event = [self component: NO secure: NO];
recipientsEnum = [recipients objectEnumerator];
while ((recipient = [recipientsEnum nextObject]))
{
if ([[recipient lowercaseString] hasPrefix: @"mailto:"])
{
person = [iCalPerson new];
[person setValue: 0 to: recipient];
uid = [person uid];
if (uid)
[self _addOrUpdateEvent: event forUID: uid];
if ([[recipient lowercaseString] hasPrefix: @"mailto:"])
{
person = [iCalPerson new];
[person setValue: 0 to: recipient];
uid = [person uid];
if (uid)
[self _addOrUpdateEvent: event forUID: uid];
#warning fix this when sendEmailUsing blabla has been cleaned up
[self sendEMailUsingTemplateNamed: @"Invitation"
forOldObject: nil
andNewObject: event
toAttendees: [NSArray arrayWithObject: person]];
[person release];
element = [NSMutableArray new];
[element addObject: davElementWithContent (@"recipient", XMLNS_CALDAV,
recipient)];
[element addObject: davElementWithContent (@"request-status",
XMLNS_CALDAV,
@"2.0;Success")];
[elements addObject: davElementWithContent (@"response", XMLNS_CALDAV,
element)];
[element release];
}
[self sendEMailUsingTemplateNamed: @"Invitation"
forOldObject: nil andNewObject: event
toAttendees: [NSArray arrayWithObject: person]];
[person release];
element = [NSMutableArray new];
[element addObject: davElementWithContent (@"recipient", XMLNS_CALDAV,
recipient)];
[element addObject: davElementWithContent (@"request-status",
XMLNS_CALDAV,
@"2.0;Success")];
[elements addObject: davElementWithContent (@"response", XMLNS_CALDAV,
element)];
[element release];
}
return elements;
}
- (void) takeAttendeeStatus: (iCalPerson *) attendee
{
iCalPerson *localAttendee;
iCalEvent *event;
event = [self component: NO secure: NO];
localAttendee = [event findParticipantWithEmail: [attendee rfc822Email]];
if (localAttendee)
{
[localAttendee setPartStat: [attendee partStat]];
[self saveComponent: event];
}
else
[self errorWithFormat: @"attendee not found: '%@'", attendee];
}
- (NSArray *) postCalDAVEventReplyTo: (NSArray *) recipients
{
NSMutableArray *elements, *element;
NSEnumerator *recipientsEnum;
NSString *recipient, *uid, *eventUID;
iCalEvent *event;
iCalPerson *attendee, *person;
SOGoAppointmentObject *recipientEvent;
SOGoUser *ownerUser;
elements = [NSMutableArray array];
event = [self component: NO secure: NO];
ownerUser = [SOGoUser userWithLogin: owner roles: nil];
attendee = [event findParticipant: ownerUser];
eventUID = [event uid];
recipientsEnum = [recipients objectEnumerator];
while ((recipient = [recipientsEnum nextObject]))
if ([[recipient lowercaseString] hasPrefix: @"mailto:"])
{
person = [iCalPerson new];
[person setValue: 0 to: recipient];
uid = [person uid];
if (uid)
{
recipientEvent = [self _lookupEvent: eventUID forUID: uid];
if ([recipientEvent isNew])
[recipientEvent saveComponent: event];
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]];
[person release];
element = [NSMutableArray new];
[element addObject: davElementWithContent (@"recipient", XMLNS_CALDAV,
recipient)];
[element addObject: davElementWithContent (@"request-status",
XMLNS_CALDAV,
@"2.0;Success")];
[elements addObject: davElementWithContent (@"response", XMLNS_CALDAV,
element)];
[element release];
}
return elements;
}