Monotone-Parent: c7755bd4c79d8115db4835ecb7a3fb92ab273020
Monotone-Revision: ce03c421dd517ee3c93be821faec36a023b0c257 Monotone-Author: wsourdeau@inverse.ca Monotone-Date: 2010-11-30T21:04:05 Monotone-Branch: ca.inverse.sogo
This commit is contained in:
parent
8849fbf7c4
commit
8b4f49e142
|
@ -10,6 +10,8 @@
|
|||
returned from the getXXXChildProperty.. methods, the tag is set to
|
||||
its corresponding error tag and the error code is returned as a
|
||||
long value.
|
||||
(-getProperty:withFMID:ofTableType:intoFile:): implemented
|
||||
"op_get_property_into_fd" backend method.
|
||||
|
||||
2010-11-26 Wolfgang Sourdeau <wsourdeau@inverse.ca>
|
||||
|
||||
|
|
|
@ -128,12 +128,22 @@
|
|||
withFMID: (uint64_t) fmid
|
||||
ofTableType: (uint8_t) tableType
|
||||
fromFile: (NSFileHandle *) aFile;
|
||||
- (int) getProperty: (enum MAPITAGS) property
|
||||
withFMID: (uint64_t) fmid
|
||||
ofTableType: (uint8_t) tableType
|
||||
intoFile: (NSFileHandle *) aFile;
|
||||
- (int) modifyRecipientsWithMID: (uint64_t) mid
|
||||
inRows: (struct ModifyRecipientRow *) rows
|
||||
withCount: (NSUInteger) max;
|
||||
- (int) deleteMessageWithMID: (uint64_t) mid
|
||||
withFlags: (uint8_t) flags;
|
||||
|
||||
|
||||
/* util methods */
|
||||
- (void) registerValue: (id) value
|
||||
asProperty: (enum MAPITAGS) property
|
||||
forURL: (NSString *) url;
|
||||
|
||||
/* subclass methods */
|
||||
+ (NSString *) MAPIModuleName;
|
||||
+ (void) registerFixedMappings: (MAPIStoreMapping *) storeMapping;
|
||||
|
|
|
@ -55,6 +55,8 @@
|
|||
#include <mapistore/mapistore_errors.h>
|
||||
#include <libmapiproxy.h>
|
||||
|
||||
/* TODO: homogenize method names and order of parameters */
|
||||
|
||||
@interface SOGoFolder (MAPIStoreProtocol)
|
||||
|
||||
- (BOOL) create;
|
||||
|
@ -1282,6 +1284,52 @@ _prepareContextClass (struct mapistore_context *newMemCtx,
|
|||
return rc;
|
||||
}
|
||||
|
||||
- (int) getProperty: (enum MAPITAGS) property
|
||||
withFMID: (uint64_t) fmid
|
||||
ofTableType: (uint8_t) tableType
|
||||
intoFile: (NSFileHandle *) aFile
|
||||
{
|
||||
NSMutableDictionary *message;
|
||||
NSNumber *midNbr;
|
||||
NSData *fileData;
|
||||
enum MAPISTATUS rc;
|
||||
|
||||
switch (tableType)
|
||||
{
|
||||
case MAPISTORE_MESSAGE:
|
||||
midNbr = [NSNumber numberWithUnsignedLongLong: fmid];
|
||||
message = [messages objectForKey: midNbr];
|
||||
if (message)
|
||||
{
|
||||
fileData = [message objectForKey: MAPIPropertyNumber (property)];
|
||||
/* TODO: only NSData is supported right now */
|
||||
if (fileData)
|
||||
{
|
||||
[aFile writeData: fileData];
|
||||
rc = MAPI_E_SUCCESS;
|
||||
}
|
||||
else
|
||||
rc = MAPI_E_NOT_FOUND;
|
||||
}
|
||||
else
|
||||
rc = MAPI_E_INVALID_OBJECT;
|
||||
break;
|
||||
|
||||
// [message setObject: NSObjectFromStreamData (property, fileData)
|
||||
// forKey: MAPIPropertyNumber (property)];
|
||||
// rc = MAPISTORE_SUCCESS;
|
||||
// }
|
||||
// else
|
||||
case MAPISTORE_FOLDER:
|
||||
default:
|
||||
[self errorWithFormat: @"%s: value of tableType not handled: %d",
|
||||
__FUNCTION__, tableType];
|
||||
rc = MAPI_E_INVALID_OBJECT;
|
||||
}
|
||||
|
||||
return rc;
|
||||
}
|
||||
|
||||
- (NSDictionary *) _convertRecipientFromRow: (struct RecipientRow *) row
|
||||
{
|
||||
NSMutableDictionary *recipient;
|
||||
|
@ -1425,4 +1473,33 @@ _prepareContextClass (struct mapistore_context *newMemCtx,
|
|||
return rc;
|
||||
}
|
||||
|
||||
/* utils */
|
||||
|
||||
- (void) registerValue: (id) value
|
||||
asProperty: (enum MAPITAGS) property
|
||||
forURL: (NSString *) url
|
||||
{
|
||||
/* TODO: this method is a hack to enable the saving of property values which
|
||||
need to be passed as streams. Must be removed after the
|
||||
getProperty/setProperty mechanisms have been rethought. */
|
||||
NSMutableDictionary *message;
|
||||
uint64_t fmid;
|
||||
NSNumber *midNbr;
|
||||
|
||||
fmid = [mapping idFromURL: url];
|
||||
if (fmid != NSNotFound)
|
||||
{
|
||||
midNbr = [NSNumber numberWithUnsignedLongLong: fmid];
|
||||
message = [messages objectForKey: midNbr];
|
||||
if (!message)
|
||||
{
|
||||
message = [NSMutableDictionary new];
|
||||
[messages setObject: message forKey: midNbr];
|
||||
[message release];
|
||||
[message setObject: midNbr forKey: @"mid"];
|
||||
}
|
||||
[message setObject: value forKey: MAPIPropertyNumber (property)];
|
||||
}
|
||||
}
|
||||
|
||||
@end
|
||||
|
|
|
@ -619,6 +619,36 @@ static int sogo_op_set_property_from_fd(void *private_data,
|
|||
return rc;
|
||||
}
|
||||
|
||||
static int sogo_op_get_property_into_fd(void *private_data,
|
||||
uint64_t fmid, uint8_t type,
|
||||
uint32_t property, int fd)
|
||||
{
|
||||
NSAutoreleasePool *pool;
|
||||
sogo_context *cContext;
|
||||
MAPIStoreContext *context;
|
||||
NSFileHandle *fileHandle;
|
||||
int rc;
|
||||
|
||||
DEBUG (5, ("[SOGo: %s:%d]\n", __FUNCTION__, __LINE__));
|
||||
|
||||
pool = [NSAutoreleasePool new];
|
||||
|
||||
cContext = private_data;
|
||||
context = cContext->objcContext;
|
||||
[context setupRequest];
|
||||
|
||||
fileHandle = [[NSFileHandle alloc] initWithFileDescriptor: fd
|
||||
closeOnDealloc: NO];
|
||||
rc = [context getProperty: property withFMID: fmid ofTableType: type
|
||||
intoFile: fileHandle];
|
||||
[fileHandle release];
|
||||
|
||||
[context tearDownRequest];
|
||||
[pool release];
|
||||
|
||||
return rc;
|
||||
}
|
||||
|
||||
static int sogo_op_modifyrecipients(void *private_data,
|
||||
uint64_t mid,
|
||||
struct ModifyRecipientRow *rows,
|
||||
|
@ -742,6 +772,7 @@ int mapistore_init_backend(void)
|
|||
backend.op_get_fid_by_name = sogo_op_get_fid_by_name;
|
||||
backend.op_setprops = sogo_op_setprops;
|
||||
backend.op_set_property_from_fd = sogo_op_set_property_from_fd;
|
||||
backend.op_get_property_into_fd = sogo_op_get_property_into_fd;
|
||||
backend.op_modifyrecipients = sogo_op_modifyrecipients;
|
||||
backend.op_deletemessage = sogo_op_deletemessage;
|
||||
backend.op_get_folders_list = sogo_op_get_folders_list;
|
||||
|
|
Loading…
Reference in a new issue