Monotone-Parent: b2c9818492b047bb745bea1ad062267394e7d060
Monotone-Revision: 39a04d9c4ef6da21c4cc1d1ad7d0ecb45557a98b Monotone-Author: wsourdeau@inverse.ca Monotone-Date: 2006-08-09T21:31:28 Monotone-Branch: ca.inverse.sogomaint-2.0.2
parent
4d5c879a8d
commit
b0059bc3ff
13
ChangeLog
13
ChangeLog
|
@ -1,5 +1,18 @@
|
|||
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
|
||||
defines the methods that UIxContactsView, ..Editor and so on...
|
||||
can expect.
|
||||
|
|
|
@ -30,13 +30,16 @@
|
|||
|
||||
@interface SOGoContactFolders : SOGoObject
|
||||
{
|
||||
NSMutableDictionary *contactSources;
|
||||
NSMutableDictionary *contactFolders;
|
||||
NSString *OCSPath;
|
||||
}
|
||||
|
||||
- (NSString *) defaultSourceName;
|
||||
|
||||
- (void) setBaseOCSPath: (NSString *) newOCSPath;
|
||||
|
||||
- (NSArray *) contactFolders;
|
||||
|
||||
@end
|
||||
|
||||
#endif /* SOGOCONTACTFOLDERS_H */
|
||||
|
|
|
@ -20,6 +20,14 @@
|
|||
* 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/NSString.h>
|
||||
|
||||
|
@ -30,10 +38,8 @@
|
|||
|
||||
#import "common.h"
|
||||
|
||||
#import "SOGoContactFolder.h"
|
||||
#import "SOGoContactSource.h"
|
||||
#import "SOGoPersonalAB.h"
|
||||
|
||||
#import "SOGoContactGCSFolder.h"
|
||||
#import "SOGoContactLDAPFolder.h"
|
||||
#import "SOGoContactFolders.h"
|
||||
|
||||
@implementation SOGoContactFolders
|
||||
|
@ -42,7 +48,7 @@
|
|||
{
|
||||
if ((self = [super init]))
|
||||
{
|
||||
contactSources = nil;
|
||||
contactFolders = nil;
|
||||
OCSPath = nil;
|
||||
}
|
||||
|
||||
|
@ -51,8 +57,8 @@
|
|||
|
||||
- (void) dealloc
|
||||
{
|
||||
if (contactSources)
|
||||
[contactSources release];
|
||||
if (contactFolders)
|
||||
[contactFolders release];
|
||||
if (OCSPath)
|
||||
[OCSPath release];
|
||||
[super dealloc];
|
||||
|
@ -60,21 +66,49 @@
|
|||
|
||||
- (void) appendPersonalSourcesInContext: (WOContext *) context;
|
||||
{
|
||||
SOGoPersonalAB *ab;
|
||||
SOGoContactGCSFolder *ab;
|
||||
|
||||
ab = [SOGoPersonalAB personalABForUser: [[context activeUser] login]];
|
||||
[contactSources setObject: ab forKey: @"personal"];
|
||||
ab = [SOGoContactGCSFolder contactFolderWithName: @"personal"
|
||||
andDisplayName: @"Personal Addressbook"
|
||||
inContainer: self];
|
||||
[ab setOCSPath: [NSString stringWithFormat: @"%@/%@",
|
||||
OCSPath, @"personal"]];
|
||||
[contactFolders setObject: ab forKey: @"personal"];
|
||||
}
|
||||
|
||||
- (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;
|
||||
{
|
||||
if (!contactSources)
|
||||
if (!contactFolders)
|
||||
{
|
||||
contactSources = [NSMutableDictionary new];
|
||||
contactFolders = [NSMutableDictionary new];
|
||||
[self appendPersonalSourcesInContext: context];
|
||||
[self appendSystemSourcesInContext: context];
|
||||
}
|
||||
|
@ -85,26 +119,19 @@
|
|||
acquire: (BOOL) acquire
|
||||
{
|
||||
id obj;
|
||||
SOGoContactSource *source;
|
||||
id folder;
|
||||
|
||||
/* first check attributes directly bound to the application */
|
||||
obj = [super lookupName: name inContext: context acquire: NO];
|
||||
if (!obj)
|
||||
{
|
||||
if (!contactSources)
|
||||
if (!contactFolders)
|
||||
[self initContactSourcesInContext: context];
|
||||
|
||||
source = [contactSources objectForKey: name];
|
||||
if (source)
|
||||
{
|
||||
obj = [SOGoContactFolder contactFolderWithSource: source
|
||||
inContainer: self
|
||||
andName: name];
|
||||
[obj setOCSPath: [NSString stringWithFormat: @"%@/%@",
|
||||
OCSPath, name]];
|
||||
}
|
||||
else
|
||||
obj = [NSException exceptionWithHTTPStatus: 200];
|
||||
folder = [contactFolders objectForKey: name];
|
||||
obj = ((folder)
|
||||
? folder
|
||||
: [NSException exceptionWithHTTPStatus: 404]);
|
||||
}
|
||||
|
||||
return obj;
|
||||
|
@ -114,13 +141,26 @@
|
|||
{
|
||||
WOContext *context;
|
||||
|
||||
if (!contactSources)
|
||||
if (!contactFolders)
|
||||
{
|
||||
context = [[WOApplication application] 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
|
||||
|
|
Loading…
Reference in New Issue