Monotone-Parent: b2c9818492b047bb745bea1ad062267394e7d060
Monotone-Revision: 39a04d9c4ef6da21c4cc1d1ad7d0ecb45557a98b Monotone-Author: wsourdeau@inverse.ca Monotone-Date: 2006-08-09T21:31:28 Monotone-Branch: ca.inverse.sogo
This commit is contained in:
parent
4d5c879a8d
commit
b0059bc3ff
13
ChangeLog
13
ChangeLog
|
@ -1,5 +1,18 @@
|
||||||
2006-08-09 Wolfgang Sourdeau <wsourdeau@inverse.ca>
|
2006-08-09 Wolfgang Sourdeau <wsourdeau@inverse.ca>
|
||||||
|
|
||||||
|
* SoObjects/Contacts/SOGoContactFolders.m ([SOGoContactFolders
|
||||||
|
-appendSystemSourcesInContext:context]): populated method with
|
||||||
|
code that creates entries mapped to instances SOGoContactFolder,
|
||||||
|
based on the configuration found in the NSUserDefaults under the
|
||||||
|
key "SOGoLDAPAddressBooks".
|
||||||
|
([SOGoContactFolders
|
||||||
|
-lookupName:nameinContext:contextacquire:acquire]):
|
||||||
|
"contactsources" do not exist anymore, SOGoContactFolder was split
|
||||||
|
into two classes: SOGoContactGCSFolder and SOGoContactLDAPFolder
|
||||||
|
and one protocol: SOGOContactFolder, instead.
|
||||||
|
([SOGoContactFolders -contactFolders]): new accessor used by the
|
||||||
|
views of SOGoContactXXXFolder to list the possible sources.
|
||||||
|
|
||||||
* SoObjects/Contacts/SOGoContactObject.h: new protocol that
|
* SoObjects/Contacts/SOGoContactObject.h: new protocol that
|
||||||
defines the methods that UIxContactsView, ..Editor and so on...
|
defines the methods that UIxContactsView, ..Editor and so on...
|
||||||
can expect.
|
can expect.
|
||||||
|
|
|
@ -30,13 +30,16 @@
|
||||||
|
|
||||||
@interface SOGoContactFolders : SOGoObject
|
@interface SOGoContactFolders : SOGoObject
|
||||||
{
|
{
|
||||||
NSMutableDictionary *contactSources;
|
NSMutableDictionary *contactFolders;
|
||||||
NSString *OCSPath;
|
NSString *OCSPath;
|
||||||
}
|
}
|
||||||
|
|
||||||
- (NSString *) defaultSourceName;
|
- (NSString *) defaultSourceName;
|
||||||
|
|
||||||
- (void) setBaseOCSPath: (NSString *) newOCSPath;
|
- (void) setBaseOCSPath: (NSString *) newOCSPath;
|
||||||
|
|
||||||
|
- (NSArray *) contactFolders;
|
||||||
|
|
||||||
@end
|
@end
|
||||||
|
|
||||||
#endif /* SOGOCONTACTFOLDERS_H */
|
#endif /* SOGOCONTACTFOLDERS_H */
|
||||||
|
|
|
@ -20,6 +20,14 @@
|
||||||
* Boston, MA 02111-1307, USA.
|
* Boston, MA 02111-1307, USA.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
/* exchange folder types: */
|
||||||
|
/* MailItems IPF.Note
|
||||||
|
ContactItems IPF.Contact
|
||||||
|
AppointmentItems IPF.Appointment
|
||||||
|
NoteItems IPF.StickyNote
|
||||||
|
TaskItems IPF.Task
|
||||||
|
JournalItems IPF.Journal */
|
||||||
|
|
||||||
#import <Foundation/NSDictionary.h>
|
#import <Foundation/NSDictionary.h>
|
||||||
#import <Foundation/NSString.h>
|
#import <Foundation/NSString.h>
|
||||||
|
|
||||||
|
@ -30,10 +38,8 @@
|
||||||
|
|
||||||
#import "common.h"
|
#import "common.h"
|
||||||
|
|
||||||
#import "SOGoContactFolder.h"
|
#import "SOGoContactGCSFolder.h"
|
||||||
#import "SOGoContactSource.h"
|
#import "SOGoContactLDAPFolder.h"
|
||||||
#import "SOGoPersonalAB.h"
|
|
||||||
|
|
||||||
#import "SOGoContactFolders.h"
|
#import "SOGoContactFolders.h"
|
||||||
|
|
||||||
@implementation SOGoContactFolders
|
@implementation SOGoContactFolders
|
||||||
|
@ -42,7 +48,7 @@
|
||||||
{
|
{
|
||||||
if ((self = [super init]))
|
if ((self = [super init]))
|
||||||
{
|
{
|
||||||
contactSources = nil;
|
contactFolders = nil;
|
||||||
OCSPath = nil;
|
OCSPath = nil;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -51,8 +57,8 @@
|
||||||
|
|
||||||
- (void) dealloc
|
- (void) dealloc
|
||||||
{
|
{
|
||||||
if (contactSources)
|
if (contactFolders)
|
||||||
[contactSources release];
|
[contactFolders release];
|
||||||
if (OCSPath)
|
if (OCSPath)
|
||||||
[OCSPath release];
|
[OCSPath release];
|
||||||
[super dealloc];
|
[super dealloc];
|
||||||
|
@ -60,21 +66,49 @@
|
||||||
|
|
||||||
- (void) appendPersonalSourcesInContext: (WOContext *) context;
|
- (void) appendPersonalSourcesInContext: (WOContext *) context;
|
||||||
{
|
{
|
||||||
SOGoPersonalAB *ab;
|
SOGoContactGCSFolder *ab;
|
||||||
|
|
||||||
ab = [SOGoPersonalAB personalABForUser: [[context activeUser] login]];
|
ab = [SOGoContactGCSFolder contactFolderWithName: @"personal"
|
||||||
[contactSources setObject: ab forKey: @"personal"];
|
andDisplayName: @"Personal Addressbook"
|
||||||
|
inContainer: self];
|
||||||
|
[ab setOCSPath: [NSString stringWithFormat: @"%@/%@",
|
||||||
|
OCSPath, @"personal"]];
|
||||||
|
[contactFolders setObject: ab forKey: @"personal"];
|
||||||
}
|
}
|
||||||
|
|
||||||
- (void) appendSystemSourcesInContext: (WOContext *) context;
|
- (void) appendSystemSourcesInContext: (WOContext *) context;
|
||||||
{
|
{
|
||||||
|
NSUserDefaults *ud;
|
||||||
|
NSEnumerator *ldapABs;
|
||||||
|
NSDictionary *udAB;
|
||||||
|
SOGoContactLDAPFolder *ab;
|
||||||
|
|
||||||
|
ud = [NSUserDefaults standardUserDefaults];
|
||||||
|
ldapABs = [[ud objectForKey: @"SOGoLDAPAddressBooks"] objectEnumerator];
|
||||||
|
udAB = [ldapABs nextObject];
|
||||||
|
while (udAB)
|
||||||
|
{
|
||||||
|
ab = [SOGoContactLDAPFolder contactFolderWithName:
|
||||||
|
[udAB objectForKey: @"id"]
|
||||||
|
andDisplayName:
|
||||||
|
[udAB objectForKey: @"displayName"]
|
||||||
|
inContainer: self];
|
||||||
|
[ab LDAPSetHostname: [udAB objectForKey: @"hostname"]
|
||||||
|
setPort: [[udAB objectForKey: @"port"] intValue]
|
||||||
|
setBindDN: [udAB objectForKey: @"bindDN"]
|
||||||
|
setBindPW: [udAB objectForKey: @"bindPW"]
|
||||||
|
setContactIdentifier: [udAB objectForKey: @"idField"]
|
||||||
|
setRootDN: [udAB objectForKey: @"rootDN"]];
|
||||||
|
[contactFolders setObject: ab forKey: [udAB objectForKey: @"id"]];
|
||||||
|
udAB = [ldapABs nextObject];
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
- (void) initContactSourcesInContext: (WOContext *) context;
|
- (void) initContactSourcesInContext: (WOContext *) context;
|
||||||
{
|
{
|
||||||
if (!contactSources)
|
if (!contactFolders)
|
||||||
{
|
{
|
||||||
contactSources = [NSMutableDictionary new];
|
contactFolders = [NSMutableDictionary new];
|
||||||
[self appendPersonalSourcesInContext: context];
|
[self appendPersonalSourcesInContext: context];
|
||||||
[self appendSystemSourcesInContext: context];
|
[self appendSystemSourcesInContext: context];
|
||||||
}
|
}
|
||||||
|
@ -85,26 +119,19 @@
|
||||||
acquire: (BOOL) acquire
|
acquire: (BOOL) acquire
|
||||||
{
|
{
|
||||||
id obj;
|
id obj;
|
||||||
SOGoContactSource *source;
|
id folder;
|
||||||
|
|
||||||
/* first check attributes directly bound to the application */
|
/* first check attributes directly bound to the application */
|
||||||
obj = [super lookupName: name inContext: context acquire: NO];
|
obj = [super lookupName: name inContext: context acquire: NO];
|
||||||
if (!obj)
|
if (!obj)
|
||||||
{
|
{
|
||||||
if (!contactSources)
|
if (!contactFolders)
|
||||||
[self initContactSourcesInContext: context];
|
[self initContactSourcesInContext: context];
|
||||||
|
|
||||||
source = [contactSources objectForKey: name];
|
folder = [contactFolders objectForKey: name];
|
||||||
if (source)
|
obj = ((folder)
|
||||||
{
|
? folder
|
||||||
obj = [SOGoContactFolder contactFolderWithSource: source
|
: [NSException exceptionWithHTTPStatus: 404]);
|
||||||
inContainer: self
|
|
||||||
andName: name];
|
|
||||||
[obj setOCSPath: [NSString stringWithFormat: @"%@/%@",
|
|
||||||
OCSPath, name]];
|
|
||||||
}
|
|
||||||
else
|
|
||||||
obj = [NSException exceptionWithHTTPStatus: 200];
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return obj;
|
return obj;
|
||||||
|
@ -114,13 +141,26 @@
|
||||||
{
|
{
|
||||||
WOContext *context;
|
WOContext *context;
|
||||||
|
|
||||||
if (!contactSources)
|
if (!contactFolders)
|
||||||
{
|
{
|
||||||
context = [[WOApplication application] context];
|
context = [[WOApplication application] context];
|
||||||
[self initContactSourcesInContext: context];
|
[self initContactSourcesInContext: context];
|
||||||
}
|
}
|
||||||
|
|
||||||
return [contactSources allKeys];
|
return [contactFolders allKeys];
|
||||||
|
}
|
||||||
|
|
||||||
|
- (NSArray *) contactFolders
|
||||||
|
{
|
||||||
|
WOContext *context;
|
||||||
|
|
||||||
|
if (!contactFolders)
|
||||||
|
{
|
||||||
|
context = [[WOApplication application] context];
|
||||||
|
[self initContactSourcesInContext: context];
|
||||||
|
}
|
||||||
|
|
||||||
|
return [contactFolders allValues];
|
||||||
}
|
}
|
||||||
|
|
||||||
- (BOOL) davIsCollection
|
- (BOOL) davIsCollection
|
||||||
|
|
Loading…
Reference in a new issue