Monotone-Parent: e46203402a1f2d996395599061c75452a98958d3

Monotone-Revision: b178183ad97d53d251135c909db06ab534f73a1f

Monotone-Author: wsourdeau@inverse.ca
Monotone-Date: 2010-10-01T21:24:15
Monotone-Branch: ca.inverse.sogo
maint-2.0.2
Wolfgang Sourdeau 2010-10-01 21:24:15 +00:00
parent f0129f6312
commit 0c742dd5ca
9 changed files with 162 additions and 28 deletions

View File

@ -1,5 +1,16 @@
2010-10-01 Wolfgang Sourdeau <wsourdeau@inverse.ca>
* OpenChange/SOGoGCSFolder+MAPIStore.m (-componentKeysWithType:):
new method that return the keys of components corresponding to the
type passed as parameter.
* OpenChange/SOGoGCSFolder+MAPIStore.[hm]: new category module.
* OpenChange/MAPIStoreContext.m (-lookupObject): return nil when
the parsed URL is nil.
(-getFolderMessageKeys:): new subclass method designed to return
the appropriate "message" keys depending on the folder type.
* SoObjects/SOGo/SOGoObject.m (-displayName): new accessor.
2010-09-30 Wolfgang Sourdeau <wsourdeau@inverse.ca>

View File

@ -25,6 +25,8 @@ $(MAPISTORESOGO)_OBJC_FILES += \
MAPIStoreContactsContext.m \
MAPIStoreMailContext.m \
\
SOGoGCSFolder+MAPIStore.m \
\
NSCalendarDate+MAPIStore.m \
NSString+MAPIStore.m

View File

@ -29,6 +29,7 @@
#import "MAPIStoreAuthenticator.h"
#import "NSCalendarDate+MAPIStore.h"
#import "NSString+MAPIStore.h"
#import "SOGoGCSFolder+MAPIStore.h"
#import "MAPIStoreCalendarContext.h"
@ -59,6 +60,11 @@ static Class SOGoUserFolderK;
[moduleFolder retain];
}
- (NSArray *) getFolderMessageKeys: (SOGoFolder *) folder
{
return [(SOGoGCSFolder *) folder componentKeysWithType: @"vevent"];
}
- (int) getMessageTableChildproperty: (void **) data
atURL: (NSString *) childURL
withTag: (uint32_t) proptag

View File

@ -27,12 +27,13 @@
#import <NGCards/NGVCard.h>
#import <NGCards/NSArray+NGCards.h>
#import <SOGo/SOGoObject.h>
#import <Contacts/SOGoContactObject.h>
#import <Contacts/SOGoContactGCSEntry.h>
#import <Contacts/SOGoContactGCSFolder.h>
#import "MAPIApplication.h"
#import "MAPIStoreAuthenticator.h"
#import "NSString+MAPIStore.h"
#import "SOGoGCSFolder+MAPIStore.h"
#import "MAPIStoreContactsContext.h"
@ -63,6 +64,11 @@ static Class SOGoUserFolderK;
[moduleFolder retain];
}
- (NSArray *) getFolderMessageKeys: (SOGoFolder *) folder
{
return [(SOGoGCSFolder *) folder componentKeysWithType: @"vcard"];
}
// - (int) getCommonTableChildproperty: (void **) data
// atURL: (NSString *) childURL
// withTag: (uint32_t) proptag

View File

@ -30,6 +30,7 @@
#define SENSITIVITY_PRIVATE 2
#define SENSITIVITY_COMPANY_CONFIDENTIAL 3
@class NSArray;
@class NSMutableDictionary;
@class NSString;
@ -110,6 +111,8 @@
/* subclass methods */
- (NSArray *) getFolderMessageKeys: (SOGoFolder *) folder;
- (int) getCommonTableChildproperty: (void **) data
atURL: (NSString *) childURL
withTag: (uint32_t) proptag

View File

@ -251,40 +251,46 @@ static MAPIStoreMapping *mapping = nil;
NSString *pathString, *nameInContainer;
objectURL = [NSURL URLWithString: objectURLString];
if (!objectURL)
[self errorWithFormat: @"url string gave nil NSURL: '%@'", objectURLString];
object = moduleFolder;
pathString = [objectURL path];
if ([pathString hasPrefix: @"/"])
pathString = [pathString substringFromIndex: 1];
if ([pathString length] > 0)
if (objectURL)
{
path = [pathString componentsSeparatedByString: @"/"];
max = [path count];
if (max > 0)
object = moduleFolder;
pathString = [objectURL path];
if ([pathString hasPrefix: @"/"])
pathString = [pathString substringFromIndex: 1];
if ([pathString length] > 0)
{
for (count = 0;
object && count < max;
count++)
path = [pathString componentsSeparatedByString: @"/"];
max = [path count];
if (max > 0)
{
nameInContainer = [[path objectAtIndex: count]
for (count = 0;
object && count < max;
count++)
{
nameInContainer = [[path objectAtIndex: count]
stringByUnescapingURL];
object = [object lookupName: nameInContainer
inContext: woContext
acquire: NO];
if ([object isKindOfClass: SOGoObjectK])
[woContext setClientObject: object];
else
object = nil;
object = [object lookupName: nameInContainer
inContext: woContext
acquire: NO];
if ([object isKindOfClass: SOGoObjectK])
[woContext setClientObject: object];
else
object = nil;
}
}
}
}
else
object = nil;
else
object = nil;
// [self _setNewLastObject: object];
// ASSIGN (lastObjectURL, objectURLString);
}
else
{
object = nil;
[self errorWithFormat: @"url string gave nil NSURL: '%@'", objectURLString];
}
[woContext setClientObject: object];
@ -437,7 +443,7 @@ static MAPIStoreMapping *mapping = nil;
{
folder = [self lookupObject: folderURL];
if (folder)
keys = [folder toOneRelationshipKeys];
keys = [self getFolderMessageKeys: folder];
else
keys = (NSArray *) [NSNull null];
[messageCache setObject: keys forKey: folderURL];
@ -446,6 +452,13 @@ static MAPIStoreMapping *mapping = nil;
return keys;
}
- (NSArray *) getFolderMessageKeys: (SOGoFolder *) folder
{
[self subclassResponsibility: _cmd];
return (NSArray *) [NSNull null];
}
- (NSArray *) _subfolderKeysForFolderURL: (NSString *) folderURL
{
NSArray *keys;

View File

@ -76,6 +76,11 @@ static Class SOGoUserFolderK;
[moduleFolder retain];
}
- (NSArray *) getFolderMessageKeys: (SOGoFolder *) folder
{
return [(SOGoMailFolder *) folder toOneRelationshipKeys];
}
// - (int) getCommonTableChildproperty: (void **) data
// atURL: (NSString *) childURL
// withTag: (uint32_t) proptag

View File

@ -0,0 +1,34 @@
/* SOGoGCSFolder+MAPIStore.h - this file is part of SOGo
*
* Copyright (C) 2010 Inverse inc.
*
* Author: Wolfgang Sourdeau <wsourdeau@inverse.ca>
*
* This file is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2, or (at your option)
* any later version.
*
* This file is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; see the file COPYING. If not, write to
* the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
* Boston, MA 02111-1307, USA.
*/
#ifndef SOGOGCSFOLDER_MAPISTORE_H
#define SOGOGCSFOLDER_MAPISTORE_H
#import <SOGo/SOGoGCSFolder.h>
@interface SOGoGCSFolder (MAPIStore)
- (NSArray *) componentKeysWithType: (NSString *) component;
@end
#endif /* SOGOGCSFOLDER+MAPISTORE_H */

View File

@ -0,0 +1,54 @@
/* SOGoGCSFolder+MAPIStore.m - this file is part of SOGo
*
* Copyright (C) 2010 Inverse inc.
*
* Author: Wolfgang Sourdeau <wsourdeau@inverse.ca>
*
* This file is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2, or (at your option)
* any later version.
*
* This file is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; see the file COPYING. If not, write to
* the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
* Boston, MA 02111-1307, USA.
*/
#import <Foundation/NSArray.h>
#import <Foundation/NSDictionary.h>
#import <Foundation/NSString.h>
#import "SOGoGCSFolder+MAPIStore.h"
@implementation SOGoGCSFolder (MAPIStore)
- (NSArray *) componentKeysWithType: (NSString *) component
{
NSArray *records;
NSMutableArray *keys;
NSInteger count, max;
NSDictionary *record;
[self toOneRelationshipKeys];
records = [childRecords allValues];
max = [records count];
keys = [NSMutableArray arrayWithCapacity: max];
for (count = 0; count < max; count++)
{
record = [records objectAtIndex: count];
if ([[record objectForKey: @"c_component"]
isEqualToString: component])
[keys addObject: [record objectForKey: @"c_name"]];
}
return keys;
}
@end