diff --git a/ChangeLog b/ChangeLog index ea1761356..003b0ee61 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,14 @@ 2008-08-09 Wolfgang Sourdeau + * SoObjects/Appointments/SOGoCalendarComponent.m + ([SOGoCalendarComponent + -sendEMailUsingTemplateNamed:_pageNameforOldObject:_oldObjectandNewObject:_newObjecttoAttendees:_attendees]): + the sender email is always the one of the owner, even though the + action might be done by a delegate. If the case, we setup the + "SENT-BY" parameter of the organizer field. + ([SOGoCalendarComponent -sendResponseToOrganizer]): If needed, + setup the "SENT-BY" parameter of the attendee field. + * UI/Scheduler/UIxComponentEditor.m ([UIxComponentEditor -toolbar]): changed algoritm so that a delegate would really see what the owner would, depending on his/her rights. diff --git a/SoObjects/Appointments/SOGoCalendarComponent.m b/SoObjects/Appointments/SOGoCalendarComponent.m index 592cc7693..25728f14f 100644 --- a/SoObjects/Appointments/SOGoCalendarComponent.m +++ b/SoObjects/Appointments/SOGoCalendarComponent.m @@ -451,6 +451,20 @@ _occurenceHasID (iCalRepeatableEntityObject *occurence, NSString *recID) return [[SOGoUser userWithLogin: uid roles: nil] timeZone]; } +- (void) _setupSentByIfNeeded: (iCalPerson *) person +{ + SOGoUser *currentUser; + NSString *currentEmail; + + currentUser = [context activeUser]; + if (![[currentUser login] isEqualToString: owner]) + { + currentEmail = [[currentUser allEmails] objectAtIndex: 0]; + [person addAttribute: @"SENT-BY" + value: [NSString stringWithFormat: @"MAILTO:%@", currentEmail]]; + } +} + - (void) sendEMailUsingTemplateNamed: (NSString *) _pageName forOldObject: (iCalRepeatableEntityObject *) _oldObject andNewObject: (iCalRepeatableEntityObject *) _newObject @@ -468,7 +482,7 @@ _occurenceHasID (iCalRepeatableEntityObject *occurence, NSString *recID) NGMimeMessage *msg; NGMimeBodyPart *bodyPart; NGMimeMultipartBody *body; - SOGoUser *currentUser; + SOGoUser *ownerUser, *currentUser; if (sendEMailNotifications && [_newObject isStillRelevant]) @@ -477,17 +491,17 @@ _occurenceHasID (iCalRepeatableEntityObject *occurence, NSString *recID) if (count) { /* sender */ + ownerUser = [SOGoUser userWithLogin: owner roles: nil]; currentUser = [context activeUser]; shortSenderEmail = [[currentUser allEmails] objectAtIndex: 0]; senderEmail = [NSString stringWithFormat: @"%@ <%@>", - [currentUser cn], shortSenderEmail]; - - NSLog (@"sending '%@' from %@", - [(iCalCalendar *) [_newObject parent] method], senderEmail); - + [ownerUser cn], shortSenderEmail]; + [self _setupSentByIfNeeded: [_newObject organizer]]; +// NSLog (@"sending '%@' from %@", +// [(iCalCalendar *) [_newObject parent] method], senderEmail); /* generate iCalString once */ iCalString = [[_newObject parent] versitString]; - + /* get WOApplication instance */ app = [WOApplication application]; @@ -502,8 +516,7 @@ _occurenceHasID (iCalRepeatableEntityObject *occurence, NSString *recID) recipient = [attendee mailAddress]; email = [attendee rfc822Email]; - NSLog (@"recipient: %@", recipient); - language = [[context activeUser] language]; + language = [ownerUser language]; #warning this could be optimized in a class hierarchy common with the \ SOGoObject acl notification mechanism /* create page name */ @@ -676,6 +689,7 @@ _occurenceHasID (iCalRepeatableEntityObject *occurence, NSString *recID) { organizer = [event organizer]; attendee = [event findParticipant: ownerUser]; + [self _setupSentByIfNeeded: attendee]; [event setAttendees: [NSArray arrayWithObject: attendee]]; [self sendIMIPReplyForEvent: event to: organizer]; }