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
+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