See ChangeLog.

Monotone-Parent: ef272f61d0caedee9632010cd4b3ce928a2da43e
Monotone-Revision: 6ed6359462b26ed18e75361bf078fb93cda23519

Monotone-Author: flachapelle@inverse.ca
Monotone-Date: 2012-01-13T17:20:58
maint-2.0.2
Francis Lachapelle 2012-01-13 17:20:58 +00:00
parent 2688dd85d6
commit 0fffe85b9b
6 changed files with 92 additions and 16 deletions

View File

@ -1,3 +1,24 @@
2012-01-13 Francis Lachapelle <flachapelle@inverse.ca>
* SoObjects/Appointments/SOGoAppointmentFolder.m
(-caldavFreeBusyRequestOnRecipient:withUID:andOrganizer:from:to:):
if the recipient is not associated to a user (from an
authentication source), verify if it is a contact (from an
addressbook source). If it is, SOGoFreeBusyObject will take care
of fetching the freebusy information if the contact is associated
to a MS Exchange server.
* SoObjects/Appointments/SOGoFreeBusyObject.m
(-iCalPersonWithUID:): if no user is found from an authentication
source, verify if it matches a contact from an addressbook
source.
(-contentAsStringWithMethod:andUID:andOrganizer:andContact:from:to:):
added new parameter "contactID".
* SoObjects/Appointments/iCalPerson+SOGo.m (-contactIDInContext:):
new method that tries to associated the person's email address to
a contact ID.
2012-01-12 Francis Lachapelle <flachapelle@inverse.ca>
* SoObjects/SOGo/SOGoSource.h (-bindDN, -bindPassword)

View File

@ -1,5 +1,5 @@
/*
Copyright (C) 2007-2011 Inverse inc.
Copyright (C) 2007-2012 Inverse inc.
Copyright (C) 2004-2005 SKYRIX Software AG
This file is part of SOGo.
@ -1820,7 +1820,7 @@ firstInstanceCalendarDateRange: (NGCalendarDateRange *) fir
to: (NSCalendarDate *) to
{
SOGoUser *user;
NSString *login, *calendarData;
NSString *login, *contactId, *calendarData;
SOGoFreeBusyObject *freebusy;
login = [recipient uid];
@ -1833,8 +1833,21 @@ firstInstanceCalendarDateRange: (NGCalendarDateRange *) fir
calendarData = [freebusy contentAsStringWithMethod: @"REPLY"
andUID: uid
andOrganizer: organizer
andContact: nil
from: start to: to];
}
else if ((contactId = [recipient contactIDInContext: context]))
{
user = [context activeUser];
freebusy = [[user homeFolderInContext: context]
freeBusyObject: @"freebusy.ifb"
inContext: context];
calendarData = [freebusy contentAsStringWithMethod: @"REPLY"
andUID: uid
andOrganizer: organizer
andContact: contactId
from: start to: to];
}
else
{
user = nil;
@ -1947,8 +1960,8 @@ firstInstanceCalendarDateRange: (NGCalendarDateRange *) fir
tags = [self caldavFreeBusyRequest: (iCalFreeBusy *) element];
else if ([tag isEqualToString: @"VEVENT"])
tags = [self caldavEventRequest: (iCalEvent *) element
withContent: iCalString
from: originator to: recipients];
withContent: iCalString
from: originator to: recipients];
else
tags = nil;

View File

@ -48,6 +48,7 @@
- (NSString *) contentAsStringWithMethod: (NSString *) method
andUID: (NSString *) uid
andOrganizer: (iCalPerson *) organizer
andContact: (NSString *) contactID
from: (NSCalendarDate *) _startDate
to: (NSCalendarDate *) _endDate;
@ -55,7 +56,7 @@
to: (NSCalendarDate *) _endDate;
- (NSArray *) fetchFreeBusyInfosFrom: (NSCalendarDate *) startDate
to: (NSCalendarDate *) endDate
forUser: (NSString *) uid;
forContact: (NSString *) uid;
@end
#endif /* __Appointments_SOGoFreeBusyObject_H_ */

View File

@ -61,10 +61,20 @@
{
iCalPerson *person;
SOGoUserManager *um;
NSString *domain;
NSDictionary *contactInfos;
NSArray *contacts;
um = [SOGoUserManager sharedUserManager];
contactInfos = [um contactInfosForUserWithUIDorEmail: uid];
if (contactInfos == nil)
{
domain = [[context activeUser] domain];
[um fetchContactsMatching: uid inDomain: domain];
contacts = [um fetchContactsMatching: uid inDomain: domain];
if ([contacts count] == 1)
contactInfos = [contacts lastObject];
}
/* iCal.app compatibility:
- don't add "cn"; */
@ -96,6 +106,7 @@
withMethod: (NSString *) method
andUID: (NSString *) uid
andOrganizer: (iCalPerson *) organizer
andContact: (NSString *) contactID
from: (NSCalendarDate *) _startDate
to: (NSCalendarDate *) _endDate
{
@ -125,7 +136,10 @@
[freebusy setUid: uid];
if (organizer)
[freebusy setOrganizer: organizer];
[freebusy addToAttendees: [self iCalPersonWithUID: login]];
if (contactID)
[freebusy addToAttendees: [self iCalPersonWithUID: contactID]];
else
[freebusy addToAttendees: [self iCalPersonWithUID: login]];
[freebusy setTimeStampAsDate: [NSCalendarDate calendarDate]];
[freebusy setStartDate: _startDate];
[freebusy setEndDate: _endDate];
@ -223,16 +237,19 @@
- (NSString *) contentAsStringWithMethod: (NSString *) method
andUID: (NSString *) UID
andOrganizer: (iCalPerson *) organizer
andContact: (NSString *) contactID
from: (NSCalendarDate *) _startDate
to: (NSCalendarDate *) _endDate
{
NSArray *infos;
infos = [self fetchFreeBusyInfosFrom: _startDate to: _endDate];
infos = [self fetchFreeBusyInfosFrom: _startDate to: _endDate
forContact: contactID];
return [self iCalStringForFreeBusyInfos: infos
withMethod: method
andUID: UID andOrganizer: organizer
andContact: contactID
from: _startDate to: _endDate];
}
@ -241,6 +258,7 @@
{
return [self contentAsStringWithMethod: nil andUID: nil
andOrganizer: nil
andContact: nil
from: _startDate
to: _endDate];
}
@ -251,31 +269,31 @@
* (currently limited to a Microsoft Exchange server with Web Services enabled).
* @param startDate the beginning of the covered period
* @param endDate the ending of the covered period
* @param uid the ID of the user within the current domain
* @param uid the ID of the contact within the current domain
* @return an array of dictionaries containing the start and end dates of each busy period
* @see MSExchangeFreeBusy.m
*/
- (NSArray *) fetchFreeBusyInfosFrom: (NSCalendarDate *) startDate
to: (NSCalendarDate *) endDate
forUser: (NSString *) uid
forContact: (NSString *) uid
{
if ([uid length])
{
SOGoUserManager *um;
NSArray *users;
NSArray *contacts;
NSString *domain, *email;
NSDictionary *user;
NSDictionary *contact;
MSExchangeFreeBusy *exchangeFreeBusy;
NSObject <SOGoDNSource> *source;
um = [SOGoUserManager sharedUserManager];
domain = [[context activeUser] domain];
users = [um fetchContactsMatching: uid inDomain: domain];
if ([users count] == 1)
contacts = [um fetchContactsMatching: uid inDomain: domain];
if ([contacts count] == 1)
{
user = [users lastObject];
email = [user valueForKey: @"c_email"];
source = [user objectForKey: @"source"];
contact = [contacts lastObject];
email = [contact valueForKey: @"c_email"];
source = [contact objectForKey: @"source"];
if ([email length])
{
exchangeFreeBusy = [[MSExchangeFreeBusy alloc] init];

View File

@ -31,6 +31,7 @@
- (NSString *) mailAddress;
- (NSString *) uid;
- (NSString *) contactIDInContext: (WOContext *) context;
- (BOOL) hasSentBy;
- (NSString *) sentBy;

View File

@ -22,6 +22,7 @@
#import <Foundation/NSString.h>
#import <SOGo/SOGoUserManager.h>
#import <NGObjWeb/WOContext+SoObjects.h>
#import "iCalPerson+SOGo.h"
@ -51,6 +52,27 @@ static SOGoUserManager *um = nil;
return [um getUIDForEmail: [self rfc822Email]];
}
- (NSString *) contactIDInContext: (WOContext *) context
{
NSString *domain, *uid;
NSArray *contacts;
NSDictionary *contact;
if (!um)
um = [SOGoUserManager sharedUserManager];
uid = nil;
domain = [[context activeUser] domain];
contacts = [um fetchContactsMatching: [self rfc822Email] inDomain: domain];
if ([contacts count] == 1)
{
contact = [contacts lastObject];
uid = [contact valueForKey: @"c_uid"];
}
return uid;
}
- (BOOL) hasSentBy
{
NSString *mail;