From: helge Date: Fri, 8 Oct 2004 13:57:14 +0000 (+0000) Subject: WebDAV enhancements X-Git-Url: https://err.no/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=1ac063e1bf6656fa2b4c6dfb354618b3cfb1658e;p=scalable-opengroupware.org WebDAV enhancements git-svn-id: http://svn.opengroupware.org/SOGo/trunk@371 d1b88da0-ebda-0310-925b-ed51d893ca5b --- diff --git a/SOGo/SoObjects/Mailer/ChangeLog b/SOGo/SoObjects/Mailer/ChangeLog index 440bfab5..812f5849 100644 --- a/SOGo/SoObjects/Mailer/ChangeLog +++ b/SOGo/SoObjects/Mailer/ChangeLog @@ -1,5 +1,13 @@ 2004-10-08 Helge Hess + * v0.9.29 + + * SOGoMailObject.m: added toOneRelationshipKeys/toManyRelationshipKeys + (return the contained body parts) + + * SOGoMailFolder.m: added toOneRelationshipKeys (returns the message + uids) + * marked collections as WebDAV collections (v0.9.28) 2004-10-06 Helge Hess diff --git a/SOGo/SoObjects/Mailer/SOGoMailFolder.m b/SOGo/SoObjects/Mailer/SOGoMailFolder.m index 425389c8..b2104556 100644 --- a/SOGo/SoObjects/Mailer/SOGoMailFolder.m +++ b/SOGo/SoObjects/Mailer/SOGoMailFolder.m @@ -39,10 +39,15 @@ return [[self mailManager] subfoldersForURL:[self imap4URL] password:[self imap4Password]]; } +- (NSArray *)toOneRelationshipKeys { + return [[self fetchUIDsMatchingQualifier:nil sortOrdering:@"DATE"] + valueForKey:@"stringValue"]; +} /* messages */ - (NSArray *)fetchUIDsMatchingQualifier:(id)_q sortOrdering:(id)_so { + /* seems to return an NSArray of NSNumber's */ return [[self mailManager] fetchUIDsInURL:[self imap4URL] qualifier:_q sortOrdering:_so password:[self imap4Password]]; diff --git a/SOGo/SoObjects/Mailer/SOGoMailObject.m b/SOGo/SoObjects/Mailer/SOGoMailObject.m index c3d17e0d..d6505d28 100644 --- a/SOGo/SoObjects/Mailer/SOGoMailObject.m +++ b/SOGo/SoObjects/Mailer/SOGoMailObject.m @@ -55,6 +55,68 @@ static NSArray *coreInfoKeys = nil; return self; } +/* part hierarchy */ + +- (NSString *)keyExtensionForPart:(id)_partInfo { + NSString *mt, *st; + + if (_partInfo == nil) + return nil; + + mt = [_partInfo valueForKey:@"type"]; + st = [[_partInfo valueForKey:@"subtype"] lowercaseString]; + if ([mt isEqualToString:@"text"]) { + if ([st isEqualToString:@"plain"]) + return @".txt"; + if ([st isEqualToString:@"html"]) + return @".html"; + } + else if ([mt isEqualToString:@"image"]) + return [@"." stringByAppendingString:st]; + + return nil; +} + +- (NSArray *)relationshipKeysWithParts:(BOOL)_withParts { + /* should return non-multipart children */ + NSMutableArray *ma; + NSArray *parts; + unsigned i, count; + + parts = [[self bodyStructure] valueForKey:@"parts"]; + if (![parts isNotNull]) + return nil; + if ((count = [parts count]) == 0) + return nil; + + for (i = 0, ma = nil; i < count; i++) { + NSString *key, *ext; + id part; + BOOL hasParts; + + part = [parts objectAtIndex:i]; + hasParts = [part valueForKey:@"parts"] != nil ? YES:NO; + if ((hasParts && !_withParts) || (_withParts && !hasParts)) + continue; + + if (ma == nil) + ma = [NSMutableArray arrayWithCapacity:count - i]; + + ext = [self keyExtensionForPart:part]; + key = [[NSString alloc] initWithFormat:@"%d%@", i, ext?ext:@""]; + [ma addObject:key]; + [key release]; + } + return ma; +} + +- (NSArray *)toOneRelationshipKeys { + return [self relationshipKeysWithParts:NO]; +} +- (NSArray *)toManyRelationshipKeys { + return [self relationshipKeysWithParts:YES]; +} + /* message */ - (id)fetchParts:(NSArray *)_parts { diff --git a/SOGo/SoObjects/Mailer/Version b/SOGo/SoObjects/Mailer/Version index 42d0a3b8..3631f8fc 100644 --- a/SOGo/SoObjects/Mailer/Version +++ b/SOGo/SoObjects/Mailer/Version @@ -1,3 +1,3 @@ # $Id$ -SUBMINOR_VERSION:=28 +SUBMINOR_VERSION:=29 diff --git a/SOGo/SoObjects/SOGo/ChangeLog b/SOGo/SoObjects/SOGo/ChangeLog index 68f1da95..eb38acfd 100644 --- a/SOGo/SoObjects/SOGo/ChangeLog +++ b/SOGo/SoObjects/SOGo/ChangeLog @@ -1,8 +1,10 @@ 2004-10-08 Helge Hess - * v0.9.22 - + * SOGoObject.m: fixed not implemented return status (501, not 502) + (v0.9.23) + * SOGoUserFolder.m: do not try to fetch file names in this folder + (v0.9.22) * v0.9.21 diff --git a/SOGo/SoObjects/SOGo/SOGoObject.m b/SOGo/SoObjects/SOGo/SOGoObject.m index b18c9e3b..f7b1c080 100644 --- a/SOGo/SoObjects/SOGo/SOGoObject.m +++ b/SOGo/SoObjects/SOGo/SOGoObject.m @@ -150,7 +150,7 @@ if ([self respondsToSelector:@selector(contentAsString)]) return [self contentAsString]; - return [NSException exceptionWithHTTPStatus:502 /* not implemented */ + return [NSException exceptionWithHTTPStatus:501 /* not implemented */ reason:@"no WebDAV GET support?!"]; } diff --git a/SOGo/SoObjects/SOGo/Version b/SOGo/SoObjects/SOGo/Version index 4bb2a0be..134290ff 100644 --- a/SOGo/SoObjects/SOGo/Version +++ b/SOGo/SoObjects/SOGo/Version @@ -1,3 +1,3 @@ # $Id: Version 170 2004-08-11 10:45:40Z helge $ -SUBMINOR_VERSION:=22 +SUBMINOR_VERSION:=23