merge of '5f06eea4bed0099215d8a10c86ab93337557a176'
and 'dc5bdda4eee483eae805bffa6ff605e9995cd81d' Monotone-Parent: 5f06eea4bed0099215d8a10c86ab93337557a176 Monotone-Parent: dc5bdda4eee483eae805bffa6ff605e9995cd81d Monotone-Revision: 0e8b1704a04c5c494b76cbc377b9d9075df6cb1a Monotone-Author: flachapelle@inverse.ca Monotone-Date: 2009-09-09T21:51:45 Monotone-Branch: ca.inverse.sogomaint-2.0.2
commit
a4d616d19b
17
ChangeLog
17
ChangeLog
|
@ -1,3 +1,14 @@
|
|||
2009-09-09 Wolfgang Sourdeau <wsourdeau@inverse.ca>
|
||||
|
||||
* SoObjects/Appointments/SOGoAppointmentFolder.m
|
||||
(-_getMaxStartDate): do not compute the start date if the active
|
||||
user is a super user.
|
||||
(_enforceTimeLimitOnFilter:withStartDate:andEndDate:): same as
|
||||
above.
|
||||
|
||||
* SoObjects/SOGo/SOGoUser.m (-rolesForObject:inContext:): directly
|
||||
invoke [self isSuperUser]
|
||||
|
||||
2009-09-09 Cyril Robert <crobert@inverse.ca>
|
||||
|
||||
* Tools/NSDictionary+SOGoTool.m: Removed, all methods were moved to
|
||||
|
@ -11,6 +22,12 @@
|
|||
userRecordAsLDIFEntry.
|
||||
* UI/Contacts/UIxContactsListView.m: Removed import/export actions
|
||||
* UI/Scheduler/UIxCalView.m: Removed import/export actions
|
||||
* SoObjects/Contacts/NGVCard+SOGo.m: Added a new category to remove a
|
||||
circular dependency issue.
|
||||
* SoObjects/Contacts/NGVList+SOGo.m: Added a new category to remove a
|
||||
circular dependency issue.
|
||||
* UI/Contacts/UIxContactFolderActions.m: Changed import instructions to use
|
||||
the new category.
|
||||
|
||||
2009-09-03 Cyril Robert <crobert@inverse.ca>
|
||||
|
||||
|
|
|
@ -2,6 +2,8 @@
|
|||
|
||||
* NGVCard.m: Made use of NSDictionary+Utilities' userRecordAsLDIFEntry.
|
||||
* NGVList.m: Made use of NSDictionary+Utilities' userRecordAsLDIFEntry.
|
||||
* NGVCard.m (ldifString): Moved to a category in SOGo
|
||||
* NGVList.m (ldifString): Moved to a category in SOGo
|
||||
|
||||
2009-09-02 Cyril Robert <crobert@inverse.ca>
|
||||
|
||||
|
|
|
@ -157,7 +157,6 @@ typedef enum
|
|||
- (NSString *) preferredEMail;
|
||||
- (NSString *) preferredTel;
|
||||
- (CardElement *) preferredAdr;
|
||||
- (NSString *) ldifString;
|
||||
|
||||
@end
|
||||
|
||||
|
|
|
@ -24,8 +24,6 @@
|
|||
#import <Foundation/NSEnumerator.h>
|
||||
#import <Foundation/NSString.h>
|
||||
|
||||
#import "../../SoObjects/SOGo/NSDictionary+Utilities.h"
|
||||
|
||||
#import "NSArray+NGCards.h"
|
||||
|
||||
#import "NGVCard.h"
|
||||
|
@ -511,109 +509,4 @@
|
|||
return str;
|
||||
}
|
||||
|
||||
|
||||
- (NSString *) ldifString
|
||||
{
|
||||
NSMutableString *rc;
|
||||
NSString *buffer;
|
||||
NSArray *array;
|
||||
NSMutableArray *marray;
|
||||
NSMutableDictionary *entry;
|
||||
id tmp;
|
||||
|
||||
entry = [NSMutableDictionary dictionary];
|
||||
|
||||
[entry setObject: [NSString stringWithFormat: @"cn=%@,mail=%@",
|
||||
[self fn], [self preferredEMail]]
|
||||
forKey: @"dn"];
|
||||
[entry setObject: [NSArray arrayWithObjects: @"top", @"person",
|
||||
@"organizationalPerson", @"inetOrgPerson",
|
||||
@"mozillaAbPersonObsolete", nil]
|
||||
forKey: @"objectclass"];
|
||||
[entry setObject: [[self n] objectAtIndex: 1] forKey: @"givenName"];
|
||||
[entry setObject: [[self n] objectAtIndex: 0] forKey: @"sn"];
|
||||
[entry setObject: [self fn] forKey: @"cn"];
|
||||
[entry setObject: [self preferredEMail] forKey: @"mail"];
|
||||
[entry setObject: @"0Z" forKey: @"modifytimestamp"];
|
||||
|
||||
buffer = [self nickname];
|
||||
if (buffer && [buffer length] > 0)
|
||||
[entry setObject: buffer forKey: @"mozillaNickname"];
|
||||
|
||||
marray = [NSMutableArray arrayWithArray: [self childrenWithTag: @"email"]];
|
||||
[marray removeObjectsInArray: [self childrenWithTag: @"email"
|
||||
andAttribute: @"type"
|
||||
havingValue: @"pref"]];
|
||||
if ([marray count])
|
||||
{
|
||||
buffer = [[marray objectAtIndex: [marray count]-1] value: 0];
|
||||
|
||||
if ([buffer caseInsensitiveCompare: [self preferredEMail]] != NSOrderedSame)
|
||||
[entry setObject: buffer forKey: @"mozillaSecondEmail"];
|
||||
}
|
||||
|
||||
array = [self childrenWithTag: @"tel" andAttribute: @"type" havingValue: @"home"];
|
||||
if ([array count])
|
||||
[entry setObject: [[array objectAtIndex: 0] value: 0] forKey: @"homePhone"];
|
||||
array = [self childrenWithTag: @"tel" andAttribute: @"type" havingValue: @"fax"];
|
||||
if ([array count])
|
||||
[entry setObject: [[array objectAtIndex: 0] value: 0] forKey: @"fax"];
|
||||
array = [self childrenWithTag: @"tel" andAttribute: @"type" havingValue: @"cell"];
|
||||
if ([array count])
|
||||
[entry setObject: [[array objectAtIndex: 0] value: 0] forKey: @"mobile"];
|
||||
array = [self childrenWithTag: @"tel" andAttribute: @"type" havingValue: @"pager"];
|
||||
if ([array count])
|
||||
[entry setObject: [[array objectAtIndex: 0] value: 0] forKey: @"pager"];
|
||||
|
||||
array = [self childrenWithTag: @"adr" andAttribute: @"type" havingValue: @"home"];
|
||||
if ([array count])
|
||||
{
|
||||
tmp = [array objectAtIndex: 0];
|
||||
[entry setObject: [tmp value: 0] forKey: @"homeStreet"];
|
||||
[entry setObject: [tmp value: 1] forKey: @"mozillaHomeLocalityName"];
|
||||
[entry setObject: [tmp value: 2] forKey: @"mozillaHomeState"];
|
||||
[entry setObject: [tmp value: 3] forKey: @"mozillaHomePostalCode"];
|
||||
[entry setObject: [tmp value: 4] forKey: @"mozillaHomeCountryName"];
|
||||
}
|
||||
|
||||
array = [self org];
|
||||
if (array && [array count])
|
||||
[entry setObject: [array objectAtIndex: 0] forKey: @"o"];
|
||||
|
||||
array = [self childrenWithTag: @"adr" andAttribute: @"type" havingValue: @"work"];
|
||||
if ([array count])
|
||||
{
|
||||
tmp = [array objectAtIndex: 0];
|
||||
[entry setObject: [tmp value: 0] forKey: @"street"];
|
||||
[entry setObject: [tmp value: 1] forKey: @"l"];
|
||||
[entry setObject: [tmp value: 2] forKey: @"st"];
|
||||
[entry setObject: [tmp value: 3] forKey: @"postalCode"];
|
||||
[entry setObject: [tmp value: 4] forKey: @"c"];
|
||||
}
|
||||
|
||||
array = [self childrenWithTag: @"tel" andAttribute: @"type" havingValue: @"work"];
|
||||
if ([array count])
|
||||
[entry setObject: [[array objectAtIndex: 0] value: 0]
|
||||
forKey: @"telephoneNumber"];
|
||||
|
||||
array = [self childrenWithTag: @"url" andAttribute: @"type" havingValue: @"work"];
|
||||
if ([array count])
|
||||
[entry setObject: [[array objectAtIndex: 0] value: 0]
|
||||
forKey: @"workurl"];
|
||||
|
||||
array = [self childrenWithTag: @"url" andAttribute: @"type" havingValue: @"home"];
|
||||
if ([array count])
|
||||
[entry setObject: [[array objectAtIndex: 0] value: 0]
|
||||
forKey: @"homeurl"];
|
||||
|
||||
tmp = [self note];
|
||||
if (tmp && [tmp length])
|
||||
[entry setObject: tmp forKey: @"description"];
|
||||
|
||||
rc = [NSMutableString stringWithString: [entry userRecordAsLDIFEntry]];
|
||||
[rc appendFormat: @"\n"];
|
||||
|
||||
return rc;
|
||||
}
|
||||
|
||||
@end /* NGVCard */
|
||||
|
|
|
@ -64,8 +64,6 @@
|
|||
- (void) deleteCardReference: (NGVCardReference *) cardRef;
|
||||
- (NSArray *) cardReferences;
|
||||
|
||||
- (NSString *) ldifString;
|
||||
|
||||
@end
|
||||
|
||||
#endif /* NGVLIST_H */
|
||||
|
|
|
@ -25,8 +25,6 @@
|
|||
#import <Foundation/NSString.h>
|
||||
#import <Foundation/NSDictionary.h>
|
||||
|
||||
#import "../../SoObjects/SOGo/NSDictionary+Utilities.h"
|
||||
|
||||
#import "NGVCardReference.h"
|
||||
|
||||
#import "NGVList.h"
|
||||
|
@ -200,43 +198,4 @@
|
|||
return [self childrenWithTag: @"card"];
|
||||
}
|
||||
|
||||
- (NSString *) ldifString
|
||||
{
|
||||
NSMutableString *rc;
|
||||
NSArray *array;
|
||||
NSMutableArray *members;
|
||||
NGVCardReference *tmp;
|
||||
NSMutableDictionary *entry;
|
||||
int i, count;
|
||||
|
||||
entry = [NSMutableDictionary dictionary];
|
||||
|
||||
[entry setObject: [NSString stringWithFormat: @"cn=%@", [self fn]]
|
||||
forKey: @"dn"];
|
||||
[entry setObject: [NSArray arrayWithObjects: @"top", @"groupOfNames", nil]
|
||||
forKey: @"objectclass"];
|
||||
[entry setObject: [self fn] forKey: @"cn"];
|
||||
if ([self nickname])
|
||||
[entry setObject: [self nickname] forKey: @"mozillaNickname"];
|
||||
if ([self description])
|
||||
[entry setObject: [self description] forKey: @"description"];
|
||||
|
||||
array = [self cardReferences];
|
||||
count = [array count];
|
||||
members = [NSMutableArray array];
|
||||
for (i = 0; i < count; i++)
|
||||
{
|
||||
tmp = [array objectAtIndex: i];
|
||||
[members addObject: [NSString stringWithFormat:
|
||||
@"cn=%@,mail=%@", [tmp fn], [tmp email]]];
|
||||
}
|
||||
[entry setObject: members forKey: @"member"];
|
||||
|
||||
rc = [NSMutableString stringWithString: [entry userRecordAsLDIFEntry]];
|
||||
[rc appendFormat: @"\n"];
|
||||
|
||||
return rc;
|
||||
}
|
||||
|
||||
|
||||
@end
|
||||
|
|
|
@ -81,7 +81,8 @@
|
|||
|
||||
static NGLogger *logger = nil;
|
||||
static NSNumber *sharedYes = nil;
|
||||
static int davCalendarStartTimeLimit = 0;
|
||||
static int davCalendarStartTimeLimit, davTimeLimitSeconds,
|
||||
davTimeHalfLimitSeconds;
|
||||
|
||||
+ (void) initialize
|
||||
{
|
||||
|
@ -107,6 +108,10 @@ static int davCalendarStartTimeLimit = 0;
|
|||
ud = [NSUserDefaults standardUserDefaults];
|
||||
davCalendarStartTimeLimit
|
||||
= [ud integerForKey: @"SOGoDAVCalendarStartTimeLimit"];
|
||||
davTimeLimitSeconds = davCalendarStartTimeLimit * 86400;
|
||||
/* 86400 / 2 = 43200. We hardcode that value in order to avoid
|
||||
integer and float confusion. */
|
||||
davTimeHalfLimitSeconds = davCalendarStartTimeLimit * 43200;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1350,12 +1355,12 @@ firstInstanceCalendarDateRange: (NGCalendarDateRange *) fir
|
|||
|
||||
- (NSCalendarDate *) _getMaxStartDate
|
||||
{
|
||||
NSCalendarDate *tmp, *rc;
|
||||
NSCalendarDate *now, *rc;
|
||||
|
||||
if (davCalendarStartTimeLimit > 0)
|
||||
if (davCalendarStartTimeLimit > 0 && ![[context activeUser] isSuperUser])
|
||||
{
|
||||
tmp = [NSCalendarDate date];
|
||||
rc = [tmp addTimeInterval: davCalendarStartTimeLimit * -86400];
|
||||
now = [NSCalendarDate date];
|
||||
rc = [now addTimeInterval: -davTimeLimitSeconds];
|
||||
}
|
||||
else
|
||||
rc = nil;
|
||||
|
@ -1364,42 +1369,44 @@ firstInstanceCalendarDateRange: (NGCalendarDateRange *) fir
|
|||
}
|
||||
|
||||
- (void) _enforceTimeLimitOnFilter: (NSMutableDictionary *) filter
|
||||
withStartDate: (NSCalendarDate *) startDate
|
||||
andEndDate: (NSCalendarDate *) endDate
|
||||
{
|
||||
NSCalendarDate *start, *end, *now;
|
||||
NSCalendarDate *now;
|
||||
int interval, intervalStart, intervalEnd;
|
||||
|
||||
start = [filter objectForKey: @"start"];
|
||||
end = [filter objectForKey: @"end"];
|
||||
now = [NSCalendarDate date];
|
||||
interval = ([end timeIntervalSinceDate: start] / 86400);
|
||||
|
||||
if (davCalendarStartTimeLimit > 0 && interval > davCalendarStartTimeLimit)
|
||||
if (davCalendarStartTimeLimit > 0 && ![[context activeUser] isSuperUser])
|
||||
{
|
||||
if ([now compare: start] == NSOrderedDescending
|
||||
&& [now compare: end] == NSOrderedAscending)
|
||||
interval = ([endDate timeIntervalSinceDate: startDate] / 86400);
|
||||
if (interval > davCalendarStartTimeLimit)
|
||||
{
|
||||
intervalStart = [now timeIntervalSinceDate: start] / 86400;
|
||||
intervalEnd = [end timeIntervalSinceDate: now] / 86400;
|
||||
if (intervalStart > davCalendarStartTimeLimit / 2)
|
||||
now = [NSCalendarDate date];
|
||||
if ([now compare: startDate] == NSOrderedDescending
|
||||
&& [now compare: endDate] == NSOrderedAscending)
|
||||
{
|
||||
start = [now addTimeInterval: (davCalendarStartTimeLimit / 2) * -86400];
|
||||
[filter setObject: start forKey: @"start"];
|
||||
intervalStart = [now timeIntervalSinceDate: startDate] / 86400;
|
||||
intervalEnd = [endDate timeIntervalSinceDate: now] / 86400;
|
||||
if (intervalStart > davCalendarStartTimeLimit / 2)
|
||||
{
|
||||
startDate = [now addTimeInterval: -davTimeHalfLimitSeconds];
|
||||
[filter setObject: startDate forKey: @"start"];
|
||||
}
|
||||
if (intervalEnd > davCalendarStartTimeLimit / 2)
|
||||
{
|
||||
endDate = [now addTimeInterval: davTimeHalfLimitSeconds];
|
||||
[filter setObject: endDate forKey: @"end"];
|
||||
}
|
||||
}
|
||||
if (intervalEnd > davCalendarStartTimeLimit / 2)
|
||||
else if ([now compare: endDate] == NSOrderedDescending)
|
||||
{
|
||||
end = [now addTimeInterval: (davCalendarStartTimeLimit / 2) * 86400];
|
||||
[filter setObject: end forKey: @"end"];
|
||||
startDate = [endDate addTimeInterval: -davTimeLimitSeconds];
|
||||
[filter setObject: startDate forKey: @"start"];
|
||||
}
|
||||
else if ([now compare: startDate] == NSOrderedAscending)
|
||||
{
|
||||
endDate = [startDate addTimeInterval: davTimeLimitSeconds];
|
||||
[filter setObject: endDate forKey: @"end"];
|
||||
}
|
||||
}
|
||||
else if ([now compare: end] == NSOrderedDescending)
|
||||
{
|
||||
start = [end addTimeInterval: davCalendarStartTimeLimit * -86400];
|
||||
[filter setObject: start forKey: @"start"];
|
||||
}
|
||||
else if ([now compare: start] == NSOrderedAscending)
|
||||
{
|
||||
end = [start addTimeInterval: davCalendarStartTimeLimit * 86400];
|
||||
[filter setObject: end forKey: @"end"];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1407,30 +1414,30 @@ firstInstanceCalendarDateRange: (NGCalendarDateRange *) fir
|
|||
- (void) _appendTimeRange: (id <DOMElement>) timeRangeElement
|
||||
toFilter: (NSMutableDictionary *) filter
|
||||
{
|
||||
NSCalendarDate *parsedDate;
|
||||
NSCalendarDate *startDate, *endDate;
|
||||
|
||||
parsedDate = [[timeRangeElement attribute: @"start"] asCalendarDate];
|
||||
if (!parsedDate)
|
||||
parsedDate = [NSCalendarDate distantPast];
|
||||
[filter setObject: parsedDate forKey: @"start"];
|
||||
parsedDate = [[timeRangeElement attribute: @"end"] asCalendarDate];
|
||||
if (!parsedDate)
|
||||
parsedDate = [NSCalendarDate distantFuture];
|
||||
[filter setObject: parsedDate forKey: @"end"];
|
||||
startDate = [[timeRangeElement attribute: @"start"] asCalendarDate];
|
||||
if (!startDate)
|
||||
startDate = [NSCalendarDate distantPast];
|
||||
[filter setObject: startDate forKey: @"start"];
|
||||
|
||||
[self _enforceTimeLimitOnFilter: filter];
|
||||
endDate = [[timeRangeElement attribute: @"end"] asCalendarDate];
|
||||
if (!endDate)
|
||||
endDate = [NSCalendarDate distantFuture];
|
||||
[filter setObject: endDate forKey: @"end"];
|
||||
|
||||
[self _enforceTimeLimitOnFilter: filter
|
||||
withStartDate: startDate andEndDate: endDate];
|
||||
}
|
||||
|
||||
- (void) _addDateRangeLimitToFilter: (NSMutableDictionary *) filter
|
||||
{
|
||||
NSCalendarDate *now;
|
||||
NSTimeInterval rangeLimit;
|
||||
|
||||
now = [NSCalendarDate date];
|
||||
rangeLimit = (davCalendarStartTimeLimit / 2) * -86400;
|
||||
[filter setObject: [now addTimeInterval: rangeLimit]
|
||||
[filter setObject: [now addTimeInterval: davTimeHalfLimitSeconds]
|
||||
forKey: @"start"];
|
||||
[filter setObject: [now addTimeInterval: rangeLimit * -1]
|
||||
[filter setObject: [now addTimeInterval: -davTimeHalfLimitSeconds]
|
||||
forKey: @"end"];
|
||||
}
|
||||
|
||||
|
|
|
@ -9,6 +9,8 @@ Contacts_PRINCIPAL_CLASS = SOGoContactsProduct
|
|||
|
||||
Contacts_OBJC_FILES = \
|
||||
Product.m \
|
||||
NGVCard+SOGo.m \
|
||||
NGVList+SOGo.m \
|
||||
SOGoFolder+CardDAV.m \
|
||||
SOGoContactFolders.m \
|
||||
SOGoContactGCSEntry.m \
|
||||
|
|
|
@ -0,0 +1,34 @@
|
|||
/* NGVCard+SOGo.h - this file is part of SOGo
|
||||
*
|
||||
* Copyright (C) 2009 Inverse inc.
|
||||
*
|
||||
* Author: Cyril Robert <crobert@inverse.ca>
|
||||
*
|
||||
* This file is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2, or (at your option)
|
||||
* any later version.
|
||||
*
|
||||
* This file is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; see the file COPYING. If not, write to
|
||||
* the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
|
||||
* Boston, MA 02111-1307, USA.
|
||||
*/
|
||||
|
||||
#ifndef NGVCARD_SOGO_H
|
||||
#define NGVCARD_SOGO_H
|
||||
|
||||
#import <NGCards/NGVCard.h>
|
||||
|
||||
@interface NGVCard (SOGoExtensions)
|
||||
|
||||
- (NSString *) ldifString;
|
||||
|
||||
@end
|
||||
|
||||
#endif /* NGVCARD_SOGO_H */
|
|
@ -0,0 +1,137 @@
|
|||
/* NGVCard+SOGo.m - this file is part of SOGo
|
||||
*
|
||||
* Copyright (C) 2009 Inverse inc.
|
||||
*
|
||||
* Author: Cyril Robert <crobert@inverse.ca>
|
||||
*
|
||||
* This file is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2, or (at your option)
|
||||
* any later version.
|
||||
*
|
||||
* This file is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; see the file COPYING. If not, write to
|
||||
* the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
|
||||
* Boston, MA 02111-1307, USA.
|
||||
*/
|
||||
|
||||
#import <Foundation/NSArray.h>
|
||||
#import <Foundation/NSDictionary.h>
|
||||
#import <Foundation/NSEnumerator.h>
|
||||
#import <Foundation/NSString.h>
|
||||
|
||||
#import <SOGo/NSDictionary+Utilities.h>
|
||||
#import "NGVCard+SOGo.h"
|
||||
|
||||
@implementation NGVCard (SOGoExtensions)
|
||||
|
||||
- (NSString *) ldifString
|
||||
{
|
||||
NSMutableString *rc;
|
||||
NSString *buffer;
|
||||
NSArray *array;
|
||||
NSMutableArray *marray;
|
||||
NSMutableDictionary *entry;
|
||||
id tmp;
|
||||
|
||||
entry = [NSMutableDictionary dictionary];
|
||||
|
||||
[entry setObject: [NSString stringWithFormat: @"cn=%@,mail=%@",
|
||||
[self fn], [self preferredEMail]]
|
||||
forKey: @"dn"];
|
||||
[entry setObject: [NSArray arrayWithObjects: @"top", @"person",
|
||||
@"organizationalPerson", @"inetOrgPerson",
|
||||
@"mozillaAbPersonObsolete", nil]
|
||||
forKey: @"objectclass"];
|
||||
[entry setObject: [[self n] objectAtIndex: 1] forKey: @"givenName"];
|
||||
[entry setObject: [[self n] objectAtIndex: 0] forKey: @"sn"];
|
||||
[entry setObject: [self fn] forKey: @"cn"];
|
||||
[entry setObject: [self preferredEMail] forKey: @"mail"];
|
||||
[entry setObject: @"0Z" forKey: @"modifytimestamp"];
|
||||
|
||||
buffer = [self nickname];
|
||||
if (buffer && [buffer length] > 0)
|
||||
[entry setObject: buffer forKey: @"mozillaNickname"];
|
||||
|
||||
marray = [NSMutableArray arrayWithArray: [self childrenWithTag: @"email"]];
|
||||
[marray removeObjectsInArray: [self childrenWithTag: @"email"
|
||||
andAttribute: @"type"
|
||||
havingValue: @"pref"]];
|
||||
if ([marray count])
|
||||
{
|
||||
buffer = [[marray objectAtIndex: [marray count]-1] value: 0];
|
||||
|
||||
if ([buffer caseInsensitiveCompare: [self preferredEMail]] != NSOrderedSame)
|
||||
[entry setObject: buffer forKey: @"mozillaSecondEmail"];
|
||||
}
|
||||
|
||||
array = [self childrenWithTag: @"tel" andAttribute: @"type" havingValue: @"home"];
|
||||
if ([array count])
|
||||
[entry setObject: [[array objectAtIndex: 0] value: 0] forKey: @"homePhone"];
|
||||
array = [self childrenWithTag: @"tel" andAttribute: @"type" havingValue: @"fax"];
|
||||
if ([array count])
|
||||
[entry setObject: [[array objectAtIndex: 0] value: 0] forKey: @"fax"];
|
||||
array = [self childrenWithTag: @"tel" andAttribute: @"type" havingValue: @"cell"];
|
||||
if ([array count])
|
||||
[entry setObject: [[array objectAtIndex: 0] value: 0] forKey: @"mobile"];
|
||||
array = [self childrenWithTag: @"tel" andAttribute: @"type" havingValue: @"pager"];
|
||||
if ([array count])
|
||||
[entry setObject: [[array objectAtIndex: 0] value: 0] forKey: @"pager"];
|
||||
|
||||
array = [self childrenWithTag: @"adr" andAttribute: @"type" havingValue: @"home"];
|
||||
if ([array count])
|
||||
{
|
||||
tmp = [array objectAtIndex: 0];
|
||||
[entry setObject: [tmp value: 0] forKey: @"homeStreet"];
|
||||
[entry setObject: [tmp value: 1] forKey: @"mozillaHomeLocalityName"];
|
||||
[entry setObject: [tmp value: 2] forKey: @"mozillaHomeState"];
|
||||
[entry setObject: [tmp value: 3] forKey: @"mozillaHomePostalCode"];
|
||||
[entry setObject: [tmp value: 4] forKey: @"mozillaHomeCountryName"];
|
||||
}
|
||||
|
||||
array = [self org];
|
||||
if (array && [array count])
|
||||
[entry setObject: [array objectAtIndex: 0] forKey: @"o"];
|
||||
|
||||
array = [self childrenWithTag: @"adr" andAttribute: @"type" havingValue: @"work"];
|
||||
if ([array count])
|
||||
{
|
||||
tmp = [array objectAtIndex: 0];
|
||||
[entry setObject: [tmp value: 0] forKey: @"street"];
|
||||
[entry setObject: [tmp value: 1] forKey: @"l"];
|
||||
[entry setObject: [tmp value: 2] forKey: @"st"];
|
||||
[entry setObject: [tmp value: 3] forKey: @"postalCode"];
|
||||
[entry setObject: [tmp value: 4] forKey: @"c"];
|
||||
}
|
||||
|
||||
array = [self childrenWithTag: @"tel" andAttribute: @"type" havingValue: @"work"];
|
||||
if ([array count])
|
||||
[entry setObject: [[array objectAtIndex: 0] value: 0]
|
||||
forKey: @"telephoneNumber"];
|
||||
|
||||
array = [self childrenWithTag: @"url" andAttribute: @"type" havingValue: @"work"];
|
||||
if ([array count])
|
||||
[entry setObject: [[array objectAtIndex: 0] value: 0]
|
||||
forKey: @"workurl"];
|
||||
|
||||
array = [self childrenWithTag: @"url" andAttribute: @"type" havingValue: @"home"];
|
||||
if ([array count])
|
||||
[entry setObject: [[array objectAtIndex: 0] value: 0]
|
||||
forKey: @"homeurl"];
|
||||
|
||||
tmp = [self note];
|
||||
if (tmp && [tmp length])
|
||||
[entry setObject: tmp forKey: @"description"];
|
||||
|
||||
rc = [NSMutableString stringWithString: [entry userRecordAsLDIFEntry]];
|
||||
[rc appendFormat: @"\n"];
|
||||
|
||||
return rc;
|
||||
}
|
||||
|
||||
@end /* NGVCard */
|
|
@ -0,0 +1,34 @@
|
|||
/* NGVCard+SOGo.h - this file is part of SOGo
|
||||
*
|
||||
* Copyright (C) 2009 Inverse inc.
|
||||
*
|
||||
* Author: Cyril Robert <crobert@inverse.ca>
|
||||
*
|
||||
* This file is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2, or (at your option)
|
||||
* any later version.
|
||||
*
|
||||
* This file is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; see the file COPYING. If not, write to
|
||||
* the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
|
||||
* Boston, MA 02111-1307, USA.
|
||||
*/
|
||||
|
||||
#ifndef NGVLIST_SOGO_H
|
||||
#define NGVLIST_SOGO_H
|
||||
|
||||
#import <NGCards/NGVList.h>
|
||||
|
||||
@interface NGVList (SOGoExtensions)
|
||||
|
||||
- (NSString *) ldifString;
|
||||
|
||||
@end
|
||||
|
||||
#endif /* NGVLIST_SOGO_H */
|
|
@ -0,0 +1,73 @@
|
|||
/* NGVCard+SOGo.m - this file is part of SOGo
|
||||
*
|
||||
* Copyright (C) 2009 Inverse inc.
|
||||
*
|
||||
* Author: Cyril Robert <crobert@inverse.ca>
|
||||
*
|
||||
* This file is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2, or (at your option)
|
||||
* any later version.
|
||||
*
|
||||
* This file is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; see the file COPYING. If not, write to
|
||||
* the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
|
||||
* Boston, MA 02111-1307, USA.
|
||||
*/
|
||||
|
||||
#import <Foundation/NSArray.h>
|
||||
#import <Foundation/NSDictionary.h>
|
||||
#import <Foundation/NSEnumerator.h>
|
||||
#import <Foundation/NSString.h>
|
||||
|
||||
#import <SOGo/NSDictionary+Utilities.h>
|
||||
#import "NGVList+SOGo.h"
|
||||
|
||||
#import <NGCards/NGVCardReference.h>
|
||||
|
||||
@implementation NGVList (SOGoExtensions)
|
||||
|
||||
- (NSString *) ldifString
|
||||
{
|
||||
NSMutableString *rc;
|
||||
NSArray *array;
|
||||
NSMutableArray *members;
|
||||
NGVCardReference *tmp;
|
||||
NSMutableDictionary *entry;
|
||||
int i, count;
|
||||
|
||||
entry = [NSMutableDictionary dictionary];
|
||||
|
||||
[entry setObject: [NSString stringWithFormat: @"cn=%@", [self fn]]
|
||||
forKey: @"dn"];
|
||||
[entry setObject: [NSArray arrayWithObjects: @"top", @"groupOfNames", nil]
|
||||
forKey: @"objectclass"];
|
||||
[entry setObject: [self fn] forKey: @"cn"];
|
||||
if ([self nickname])
|
||||
[entry setObject: [self nickname] forKey: @"mozillaNickname"];
|
||||
if ([self description])
|
||||
[entry setObject: [self description] forKey: @"description"];
|
||||
|
||||
array = [self cardReferences];
|
||||
count = [array count];
|
||||
members = [NSMutableArray array];
|
||||
for (i = 0; i < count; i++)
|
||||
{
|
||||
tmp = [array objectAtIndex: i];
|
||||
[members addObject: [NSString stringWithFormat:
|
||||
@"cn=%@,mail=%@", [tmp fn], [tmp email]]];
|
||||
}
|
||||
[entry setObject: members forKey: @"member"];
|
||||
|
||||
rc = [NSMutableString stringWithString: [entry userRecordAsLDIFEntry]];
|
||||
[rc appendFormat: @"\n"];
|
||||
|
||||
return rc;
|
||||
}
|
||||
|
||||
@end /* NGVList */
|
|
@ -974,7 +974,7 @@ _timeValue (NSString *key)
|
|||
if (sogoRoles)
|
||||
[rolesForObject addObjectsFromArray: sogoRoles];
|
||||
|
||||
if ((superUsernames && [superUsernames containsObject: login])
|
||||
if ([self isSuperUser]
|
||||
|| [[object ownerInContext: context] isEqualToString: login])
|
||||
[rolesForObject addObject: SoRole_Owner];
|
||||
else if ([object isKindOfClass: [SOGoObject class]])
|
||||
|
|
|
@ -35,8 +35,8 @@
|
|||
#import <Contacts/SOGoContactFolder.h>
|
||||
#import <Contacts/SOGoContactFolders.h>
|
||||
|
||||
#import <NGCards/NGVCard.h>
|
||||
#import <NGCards/NGVList.h>
|
||||
#import <SoObjects/Contacts/NGVCard+SOGo.h>
|
||||
#import <SoObjects/Contacts/NGVList+SOGo.h>
|
||||
#import <SoObjects/Contacts/SOGoContactGCSEntry.h>
|
||||
#import <SoObjects/Contacts/SOGoContactLDIFEntry.h>
|
||||
#import <SoObjects/Contacts/SOGoContactGCSList.h>
|
||||
|
|
|
@ -8,7 +8,7 @@ Standards-Version: 3.8.2
|
|||
Package: sogo
|
||||
Section: web
|
||||
Architecture: any
|
||||
Depends: ${shlibs:Depends}, ${misc:Depends}, tmpreaper
|
||||
Depends: ${shlibs:Depends}, ${misc:Depends}, tmpreaper, sope4.9-libxmlsaxdriver
|
||||
Suggests: nginx
|
||||
Description: a modern and scalable groupware
|
||||
SOGo is a groupware server built around OpenGroupware.org (OGo) and
|
||||
|
|
Loading…
Reference in New Issue