merge of '21357db79071c6bb6bb16eb3c8570464c85cbea9'

and 'f570fda8096334f1267b8f01d59732c4fa9943c6'

Monotone-Parent: 21357db79071c6bb6bb16eb3c8570464c85cbea9
Monotone-Parent: f570fda8096334f1267b8f01d59732c4fa9943c6
Monotone-Revision: 790b33ceff613dad77f7fc62c8319beafc6bf5ad

Monotone-Author: flachapelle@inverse.ca
Monotone-Date: 2008-11-10T19:45:45
Monotone-Branch: ca.inverse.sogo
This commit is contained in:
Francis Lachapelle committed 2008-11-10 19:45:45 +00:00
commit 79a3ff7dff
27 files changed
+266 -45

No files matched your search

@@ -1895,11 +1895,11 @@ static Class sogoAppointmentFolderKlass = Nil;
inContainer: self]; inContainer: self];
method = [[event parent] method]; method = [[event parent] method];
if ([method isEqualToString: @"REQUEST"]) if ([method isEqualToString: @"REQUEST"])
elements = [apt postCalDAVEventRequestTo: recipients]; elements = [apt postCalDAVEventRequestTo: recipients from: originator];
else if ([method isEqualToString: @"REPLY"]) else if ([method isEqualToString: @"REPLY"])
elements = [apt postCalDAVEventReplyTo: recipients]; elements = [apt postCalDAVEventReplyTo: recipients from: originator];
else if ([method isEqualToString: @"CANCEL"]) else if ([method isEqualToString: @"CANCEL"])
elements = [apt postCalDAVEventCancelTo: recipients]; elements = [apt postCalDAVEventCancelTo: recipients from: originator];
else else
elements = nil; elements = nil;
@@ -1970,6 +1970,10 @@ static Class sogoAppointmentFolderKlass = Nil;
if ([cType hasPrefix: @"text/calendar"]) if ([cType hasPrefix: @"text/calendar"])
{ {
originator = [request headerForKey: @"originator"]; originator = [request headerForKey: @"originator"];
if ([[originator lowercaseString] hasPrefix: @"mailto:"])
originator = [originator substringFromIndex: 7];
recipients = [[request headerForKey: @"recipient"] recipients = [[request headerForKey: @"recipient"]
componentsSeparatedByString: @", "]; componentsSeparatedByString: @", "];
obj = [self caldavScheduleRequest: [request contentAsString] obj = [self caldavScheduleRequest: [request contentAsString]
@@ -48,11 +48,11 @@
- (NSException *) changeParticipationStatus: (NSString *) _status; - (NSException *) changeParticipationStatus: (NSString *) _status;
- (void) takeAttendeeStatus: (iCalPerson *) attendee; - (void) takeAttendeeStatus: (iCalPerson *) attendee from: (NSString *) originator;
- (NSArray *) postCalDAVEventRequestTo: (NSArray *) recipients; - (NSArray *) postCalDAVEventRequestTo: (NSArray *) recipients from: (NSString *) originator;
- (NSArray *) postCalDAVEventReplyTo: (NSArray *) recipients; - (NSArray *) postCalDAVEventReplyTo: (NSArray *) recipients from: (NSString *) originator;
- (NSArray *) postCalDAVEventCancelTo: (NSArray *) recipients; - (NSArray *) postCalDAVEventCancelTo: (NSArray *) recipients from: (NSString *) originator;
/* "iCal multifolder saves" */ /* "iCal multifolder saves" */
+79 -14
View File
@@ -362,6 +362,17 @@
[super saveComponent: newEvent]; [super saveComponent: newEvent];
} }
//
// This method is used to update the status of an attendee.
//
// - theOwnerUser is owner of the calendar where the attendee
// participation state has changed.
// - uid is the actual UID of the user for whom we must
// update the calendar event (with the participation change)
//
// This method is called multiple times, in order to update the
// status of the attendee in calendars for the particular event UID.
//
- (NSException *) _updateAttendee: (iCalPerson *) attendee - (NSException *) _updateAttendee: (iCalPerson *) attendee
ownerUser: (SOGoUser *) theOwnerUser ownerUser: (SOGoUser *) theOwnerUser
forEventUID: (NSString *) eventUID forEventUID: (NSString *) eventUID
@@ -409,14 +420,21 @@
return error; return error;
} }
//
// This method is invoked only from the SOGo Web interface.
//
// - theOwnerUser is owner of the calendar where the attendee
// participation state has changed.
//
- (NSException *) _handleAttendee: (iCalPerson *) attendee - (NSException *) _handleAttendee: (iCalPerson *) attendee
ownerUser: (SOGoUser *) theOwnerUser ownerUser: (SOGoUser *) theOwnerUser
statusChange: (NSString *) newStatus statusChange: (NSString *) newStatus
inEvent: (iCalEvent *) event inEvent: (iCalEvent *) event
{ {
NSString *newContent, *currentStatus, *currentUser, *organizerUID; NSString *newContent, *currentStatus, *currentUser, *organizerUID;
NSException *ex;
SOGoUser *ownerUser; SOGoUser *ownerUser;
NSException *ex;
ex = nil; ex = nil;
@@ -442,13 +460,16 @@
newContent = [[event parent] versitString]; newContent = [[event parent] versitString];
ex = [self saveContentString: newContent]; ex = [self saveContentString: newContent];
// If the current user isn't the organizer of the event
// that has just been updated, we update the event and
// send a notification
ownerUser = [SOGoUser userWithLogin: owner roles: nil]; ownerUser = [SOGoUser userWithLogin: owner roles: nil];
if (!(ex || [event userIsOrganizer: ownerUser])) if (!(ex || [event userIsOrganizer: ownerUser]))
{ {
if ([[attendee rsvp] isEqualToString: @"true"] if ([[attendee rsvp] isEqualToString: @"true"]
&& [event isStillRelevant]) && [event isStillRelevant])
[self sendResponseToOrganizer: event]; [self sendResponseToOrganizer: event
from: ownerUser];
organizerUID = [[event organizer] uid]; organizerUID = [[event organizer] uid];
if (organizerUID) if (organizerUID)
@@ -514,6 +535,7 @@
} }
- (NSArray *) postCalDAVEventRequestTo: (NSArray *) recipients - (NSArray *) postCalDAVEventRequestTo: (NSArray *) recipients
from: (NSString *) originator
{ {
NSMutableArray *elements; NSMutableArray *elements;
NSEnumerator *recipientsEnum; NSEnumerator *recipientsEnum;
@@ -546,6 +568,7 @@
} }
- (NSArray *) postCalDAVEventCancelTo: (NSArray *) recipients - (NSArray *) postCalDAVEventCancelTo: (NSArray *) recipients
from: (NSString *) originator
{ {
NSMutableArray *elements; NSMutableArray *elements;
NSEnumerator *recipientsEnum; NSEnumerator *recipientsEnum;
@@ -577,7 +600,19 @@
return elements; return elements;
} }
//
// This method is invoked by CalDAV clients such as
// Mozilla Lightning. We assume the SENT-BY has
// already been added, if required.
//
// It is used to updated the status of an attendee.
// The originator is the actualy owner of the calendar
// where the update took place. The status must then
// be propagated to the organizer and the other attendees.
//
- (void) takeAttendeeStatus: (iCalPerson *) attendee - (void) takeAttendeeStatus: (iCalPerson *) attendee
from: (NSString *) originator
{ {
iCalPerson *localAttendee; iCalPerson *localAttendee;
iCalEvent *event; iCalEvent *event;
@@ -596,15 +631,21 @@
NSString *uid; NSString *uid;
int i; int i;
// We update for the organizer ownerUser = [SOGoUser userWithLogin:[[LDAPUserManager sharedUserManager]
ownerUser = [context activeUser]; getUIDForEmail: originator]
roles: nil];
[self _updateAttendee: attendee // We update the copy of the organizer, only
ownerUser: ownerUser // if it's a local user.
forEventUID: [event uid] #warning add a check for only local users
withSequence: [event sequence] uid = [[event organizer] uid];
forUID: [[SOGoUser userWithLogin: owner roles: nil] login] if (uid)
shouldAddSentBy: NO]; [self _updateAttendee: attendee
ownerUser: ownerUser
forEventUID: [event uid]
withSequence: [event sequence]
forUID: uid
shouldAddSentBy: NO];
attendees = [event attendees]; attendees = [event attendees];
@@ -619,6 +660,12 @@
if (uid) if (uid)
{ {
// We skip the update that correspond to the originator
// since the CalDAV client will already have updated
// the actual event.
if ([ownerUser hasEmail: [att rfc822Email]])
continue;
[self _updateAttendee: attendee [self _updateAttendee: attendee
ownerUser: ownerUser ownerUser: ownerUser
forEventUID: [event uid] forEventUID: [event uid]
@@ -635,6 +682,7 @@
} }
- (NSArray *) postCalDAVEventReplyTo: (NSArray *) recipients - (NSArray *) postCalDAVEventReplyTo: (NSArray *) recipients
from: (NSString *) originator
{ {
NSMutableArray *elements; NSMutableArray *elements;
NSEnumerator *recipientsEnum; NSEnumerator *recipientsEnum;
@@ -643,10 +691,15 @@
iCalPerson *attendee, *person; iCalPerson *attendee, *person;
SOGoAppointmentObject *recipientEvent; SOGoAppointmentObject *recipientEvent;
SOGoUser *ownerUser; SOGoUser *ownerUser;
NSString *email;
elements = [NSMutableArray array]; elements = [NSMutableArray array];
event = [self component: NO secure: NO]; event = [self component: NO secure: NO];
ownerUser = [SOGoUser userWithLogin: owner roles: nil]; //ownerUser = [SOGoUser userWithLogin: owner roles: nil];
ownerUser = [SOGoUser userWithLogin: [[LDAPUserManager sharedUserManager]
getUIDForEmail: originator]
roles: nil];
attendee = [event findParticipant: ownerUser]; attendee = [event findParticipant: ownerUser];
eventUID = [event uid]; eventUID = [event uid];
@@ -663,9 +716,12 @@
if ([recipientEvent isNew]) if ([recipientEvent isNew])
[recipientEvent saveComponent: event]; [recipientEvent saveComponent: event];
else else
[recipientEvent takeAttendeeStatus: attendee]; [recipientEvent takeAttendeeStatus: attendee
from: originator];
} }
[self sendIMIPReplyForEvent: event to: person]; [self sendIMIPReplyForEvent: event
from: ownerUser
to: person];
[person release]; [person release];
[elements [elements
addObject: [self _caldavSuccessCodeWithRecipient: recipient]]; addObject: [self _caldavSuccessCodeWithRecipient: recipient]];
@@ -674,6 +730,9 @@
return elements; return elements;
} }
//
// This method is invoked only from the SOGo Web interface.
//
- (NSException *) changeParticipationStatus: (NSString *) _status - (NSException *) changeParticipationStatus: (NSString *) _status
{ {
iCalEvent *event; iCalEvent *event;
@@ -686,7 +745,13 @@
event = [self component: NO secure: NO]; event = [self component: NO secure: NO];
if (event) if (event)
{ {
// owerUser will actually be the owner of the calendar
// where the participation change on the event has
// actually occured. The particpation change will of
// course be on the attendee that is the owner of the
// calendar where the participation change has occured.
ownerUser = [SOGoUser userWithLogin: owner roles: nil]; ownerUser = [SOGoUser userWithLogin: owner roles: nil];
attendee = [event findParticipant: ownerUser]; attendee = [event findParticipant: ownerUser];
if (attendee) if (attendee)
ex = [self _handleAttendee: attendee ex = [self _handleAttendee: attendee
@@ -1,2 +1,2 @@
<#IsSubject>Gebeurtenis geannuleerd: <#summary/></#IsSubject> <#IsSubject>Gebeurtenis geannuleerd: <#summary/></#IsSubject>
<#IsBody><#organizer/> heeft deze gebeurtenis geannuleerd: « <#summary/> ».</#IsBody> <#IsBody><#organizer/> <#HasSentBy>(sent by <#sentBy/>) </#HasSentBy>heeft deze gebeurtenis geannuleerd: « <#summary/> ».</#IsBody>
@@ -16,3 +16,12 @@ summary: WOString {
value = summary; value = summary;
escapeHTML = NO; escapeHTML = NO;
} }
HasSentBy: WOConditional {
condition = hasSentBy;
}
sentBy: WOString {
value = sentBy;
escapeHTML = NO;
}
@@ -1,2 +1,2 @@
<#IsSubject>Uitnodiging voor gebeurtenis: <#summary/></#IsSubject> <#IsSubject>Uitnodiging voor gebeurtenis: <#summary/></#IsSubject>
<#IsBody><#organizer/> heeft u uitgenodigd voor <#summary/>.</#IsBody> <#IsBody><#organizer/> <#HasSentBy>(sent by <#sentBy/>) </#HasSentBy>heeft u uitgenodigd voor <#summary/>.</#IsBody>
@@ -16,3 +16,12 @@ summary: WOString {
value = summary; value = summary;
escapeHTML = NO; escapeHTML = NO;
} }
HasSentBy: WOConditional {
condition = hasSentBy;
}
sentBy: WOString {
value = sentBy;
escapeHTML = NO;
}
@@ -1,2 +1,2 @@
<#IsSubject>Événement annulé : « <#summary/> »</#IsSubject> <#IsSubject>Événement annulé : « <#summary/> »</#IsSubject>
<#IsBody><#organizer/> a annulé cet événement : « <#summary/> ».</#IsBody> <#IsBody><#organizer/> <#HasSentBy>(envoyé par <#sentBy/>) </#HasSentBy>a annulé cet événement : « <#summary/> ».</#IsBody>
@@ -16,3 +16,12 @@ summary: WOString {
value = summary; value = summary;
escapeHTML = NO; escapeHTML = NO;
} }
HasSentBy: WOConditional {
condition = hasSentBy;
}
sentBy: WOString {
value = sentBy;
escapeHTML = NO;
}
@@ -1,2 +1,2 @@
<#IsSubject>Invitation : <#summary/></#IsSubject> <#IsSubject>Invitation : <#summary/></#IsSubject>
<#IsBody><#organizer/> vous a invité à « <#summary/> ».</#IsBody> <#IsBody><#organizer/> <#HasSentBy>(envoyé par <#sentBy/>) </#HasSentBy>vous a invité à « <#summary/> ».</#IsBody>
@@ -16,3 +16,12 @@ summary: WOString {
value = summary; value = summary;
escapeHTML = NO; escapeHTML = NO;
} }
HasSentBy: WOConditional {
condition = hasSentBy;
}
sentBy: WOString {
value = sentBy;
escapeHTML = NO;
}
@@ -1,2 +1,2 @@
<#IsSubject>Termin abgesagt: <#summary/></#IsSubject> <#IsSubject>Termin abgesagt: <#summary/></#IsSubject>
<#IsBody><#organizer/> hat diesen Termin abgesagt: <#summary/></#IsBody> <#IsBody><#organizer/> <#HasSentBy>(sent by <#sentBy/>) </#HasSentBy>hat diesen Termin abgesagt: <#summary/></#IsBody>
@@ -16,3 +16,12 @@ summary: WOString {
value = summary; value = summary;
escapeHTML = NO; escapeHTML = NO;
} }
HasSentBy: WOConditional {
condition = hasSentBy;
}
sentBy: WOString {
value = sentBy;
escapeHTML = NO;
}
@@ -1,2 +1,2 @@
<#IsSubject>Termineinladung: <#summary/></#IsSubject> <#IsSubject>Termineinladung: <#summary/></#IsSubject>
<#IsBody><#organizer/> hat Sie zu <#summary/> eingeladen.</#IsBody> <#IsBody><#organizer/> <#HasSentBy>(sent by <#sentBy/>) </#HasSentBy>hat Sie zu <#summary/> eingeladen.</#IsBody>
@@ -16,3 +16,12 @@ summary: WOString {
value = summary; value = summary;
escapeHTML = NO; escapeHTML = NO;
} }
HasSentBy: WOConditional {
condition = hasSentBy;
}
sentBy: WOString {
value = sentBy;
escapeHTML = NO;
}
@@ -1,2 +1,2 @@
<#IsSubject>Evento cancellato : " <#summary/> "</#IsSubject> <#IsSubject>Evento cancellato : " <#summary/> "</#IsSubject>
<#IsBody><#organizer/> ha cancellato questo elemento: " <#summary/> ".</#IsBody> <#IsBody><#organizer/> <#HasSentBy>(sent by <#sentBy/>) </#HasSentBy>ha cancellato questo elemento: " <#summary/> ".</#IsBody>
@@ -16,3 +16,12 @@ summary: WOString {
value = summary; value = summary;
escapeHTML = NO; escapeHTML = NO;
} }
HasSentBy: WOConditional {
condition = hasSentBy;
}
sentBy: WOString {
value = sentBy;
escapeHTML = NO;
}
@@ -1,2 +1,2 @@
<#IsSubject>Invito evento: <#summary/></#IsSubject> <#IsSubject>Invito evento: <#summary/></#IsSubject>
<#IsBody>Si è stati invitati da <#organizer> a <#summary/>.</#IsBody> <#IsBody>Si è stati invitati da <#organizer> <#HasSentBy>(sent by <#sentBy/>) </#HasSentBy>a <#summary/>.</#IsBody>
@@ -16,3 +16,12 @@ summary: WOString {
value = summary; value = summary;
escapeHTML = NO; escapeHTML = NO;
} }
HasSentBy: WOConditional {
condition = hasSentBy;
}
sentBy: WOString {
value = sentBy;
escapeHTML = NO;
}
@@ -1,2 +1,2 @@
<#IsSubject>Evento cancelado: <#summary/></#IsSubject> <#IsSubject>Evento cancelado: <#summary/></#IsSubject>
<#IsBody><#organizer/> ha cancelado este evento: « <#summary/> ».</#IsBody> <#IsBody><#organizer/> <#HasSentBy>(sent by <#sentBy/>) </#HasSentBy>ha cancelado este evento: « <#summary/> ».</#IsBody>
@@ -16,3 +16,12 @@ summary: WOString {
value = summary; value = summary;
escapeHTML = NO; escapeHTML = NO;
} }
HasSentBy: WOConditional {
condition = hasSentBy;
}
sentBy: WOString {
value = sentBy;
escapeHTML = NO;
}
@@ -1,2 +1,2 @@
<#IsSubject>Invitación a evento: <#summary/></#IsSubject> <#IsSubject>Invitación a evento: <#summary/></#IsSubject>
<#IsBody><#organizer/> le ha invitado a <#summary/>.</#IsBody> <#IsBody><#organizer/> <#HasSentBy>(sent by <#sentBy/>) </#HasSentBy>le ha invitado a <#summary/>.</#IsBody>
@@ -16,3 +16,12 @@ summary: WOString {
value = summary; value = summary;
escapeHTML = NO; escapeHTML = NO;
} }
HasSentBy: WOConditional {
condition = hasSentBy;
}
sentBy: WOString {
value = sentBy;
escapeHTML = NO;
}
@@ -63,8 +63,10 @@
forObject: (iCalRepeatableEntityObject *) object forObject: (iCalRepeatableEntityObject *) object
toAttendees: (NSArray *) attendees; toAttendees: (NSArray *) attendees;
- (void) sendIMIPReplyForEvent: (iCalRepeatableEntityObject *) event - (void) sendIMIPReplyForEvent: (iCalRepeatableEntityObject *) event
from: (SOGoUser *) from
to: (iCalPerson *) recipient; to: (iCalPerson *) recipient;
- (void) sendResponseToOrganizer: (iCalRepeatableEntityObject *) newComponent; - (void) sendResponseToOrganizer: (iCalRepeatableEntityObject *) newComponent
from: (SOGoUser *) owner;
// - (BOOL) isOrganizerOrOwner: (SOGoUser *) user; // - (BOOL) isOrganizerOrOwner: (SOGoUser *) user;
@@ -583,6 +583,7 @@ _occurenceHasID (iCalRepeatableEntityObject *occurence, NSString *recID)
#warning fix this when sendEmailUsing blabla has been cleaned up #warning fix this when sendEmailUsing blabla has been cleaned up
- (void) sendIMIPReplyForEvent: (iCalRepeatableEntityObject *) event - (void) sendIMIPReplyForEvent: (iCalRepeatableEntityObject *) event
from: (SOGoUser *) from
to: (iCalPerson *) recipient to: (iCalPerson *) recipient
{ {
NSString *pageName, *language, *mailDate, *email; NSString *pageName, *language, *mailDate, *email;
@@ -602,7 +603,8 @@ _occurenceHasID (iCalRepeatableEntityObject *occurence, NSString *recID)
/* get WOApplication instance */ /* get WOApplication instance */
app = [WOApplication application]; app = [WOApplication application];
ownerUser = [SOGoUser userWithLogin: owner roles: nil]; //ownerUser = [SOGoUser userWithLogin: owner roles: nil];
ownerUser = from;
language = [ownerUser language]; language = [ownerUser language];
/* create page name */ /* create page name */
pageName pageName
@@ -672,6 +674,7 @@ _occurenceHasID (iCalRepeatableEntityObject *occurence, NSString *recID)
} }
- (void) sendResponseToOrganizer: (iCalRepeatableEntityObject *) newComponent - (void) sendResponseToOrganizer: (iCalRepeatableEntityObject *) newComponent
from: (SOGoUser *) from
{ {
iCalPerson *organizer, *attendee; iCalPerson *organizer, *attendee;
iCalEvent *event; iCalEvent *event;
@@ -684,7 +687,7 @@ _occurenceHasID (iCalRepeatableEntityObject *occurence, NSString *recID)
organizer = [event organizer]; organizer = [event organizer];
attendee = [event findParticipant: ownerUser]; attendee = [event findParticipant: ownerUser];
[event setAttendees: [NSArray arrayWithObject: attendee]]; [event setAttendees: [NSArray arrayWithObject: attendee]];
[self sendIMIPReplyForEvent: event to: organizer]; [self sendIMIPReplyForEvent: event from: from to: organizer];
} }
} }
+3
View File
@@ -275,10 +275,13 @@ static NSString *uidColumnName = @"c_uid";
[d addEntriesFromDictionary: values]; [d addEntriesFromDictionary: values];
[d setObject: uid forKey: @"uid"]; [d setObject: uid forKey: @"uid"];
#warning reenable when the code to use the SOGoUserManager is finished
#if 0
[[NSDistributedNotificationCenter defaultCenter] [[NSDistributedNotificationCenter defaultCenter]
postNotificationName: ([fieldName isEqualToString: @"c_defaults"] ? @"SOGoUserDefaultsHaveChanged" : @"SOGoUserSettingsHaveChanged") postNotificationName: ([fieldName isEqualToString: @"c_defaults"] ? @"SOGoUserDefaultsHaveChanged" : @"SOGoUserSettingsHaveChanged")
object: nil object: nil
userInfo: d]; userInfo: d];
#endif
[d release]; [d release];
if ([[channel adaptorContext] hasOpenTransaction]) if ([[channel adaptorContext] hasOpenTransaction])
+65 -11
View File
@@ -1,6 +1,6 @@
/* UIxMailPartICalActions.m - this file is part of SOGo /* UIxMailPartICalActions.m - this file is part of SOGo
* *
* Copyright (C) 2007 Inverse inc. * Copyright (C) 2007-2008 Inverse inc.
* *
* Author: Wolfgang Sourdeau <wsourdeau@inverse.ca> * Author: Wolfgang Sourdeau <wsourdeau@inverse.ca>
* *
@@ -36,6 +36,7 @@
#import <NGImap4/NGImap4EnvelopeAddress.h> #import <NGImap4/NGImap4EnvelopeAddress.h>
#import <SoObjects/Appointments/iCalEvent+SOGo.h>
#import <SoObjects/Appointments/iCalPerson+SOGo.h> #import <SoObjects/Appointments/iCalPerson+SOGo.h>
#import <SoObjects/Appointments/SOGoAppointmentObject.h> #import <SoObjects/Appointments/SOGoAppointmentObject.h>
#import <SoObjects/Appointments/SOGoAppointmentFolder.h> #import <SoObjects/Appointments/SOGoAppointmentFolder.h>
@@ -168,16 +169,18 @@
#warning this is code copied from SOGoAppointmentObject... #warning this is code copied from SOGoAppointmentObject...
- (void) _updateAttendee: (iCalPerson *) attendee - (void) _updateAttendee: (iCalPerson *) attendee
withSequence: (NSNumber *) sequence ownerUser: (SOGoUser *) theOwnerUser
andCalUID: (NSString *) calUID forEventUID: (NSString *) eventUID
forUID: (NSString *) uid withSequence: (NSNumber *) sequence
forUID: (NSString *) uid
shouldAddSentBy: (BOOL) b
{ {
SOGoAppointmentObject *eventObject; SOGoAppointmentObject *eventObject;
iCalEvent *event; iCalEvent *event;
iCalPerson *otherAttendee; iCalPerson *otherAttendee;
NSString *iCalString; NSString *iCalString;
eventObject = [self _eventObjectWithUID: calUID eventObject = [self _eventObjectWithUID: eventUID
forUser: [SOGoUser userWithLogin: uid roles: nil]]; forUser: [SOGoUser userWithLogin: uid roles: nil]];
if (![eventObject isNew]) if (![eventObject isNew])
{ {
@@ -185,9 +188,22 @@
if ([[event sequence] compare: sequence] if ([[event sequence] compare: sequence]
== NSOrderedSame) == NSOrderedSame)
{ {
otherAttendee SOGoUser *currentUser;
= [event findParticipantWithEmail: [attendee rfc822Email]];
otherAttendee = [event findParticipant: theOwnerUser];
[otherAttendee setPartStat: [attendee partStat]]; [otherAttendee setPartStat: [attendee partStat]];
// If one has accepted / declined an invitation on behalf of
// the attendee, we add the user to the SENT-BY attribute.
currentUser = [context activeUser];
if (b && ![[currentUser login] isEqualToString: [theOwnerUser login]])
{
NSString *currentEmail;
currentEmail = [[currentUser allEmails] objectAtIndex: 0];
[otherAttendee addAttribute: @"SENT-BY"
value: [NSString stringWithFormat: @"\"MAILTO:%@\"", currentEmail]];
}
iCalString = [[event parent] versitString]; iCalString = [[event parent] versitString];
[eventObject saveContentString: iCalString]; [eventObject saveContentString: iCalString];
} }
@@ -219,12 +235,50 @@
else else
rsvp = nil; rsvp = nil;
[eventObject saveContentString: [calendar versitString]]; [eventObject saveContentString: [calendar versitString]];
if ([rsvp isEqualToString: @"true"]) if ([rsvp isEqualToString: @"true"] &&
[eventObject sendResponseToOrganizer: chosenEvent]; [chosenEvent isStillRelevant])
[eventObject sendResponseToOrganizer: chosenEvent
from: [context activeUser]];
organizerUID = [[chosenEvent organizer] uid]; organizerUID = [[chosenEvent organizer] uid];
if (organizerUID) if (organizerUID)
[self _updateAttendee: user withSequence: [chosenEvent sequence] [self _updateAttendee: user
andCalUID: [chosenEvent uid] forUID: organizerUID]; ownerUser: [context activeUser]
forEventUID: [chosenEvent uid]
withSequence: [chosenEvent sequence]
forUID: organizerUID
shouldAddSentBy: YES];
// We update the calendar of all participants that are
// local to the system. This is useful in case user A accepts
// invitation from organizer B and users C, D, E who are also
// attendees need to verify if A has accepted.
NSArray *attendees;
iCalPerson *att;
NSString *uid;
int i;
attendees = [chosenEvent attendees];
for (i = 0; i < [attendees count]; i++)
{
att = [attendees objectAtIndex: i];
if (att == user) continue;
uid = [[LDAPUserManager sharedUserManager]
getUIDForEmail: [att rfc822Email]];
if (uid)
{
[self _updateAttendee: user
ownerUser: [context activeUser]
forEventUID: [chosenEvent uid]
withSequence: [chosenEvent sequence]
forUID: uid
shouldAddSentBy: YES];
}
}
response = [self responseWith204]; response = [self responseWith204];
} }
else else