mirror of
https://github.com/inverse-inc/sogo.git
synced 2026-07-05 08:34:30 +00:00
Monotone-Parent: 54cc41b15e02fc61bfa80e7db07aeb97e541fdfc
Monotone-Revision: 3c8a49fe7ef93ec55aaeef9dd064be1de6052cfe Monotone-Author: wsourdeau@inverse.ca Monotone-Date: 2012-03-21T15:50:07
This commit is contained in:
@@ -76,6 +76,11 @@
|
||||
return [[self vCard] asLDIFRecord];
|
||||
}
|
||||
|
||||
- (NSDictionary *) simplifiedLDIFRecord
|
||||
{
|
||||
return [self ldifRecord];
|
||||
}
|
||||
|
||||
- (BOOL) hasPhoto
|
||||
{
|
||||
return ([[self vCard] firstChildWithTag: @"photo"] != nil);
|
||||
|
||||
@@ -95,7 +95,7 @@
|
||||
[vcard setProdID: [NSString
|
||||
stringWithFormat: @"-//Inverse inc./SOGo %@//EN",
|
||||
SOGoVersion]];
|
||||
[vcard updateFromLDIFRecord: [self ldifRecord]];
|
||||
[vcard updateFromLDIFRecord: [self simplifiedLDIFRecord]];
|
||||
|
||||
return vcard;
|
||||
}
|
||||
@@ -115,6 +115,37 @@
|
||||
return ldifEntry;
|
||||
}
|
||||
|
||||
- (NSDictionary *) simplifiedLDIFRecord
|
||||
{
|
||||
NSMutableDictionary *newRecord;
|
||||
NSArray *keys;
|
||||
NSUInteger count, max;
|
||||
NSString *key;
|
||||
id value;
|
||||
|
||||
newRecord = [[self ldifRecord] mutableCopy];
|
||||
[newRecord autorelease];
|
||||
|
||||
keys = [newRecord allKeys];
|
||||
max = [keys count];
|
||||
for (count = 0; count < max; count++)
|
||||
{
|
||||
key = [keys objectAtIndex: count];
|
||||
value = [newRecord objectForKey: key];
|
||||
if ([value isKindOfClass: [NSArray class]]
|
||||
&& ![key isEqualToString: @"objectclass"])
|
||||
{
|
||||
if ([value count] > 0)
|
||||
[newRecord setObject: [value objectAtIndex: 0]
|
||||
forKey: key];
|
||||
else
|
||||
[newRecord removeObjectForKey: key];
|
||||
}
|
||||
}
|
||||
|
||||
return newRecord;
|
||||
}
|
||||
|
||||
- (BOOL) hasPhoto
|
||||
{
|
||||
return NO;
|
||||
|
||||
@@ -33,6 +33,7 @@
|
||||
/* web editing */
|
||||
- (void) setLDIFRecord: (NSDictionary *) newLDIFRecord;
|
||||
- (NSDictionary *) ldifRecord;
|
||||
- (NSDictionary *) simplifiedLDIFRecord;
|
||||
|
||||
- (NSException *) save;
|
||||
- (NSException *) delete;
|
||||
|
||||
@@ -213,7 +213,7 @@
|
||||
- (NSDictionary *) _flattenedRecord: (NSDictionary *) oldRecord
|
||||
{
|
||||
NSMutableDictionary *newRecord;
|
||||
NSString *data;
|
||||
id data;
|
||||
NSObject <SOGoSource> *recordSource;
|
||||
|
||||
newRecord = [NSMutableDictionary dictionaryWithCapacity: 8];
|
||||
@@ -232,6 +232,13 @@
|
||||
data = [oldRecord objectForKey: @"mail"];
|
||||
if (!data)
|
||||
data = @"";
|
||||
else if ([data isKindOfClass: [NSArray class]])
|
||||
{
|
||||
if ([data count] > 0)
|
||||
data = [data objectAtIndex: 0];
|
||||
else
|
||||
data = @"";
|
||||
}
|
||||
[newRecord setObject: data forKey: @"c_mail"];
|
||||
|
||||
data = [oldRecord objectForKey: @"nsaimid"];
|
||||
|
||||
Reference in New Issue
Block a user