Monotone-Parent: f6d4ca8944c94273bc0dae0565c60e45be9f2ca1

Monotone-Revision: 98896091d472e0ee7990f69f32f5981f5d1dc546

Monotone-Author: wsourdeau@inverse.ca
Monotone-Date: 2008-01-16T18:46:32
Monotone-Branch: ca.inverse.sogo
This commit is contained in:
Wolfgang Sourdeau
2008-01-16 18:46:32 +00:00
parent d0db04a31e
commit 8aae87afd5
16 changed files with 508 additions and 129 deletions
+2
View File
@@ -20,6 +20,7 @@ libSOGo_HEADER_FILES_INSTALL_DIR = /SOGo
FHS_HEADER_DIRS = SOGo
libSOGo_HEADER_FILES = \
SOGoCache.h \
SOGoObject.h \
SOGoContentObject.h \
SOGoFolder.h \
@@ -56,6 +57,7 @@ libSOGo_HEADER_FILES = \
WORequest+SOGo.h
libSOGo_OBJC_FILES = \
SOGoCache.m \
SOGoObject.m \
SOGoContentObject.m \
SOGoFolder.m \
+1 -1
View File
@@ -31,7 +31,7 @@
@interface SOGoContentObject : SOGoObject
{
NSString *ocsPath;
NSString *content;
NSDictionary *record;
BOOL isNew;
}
+21 -20
View File
@@ -49,9 +49,9 @@
if ((self = [super initWithName: newName inContainer: newContainer]))
{
ocsPath = nil;
content = [[self ocsFolder] fetchContentWithName: newName];
[content retain];
isNew = (!content);
record = [[self ocsFolder] recordOfEntryWithName: newName];
[record retain];
isNew = (!record);
}
return self;
@@ -59,19 +59,11 @@
- (void) dealloc
{
[content release];
[record release];
[ocsPath release];
[super dealloc];
}
/* notifications */
- (void) sleep
{
[content release]; content = nil;
[super sleep];
}
/* accessors */
- (BOOL) isFolderish
@@ -136,19 +128,25 @@
- (NSString *) contentAsString
{
return content;
return [record objectForKey: @"c_content"];
}
- (NSException *) saveContentString: (NSString *) newContent
baseVersion: (unsigned int) newBaseVersion
{
/* Note: "iCal multifolder saves" are implemented in the apt subclass! */
GCSFolder *folder;
GCSFolder *folder;
NSException *ex;
NSMutableDictionary *newRecord;
ex = nil;
ASSIGN (content, newContent);
if (record)
newRecord = [NSMutableDictionary dictionaryWithDictionary: record];
else
newRecord = [NSMutableDictionary dictionary];
[newRecord setObject: newContent forKey: @"c_content"];
ASSIGN (record, newRecord);
folder = [container ocsFolder];
if (folder)
@@ -307,7 +305,7 @@
folder = [self ocsFolder];
if (folder)
{
versionValue = [folder versionOfContentWithName: [self nameInContainer]];
versionValue = [record objectForKey: @"c_version"];
sprintf (buf, "\"gcs%08d\"", [versionValue unsignedIntValue]);
entityTag = [NSString stringWithCString: buf];
}
@@ -325,7 +323,7 @@
{
NSCalendarDate *date;
date = [[self ocsFolder] creationDateOfEntryWithName: nameInContainer];
date = [record objectForKey: @"c_creationdate"];
return [date rfc822DateString];
}
@@ -334,16 +332,19 @@
{
NSCalendarDate *date;
date = [[self ocsFolder] lastModificationOfEntryWithName: nameInContainer];
date = [record objectForKey: @"c_lastmodified"];
return [date rfc822DateString];
}
- (NSString *) davContentLength
{
NSString *content;
content = [record objectForKey: @"c_content"];
return [NSString stringWithFormat: @"%u",
[content
lengthOfBytesUsingEncoding: NSISOLatin1StringEncoding]];
[content lengthOfBytesUsingEncoding: NSISOLatin1StringEncoding]];
}
- (NSException *) davMoveToTargetObject: (id) _target
+13 -3
View File
@@ -62,6 +62,7 @@
#import "NSDictionary+Utilities.h"
#import "NSString+Utilities.h"
#import "SOGoCache.h"
#import "SOGoObject.h"
@interface SOGoObject(Content)
@@ -560,10 +561,19 @@ static BOOL kontactGroupDAV = YES;
acquire: (BOOL) acquire
{
id obj;
SOGoCache *cache;
obj = [[self soClass] lookupKey: lookupName inContext: localContext];
if (obj)
[obj bindToObject: self inContext: localContext];
cache = [SOGoCache sharedCache];
obj = [cache objectNamed: lookupName inContainer: self];
if (!obj)
{
obj = [[self soClass] lookupKey: lookupName inContext: localContext];
if (obj)
{
[obj bindToObject: self inContext: localContext];
[cache registerObject: obj withName: lookupName inContainer: self];
}
}
return obj;
}
+17 -3
View File
@@ -32,10 +32,11 @@
#import "AgenorUserDefaults.h"
#import "LDAPUserManager.h"
#import "NSArray+Utilities.h"
#import "SOGoCache.h"
#import "SOGoDateFormatter.h"
#import "SOGoObject.h"
#import "SOGoPermissions.h"
#import "NSArray+Utilities.h"
#import "SOGoUser.h"
@@ -124,10 +125,18 @@ NSString *SOGoWeekStartFirstFullWeek = @"FirstFullWeek";
+ (SOGoUser *) userWithLogin: (NSString *) newLogin
roles: (NSArray *) newRoles
{
SOGoCache *cache;
SOGoUser *user;
user = [[self alloc] initWithLogin: newLogin roles: newRoles];
[user autorelease];
cache = [SOGoCache sharedCache];
user = [cache userNamed: newLogin];
if (!user)
{
user = [[self alloc] initWithLogin: newLogin roles: newRoles];
[user autorelease];
[cache registerUser: user];
}
[user setPrimaryRoles: newRoles];
return user;
}
@@ -181,6 +190,11 @@ NSString *SOGoWeekStartFirstFullWeek = @"FirstFullWeek";
[super dealloc];
}
- (void) setPrimaryRoles: (NSArray *) newRoles
{
ASSIGN (roles, newRoles);
}
- (void) setCurrentPassword: (NSString *) newPassword
{
ASSIGN (currentPassword, newPassword);