merge of '305966069ea6e632bec9f09e6fd85e54295efb03'

and '4919aeeff629dcb3750bd1e1f28cf06348a5da02'

Monotone-Parent: 305966069ea6e632bec9f09e6fd85e54295efb03
Monotone-Parent: 4919aeeff629dcb3750bd1e1f28cf06348a5da02
Monotone-Revision: 1ffb41682368b46b7d5dfbe50eb430e0859f6837

Monotone-Author: wsourdeau@inverse.ca
Monotone-Date: 2008-07-08T15:46:29
Monotone-Branch: ca.inverse.sogo
This commit is contained in:
Wolfgang Sourdeau
2008-07-08 15:46:29 +00:00
6 changed files with 134 additions and 104 deletions
+17
View File
@@ -1,3 +1,20 @@
2008-07-08 Wolfgang Sourdeau <wsourdeau@inverse.ca>
* SoObjects/Appointments/SOGoAppointmentFolder.m
([SOGoAppointmentFolder
-caldavEventRequest:eventwithContent:iCalStringfrom:originatorto:recipients]):
simplified method since REPLY and REQUEST posts are very similar.
* 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]):
take the current user as originator rather than the object's owner.
2008-07-07 Francis Lachapelle <flachapelle@inverse.ca>
* UI/Contacts/UIxContactFoldersView.m ([WOActionResults
+16 -73
View File
@@ -1732,89 +1732,32 @@ _selectorForProperty (NSString *property)
return responseElement;
}
- (NSDictionary *) _postCalDAVEventRequest: (NSString *) iCalString
withUID: (NSString *) uid
to: (NSArray *) recipients
{
NSString *filename;
SOGoAppointmentObject *apt;
NSDictionary *responseElement;
NSMutableArray *elements;
filename = [NSString stringWithFormat: @"%@.ics", uid];
apt = [SOGoAppointmentObject objectWithName: filename
andContent: iCalString
inContainer: self];
elements = [apt postCalDAVEventRequestTo: recipients];
responseElement = davElementWithContent (@"schedule-response",
XMLNS_CALDAV, elements);
return responseElement;
}
- (NSDictionary *) _postCalDAVEventReply: (iCalEvent *) event
from: (NSString *) originator
{
NSDictionary *responseElement, *attendeeCode;
NSMutableArray *content;
iCalPerson *attendee;
NSException *ex;
SOGoAppointmentObject *apt;
/* this is a fake success status */
apt = [self lookupComponentByUID: [event uid]];
if ([apt isKindOfClass: [SOGoAppointmentObject class]])
{
content = [NSMutableArray new];
[content addObject: davElementWithContent (@"recipient", XMLNS_CALDAV,
originator)];
#warning cleanup: add a method to POST replies from CalDAV from SOGoAppointmentObject
attendee = [event findParticipant: [context activeUser]];
if (attendee)
{
ex = [apt changeParticipationStatus: [attendee partStat]];
if (ex)
attendeeCode = davElementWithContent (@"request-status", XMLNS_CALDAV,
@"3.1;Invalid property value");
else
attendeeCode = davElementWithContent (@"request-status", XMLNS_CALDAV,
@"2.0;Success");
}
else
attendeeCode = davElementWithContent (@"request-status", XMLNS_CALDAV,
@"3.7;Invalid Calendar User");
[content addObject: attendeeCode];
responseElement
= davElementWithContent (@"schedule-response", XMLNS_CALDAV,
davElementWithContent (@"response", XMLNS_CALDAV,
content));
[content release];
}
else
responseElement = nil;
return responseElement;
}
#warning we should merge this code with the code from the iTIP interpreter in MailPartViewer
- (NSDictionary *) caldavEventRequest: (iCalEvent *) event
withContent: (NSString *) iCalString
from: (NSString *) originator
to: (NSArray *) recipients
{
NSDictionary *responseElement;
NSString *method;
NSArray *elements;
NSString *method, *filename;
SOGoAppointmentObject *apt;
filename = [NSString stringWithFormat: @"%@.ics", [event uid]];
apt = [SOGoAppointmentObject objectWithName: filename
andContent: iCalString
inContainer: self];
method = [[event parent] method];
if ([method isEqualToString: @"REQUEST"])
responseElement = [self _postCalDAVEventRequest: iCalString
withUID: [event uid]
to: recipients];
elements = [apt postCalDAVEventRequestTo: recipients];
else if ([method isEqualToString: @"REPLY"])
responseElement = [self _postCalDAVEventReply: event
withUID: [event uid]
from: originator];
elements = [apt postCalDAVEventReplyTo: recipients];
else
elements = nil;
if (elements)
responseElement = davElementWithContent (@"schedule-response",
XMLNS_CALDAV, elements);
else
responseElement = nil;
@@ -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
+86 -23
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;
}
@@ -256,8 +256,7 @@ static BOOL sendEMailNotifications = NO;
toAttendees: (NSArray *) _attendees
{
NSString *pageName;
iCalPerson *organizer;
NSString *email, *sender, *iCalString;
NSString *senderEmail, *shortSenderEmail, *email, *iCalString;
WOApplication *app;
unsigned i, count;
iCalPerson *attendee;
@@ -268,6 +267,7 @@ static BOOL sendEMailNotifications = NO;
NGMimeMessage *msg;
NGMimeBodyPart *bodyPart;
NGMimeMultipartBody *body;
SOGoUser *currentUser;
if (sendEMailNotifications
&& [_newObject isStillRelevant])
@@ -276,11 +276,13 @@ static BOOL sendEMailNotifications = NO;
if (count)
{
/* sender */
organizer = [_newObject organizer];
sender = [organizer mailAddress];
currentUser = [context activeUser];
shortSenderEmail = [[currentUser allEmails] objectAtIndex: 0];
senderEmail = [NSString stringWithFormat: @"%@ <%@>",
[currentUser cn], shortSenderEmail];
NSLog (@"sending '%@' from %@",
[(iCalCalendar *) [_newObject parent] method], organizer);
[(iCalCalendar *) [_newObject parent] method], senderEmail);
/* generate iCalString once */
iCalString = [[_newObject parent] versitString];
@@ -324,7 +326,7 @@ static BOOL sendEMailNotifications = NO;
* so we'll stick with multipart/mixed for the time being.
*/
[headerMap setObject: @"multipart/mixed" forKey: @"content-type"];
[headerMap setObject: sender forKey: @"from"];
[headerMap setObject: senderEmail forKey: @"from"];
[headerMap setObject: recipient forKey: @"to"];
mailDate = [[NSCalendarDate date] rfc822DateString];
[headerMap setObject: mailDate forKey: @"date"];
@@ -364,7 +366,7 @@ static BOOL sendEMailNotifications = NO;
[[SOGoMailer sharedMailer]
sendMimePart: msg
toRecipients: [NSArray arrayWithObject: email]
sender: [organizer rfc822Email]];
sender: shortSenderEmail];
}
}
}
Vendored
+1 -1
View File
@@ -268,7 +268,7 @@ genConfigMake() {
cfgwrite ""
UNAME=`uname`
if [ "X${UNAME}" = "XLinux" ];then
UNAME=`uname -p`
UNAME=`uname -m`
if [ ${UNAME} = x86_64 -o ${UNAME} = sparc64 -o ${UNAME} = ppc64 ];then
cfgwrite "CGS_LIBDIR_NAME:=lib64"
else