Monotone-Parent: 425bfc2f774ffc6abc9a76908ac1b2fcf7d6ad14

Monotone-Revision: 82a617e3ad7bb1a96e181c9d1c240bc2c89de7f7

Monotone-Author: wsourdeau@inverse.ca
Monotone-Date: 2012-02-03T15:05:19
Monotone-Branch: ca.inverse.sogo
maint-2.0.2
Wolfgang Sourdeau 2012-02-03 15:05:19 +00:00
parent 3bf138283b
commit d64c7164d7
5 changed files with 30 additions and 20 deletions

View File

@ -1,5 +1,9 @@
2012-02-03 Wolfgang Sourdeau <wsourdeau@inverse.ca>
* OpenChange/MAPIStoreFolder.m (-createFolder:withFID:andKey:):
modified method to return a enum mapistore_error, in order to
better determine of the failures that occur.
* OpenChange/MAPIStoreMailFolder.m (-deleteFolder): overriden method.
* SoObjects/Mailer/SOGoMailFolder.m (-exists): new method that

View File

@ -42,9 +42,7 @@
#undef DEBUG
#include <mapistore/mapistore.h>
// #include <mapistore/mapistore_errors.h>
// #include <libmapiproxy.h>
// #include <param.h>
#include <mapistore/mapistore_errors.h>
static Class EOKeyValueQualifierK;
@ -75,8 +73,9 @@ static NSString *MAPIStoreRightFolderContact = @"RightsFolderContact";
return [MAPIStoreFSFolderTable tableForContainer: self];
}
- (NSString *) createFolder: (struct SRow *) aRow
withFID: (uint64_t) newFID
- (enum mapistore_error) createFolder: (struct SRow *) aRow
withFID: (uint64_t) newFID
andKey: (NSString **) newKeyP
{
NSString *newKey, *urlString;
NSURL *childURL;
@ -89,8 +88,9 @@ static NSString *MAPIStoreRightFolderContact = @"RightsFolderContact";
childFolder = [SOGoMAPIFSFolder folderWithURL: childURL
andTableType: MAPISTORE_MESSAGE_TABLE];
[childFolder ensureDirectory];
*newKeyP = newKey;
return newKey;
return MAPISTORE_SUCCESS;
}
- (MAPIStoreMessage *) createMessage

View File

@ -145,8 +145,9 @@
andCN: (NSNumber **) cnNbr
inTableType: (enum mapistore_table_type) tableType;
- (NSString *) createFolder: (struct SRow *) aRow
withFID: (uint64_t) newFID;
- (enum mapistore_error) createFolder: (struct SRow *) aRow
withFID: (uint64_t) newFID
andKey: (NSString **) newKeyP;
- (NSCalendarDate *) lastMessageModificationTime;

View File

@ -354,8 +354,8 @@ Class NSExceptionK, MAPIStoreFAIMessageK, MAPIStoreMessageTableK, MAPIStoreFAIMe
rc = MAPISTORE_ERR_EXIST;
else
{
folderKey = [self createFolder: aRow withFID: fid];
if (folderKey)
rc = [self createFolder: aRow withFID: fid andKey: &folderKey];
if (rc == MAPISTORE_SUCCESS)
{
[self cleanupCaches];
baseURL = [self url];
@ -374,8 +374,6 @@ Class NSExceptionK, MAPIStoreFAIMessageK, MAPIStoreMessageTableK, MAPIStoreFAIMe
[NSException raise: @"MAPIStoreIOException"
format: @"unable to fetch created folder"];
}
else
rc = MAPISTORE_ERROR;
}
}
else
@ -1299,12 +1297,13 @@ Class NSExceptionK, MAPIStoreFAIMessageK, MAPIStoreMessageTableK, MAPIStoreFAIMe
return newMessage;
}
- (NSString *) createFolder: (struct SRow *) aRow
withFID: (uint64_t) newFID
- (enum mapistore_error) createFolder: (struct SRow *) aRow
withFID: (uint64_t) newFID
andKey: (NSString **) newKeyP
{
[self errorWithFormat: @"new folders cannot be created in this context"];
return nil;
return MAPISTORE_ERR_DENIED;
}
/* helpers */

View File

@ -127,9 +127,11 @@ static Class SOGoMailFolderK;
return [MAPIStoreMailMessageTable tableForContainer: self];
}
- (NSString *) createFolder: (struct SRow *) aRow
withFID: (uint64_t) newFID
- (enum mapistore_error) createFolder: (struct SRow *) aRow
withFID: (uint64_t) newFID
andKey: (NSString **) newKeyP
{
enum mapistore_error rc;
NSString *folderName, *nameInContainer;
SOGoMailFolder *newFolder;
int i;
@ -151,11 +153,15 @@ static Class SOGoMailFolderK;
[folderName asCSSIdentifier]];
newFolder = [SOGoMailFolderK objectWithName: nameInContainer
inContainer: sogoObject];
if (![newFolder create])
nameInContainer = nil;
if ([newFolder create])
*newKeyP = nameInContainer;
else if ([newFolder exists])
rc = MAPISTORE_ERR_EXIST;
else
rc = MAPISTORE_ERR_DENIED;
}
return nameInContainer;
return rc;
}
- (int) deleteFolder