From 401c6c8ae27f9571de33a07eefa16abe7a7dba32 Mon Sep 17 00:00:00 2001 From: Wolfgang Sourdeau Date: Wed, 15 Aug 2007 20:13:41 +0000 Subject: [PATCH] Monotone-Parent: 1be5732f06e2d40958dabf3dc0142cabc8ac4a21 Monotone-Revision: 052d83040e0d4ee5456c2ee8ef81f588178b384b Monotone-Author: wsourdeau@inverse.ca Monotone-Date: 2007-08-15T20:13:41 Monotone-Branch: ca.inverse.sogo --- SoObjects/Appointments/SOGoAppointmentFolder.m | 3 ++- SoObjects/Appointments/SOGoCalendarComponent.m | 2 -- UI/MailPartViewers/UIxMailPartICalViewer.m | 9 +++++++-- UI/SOGoUI/SOGoACLAdvisory.m | 14 +++++++++++--- UI/Scheduler/UIxCalView.m | 17 +++++++---------- UI/Scheduler/UIxComponentEditor.m | 4 +++- 6 files changed, 30 insertions(+), 19 deletions(-) diff --git a/SoObjects/Appointments/SOGoAppointmentFolder.m b/SoObjects/Appointments/SOGoAppointmentFolder.m index 7e0c0e6dc..5e7955a7e 100644 --- a/SoObjects/Appointments/SOGoAppointmentFolder.m +++ b/SoObjects/Appointments/SOGoAppointmentFolder.m @@ -746,7 +746,8 @@ static NSNumber *sharedYes = nil; privacySqlString = @"and (c_isopaque = 1)"; else { - email = [activeUser primaryEmail]; +#warning we do not manage all the user's possible emails + email = [[activeUser primaryIdentity] objectForKey: @"email"]; privacySqlString = [NSString stringWithFormat: diff --git a/SoObjects/Appointments/SOGoCalendarComponent.m b/SoObjects/Appointments/SOGoCalendarComponent.m index 808275d36..be754cf65 100644 --- a/SoObjects/Appointments/SOGoCalendarComponent.m +++ b/SoObjects/Appointments/SOGoCalendarComponent.m @@ -274,14 +274,12 @@ static BOOL sendEMailNotifications = NO; iCalPerson *person; NSString *newContent; NSException *ex; - NSString *myEMail; ex = nil; component = [self component: NO]; if (component) { - myEMail = [[context activeUser] primaryEmail]; person = [self findParticipantWithUID: owner]; if (person) { diff --git a/UI/MailPartViewers/UIxMailPartICalViewer.m b/UI/MailPartViewers/UIxMailPartICalViewer.m index 600a473ad..6e7a690c8 100644 --- a/UI/MailPartViewers/UIxMailPartICalViewer.m +++ b/UI/MailPartViewers/UIxMailPartICalViewer.m @@ -252,8 +252,13 @@ /* organizer tracking */ -- (NSString *)loggedInUserEMail { - return [[[self context] activeUser] primaryEmail]; +- (NSString *) loggedInUserEMail +{ + NSDictionary *identity; + + identity = [[context activeUser] primaryIdentity]; + + return [identity objectForKey: @"email"]; } - (iCalEvent *)authorativeEvent { diff --git a/UI/SOGoUI/SOGoACLAdvisory.m b/UI/SOGoUI/SOGoACLAdvisory.m index aefddbdd2..31b42ad6c 100644 --- a/UI/SOGoUI/SOGoACLAdvisory.m +++ b/UI/SOGoUI/SOGoACLAdvisory.m @@ -176,13 +176,21 @@ NGMimeMessage *message; NGMimeMultipartBody *body; SOGoUser *activeUser; + NSDictionary *identity; + NSString *from, *fullMail; activeUser = [context activeUser]; - recipient = [[LDAPUserManager sharedUserManager] getFullEmailForUID: recipientUID]; + identity = [activeUser primaryIdentity]; + from = [identity objectForKey: @"email"]; + fullMail = [NSString stringWithFormat: @"%@ <%@>", + [identity objectForKey: @"fullName"], from]; + + recipient = [[LDAPUserManager sharedUserManager] + getFullEmailForUID: recipientUID]; headerMap = [NGMutableHashMap hashMapWithCapacity: 5]; [headerMap setObject: @"multipart/alternative" forKey: @"content-type"]; - [headerMap setObject: [activeUser fullEmail] forKey: @"From"]; + [headerMap setObject: fullMail forKey: @"From"]; [headerMap setObject: recipient forKey: @"To"]; date = [[NSCalendarDate date] rfc822DateString]; [headerMap setObject: date forKey: @"Date"]; @@ -197,7 +205,7 @@ [[SOGoMailer sharedMailer] sendMimePart: message toRecipients: [NSArray arrayWithObject: recipient] - sender: [activeUser primaryEmail]]; + sender: from]; } @end diff --git a/UI/Scheduler/UIxCalView.m b/UI/Scheduler/UIxCalView.m index fd5b0f244..62fb66fe1 100644 --- a/UI/Scheduler/UIxCalView.m +++ b/UI/Scheduler/UIxCalView.m @@ -100,23 +100,20 @@ static BOOL shouldDisplayWeekend = NO; - (NSArray *) filterAppointments:(NSArray *) _apts { NSMutableArray *filtered; - unsigned i, count; - NSString *email; - NSDictionary *info; - NSArray *partmails; - unsigned p, pCount; + unsigned i, count, p, pCount; + NSString *email, *partmailsString, *state, *pEmail; + NSDictionary *info, *primaryIdentity; + NSArray *partmails, *partstates; BOOL shouldAdd; - NSString *partmailsString; - NSArray *partstates; - NSString *state; - NSString *pEmail; if ([self shouldDisplayRejectedAppointments]) return _apts; { count = [_apts count]; filtered = [[[NSMutableArray alloc] initWithCapacity: count] autorelease]; - email = [[context activeUser] primaryEmail]; + + primaryIdentity = [[context activeUser] primaryIdentity]; + email = [primaryIdentity objectForKey: @"email"]; for (i = 0; i < count; i++) { diff --git a/UI/Scheduler/UIxComponentEditor.m b/UI/Scheduler/UIxComponentEditor.m index 08ef20929..cec6bbd1a 100644 --- a/UI/Scheduler/UIxComponentEditor.m +++ b/UI/Scheduler/UIxComponentEditor.m @@ -783,6 +783,7 @@ { NSString *organizerEmail; SOGoUser *activeUser; + NSDictionary *primaryIdentity; organizerEmail = [[component organizer] email]; if ([organizerEmail length] == 0) @@ -791,8 +792,9 @@ { ASSIGN (organizer, [iCalPerson elementWithTag: @"organizer"]); activeUser = [context activeUser]; + primaryIdentity = [activeUser primaryIdentity]; [organizer setCn: [activeUser cn]]; - [organizer setEmail: [activeUser primaryEmail]]; + [organizer setEmail: [primaryIdentity objectForKey: @"email"]]; [component setOrganizer: organizer]; } }