mirror of
https://github.com/inverse-inc/sogo.git
synced 2026-10-05 12:00:33 +00:00
Monotone-Parent: 2fdf0ead0781ef2362dd389811d5db44ca4cc84a
Monotone-Revision: c91eef7edcfd08d414664c25a590b6268a7e58e2 Monotone-Author: wsourdeau@inverse.ca Monotone-Date: 2009-11-29T04:19:32 Monotone-Branch: ca.inverse.sogo
This commit is contained in:
@@ -32,7 +32,9 @@
|
||||
#import <Foundation/NSString.h>
|
||||
#import <Foundation/NSEnumerator.h>
|
||||
|
||||
#import <SoObjects/SOGo/SOGoUserManager.h>
|
||||
#import <NGObjWeb/WOContext+SoObjects.h>
|
||||
#import <SOGo/SOGoUser.h>
|
||||
#import <SOGo/SOGoUserManager.h>
|
||||
|
||||
#import "SOGoContactGCSFolder.h"
|
||||
#import "SOGoContactSourceFolder.h"
|
||||
@@ -54,11 +56,12 @@
|
||||
{
|
||||
SOGoUserManager *um;
|
||||
NSEnumerator *sourceIDs;
|
||||
NSString *currentSourceID, *srcDisplayName;
|
||||
NSString *currentSourceID, *srcDisplayName, *domain;
|
||||
SOGoContactSourceFolder *currentFolder;
|
||||
|
||||
domain = [[context activeUser] domain];
|
||||
um = [SOGoUserManager sharedUserManager];
|
||||
sourceIDs = [[um addressBookSourceIDs] objectEnumerator];
|
||||
sourceIDs = [[um addressBookSourceIDsInDomain: domain] objectEnumerator];
|
||||
while ((currentSourceID = [sourceIDs nextObject]))
|
||||
{
|
||||
srcDisplayName = [um displayNameForSourceWithID: currentSourceID];
|
||||
|
||||
@@ -24,7 +24,6 @@
|
||||
#import <Foundation/NSArray.h>
|
||||
#import <Foundation/NSDictionary.h>
|
||||
#import <Foundation/NSString.h>
|
||||
#import <Foundation/NSUserDefaults.h>
|
||||
|
||||
#import <NGCards/NGVCard.h>
|
||||
#import <NGCards/CardVersitRenderer.h>
|
||||
@@ -32,22 +31,8 @@
|
||||
#import "SOGoContactGCSEntry.h"
|
||||
#import "SOGoContactLDIFEntry.h"
|
||||
|
||||
static NSString *sogoContactInfoAttribute = nil;
|
||||
|
||||
@implementation SOGoContactLDIFEntry
|
||||
|
||||
+ (void) initialize
|
||||
{
|
||||
NSUserDefaults *ud;
|
||||
|
||||
if (!sogoContactInfoAttribute)
|
||||
{
|
||||
ud = [NSUserDefaults standardUserDefaults];
|
||||
ASSIGN (sogoContactInfoAttribute,
|
||||
[ud stringForKey: @"SOGoLDAPContactInfoAttribute"]);
|
||||
}
|
||||
}
|
||||
|
||||
+ (SOGoContactLDIFEntry *) contactEntryWithName: (NSString *) newName
|
||||
withLDIFEntry: (NSDictionary *) newEntry
|
||||
inContainer: (id) newContainer
|
||||
@@ -126,7 +111,7 @@ static NSString *sogoContactInfoAttribute = nil;
|
||||
|
||||
- (NGVCard *) vCard
|
||||
{
|
||||
NSString *info, *surname, *streetAddress, *location, *key, *region, *postalCode, *country, *org, *orgunit;
|
||||
NSString *info, *surname, *streetAddress, *location, *region, *postalCode, *country, *org, *orgunit;
|
||||
CardElement *element;
|
||||
unsigned int count;
|
||||
|
||||
@@ -159,14 +144,12 @@ static NSString *sogoContactInfoAttribute = nil;
|
||||
if (info)
|
||||
[vcard setNickname: info];
|
||||
|
||||
/* If SOGoLDAPContactInfoAttribute is defined, we set as the NOTE value
|
||||
in order for Thunderbird (or any other CardDAV client) to display it. */
|
||||
if (sogoContactInfoAttribute)
|
||||
key = [sogoContactInfoAttribute lowercaseString];
|
||||
else
|
||||
key = @"description";
|
||||
info = [ldifEntry objectForKey: key];
|
||||
if (info)
|
||||
/* If "c_info" is defined, we set as the NOTE value in order for
|
||||
Thunderbird (or any other CardDAV client) to display it. */
|
||||
info = [ldifEntry objectForKey: @"c_info"];
|
||||
if (![info length])
|
||||
info = [ldifEntry objectForKey: @"description"];
|
||||
if ([info length])
|
||||
[vcard setNote: info];
|
||||
|
||||
info = [ldifEntry objectForKey: @"mail"];
|
||||
|
||||
@@ -24,7 +24,6 @@
|
||||
#import <Foundation/NSDictionary.h>
|
||||
#import <Foundation/NSEnumerator.h>
|
||||
#import <Foundation/NSString.h>
|
||||
#import <Foundation/NSUserDefaults.h>
|
||||
|
||||
#import <NGObjWeb/NSException+HTTP.h>
|
||||
#import <NGObjWeb/WOApplication.h>
|
||||
@@ -199,10 +198,8 @@
|
||||
NSEnumerator *oldRecords;
|
||||
NSDictionary *oldRecord;
|
||||
NSMutableDictionary *newRecord;
|
||||
NSString *data, *contactInfo;
|
||||
NSUserDefaults *ud;
|
||||
|
||||
ud = [NSUserDefaults standardUserDefaults];
|
||||
NSString *data;
|
||||
|
||||
newRecords = [[NSMutableArray alloc] initWithCapacity: [records count]];
|
||||
[newRecords autorelease];
|
||||
|
||||
@@ -257,12 +254,9 @@
|
||||
if (data)
|
||||
[newRecord setObject: data forKey: @"isGroup"];
|
||||
|
||||
contactInfo = [[ud stringForKey: @"SOGoLDAPContactInfoAttribute"] lowercaseString];
|
||||
if ([contactInfo length] > 0) {
|
||||
data = [oldRecord objectForKey: contactInfo];
|
||||
if ([data length] > 0)
|
||||
[newRecord setObject: data forKey: @"contactInfo"];
|
||||
}
|
||||
data = [oldRecord objectForKey: @"c_info"];
|
||||
if ([data length] > 0)
|
||||
[newRecord setObject: data forKey: @"contactInfo"];
|
||||
|
||||
[newRecords addObject: newRecord];
|
||||
oldRecord = [oldRecords nextObject];
|
||||
|
||||
Reference in New Issue
Block a user